From c21076a36c621658d1fda89b0df9483fec341aec Mon Sep 17 00:00:00 2001 From: David Welch Date: Wed, 11 Apr 2001 22:13:21 +0000 Subject: [PATCH] buildno doesn't rewrite the include/reactos/buildno.h Discard relocations and import table from ntoskrnl Reorganise multiboot.S svn path=/trunk/; revision=1787 --- reactos/apps/utils/buildno/Makefile | 4 +- reactos/apps/utils/buildno/buildno.c | 125 +++++++++++++-------------- reactos/ntoskrnl/Makefile | 4 +- reactos/ntoskrnl/ke/i386/gdt.c | 6 ++ reactos/ntoskrnl/ke/i386/idt.c | 8 ++ reactos/ntoskrnl/ke/i386/multiboot.S | 14 +-- reactos/ntoskrnl/ntoskrnl.lnk | 16 ++-- 7 files changed, 90 insertions(+), 87 deletions(-) diff --git a/reactos/apps/utils/buildno/Makefile b/reactos/apps/utils/buildno/Makefile index 9028abf7beb..eb6f508631e 100644 --- a/reactos/apps/utils/buildno/Makefile +++ b/reactos/apps/utils/buildno/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.8 2000/10/07 13:41:44 dwelch Exp $ +# $Id: Makefile,v 1.9 2001/04/11 22:13:21 dwelch Exp $ # PATH_TO_TOP = ../.. @@ -12,7 +12,7 @@ all: $(TARGETNAME)$(EXE_POSTFIX) $(TARGETNAME)$(EXE_POSTFIX): $(TARGETNAME).c ../../include/reactos/version.h - $(HOST_CC) -o $(TARGETNAME)$(EXE_POSTFIX) $(TARGETNAME).c + $(HOST_CC) -g -o $(TARGETNAME)$(EXE_POSTFIX) $(TARGETNAME).c diff --git a/reactos/apps/utils/buildno/buildno.c b/reactos/apps/utils/buildno/buildno.c index 933c9d91929..0b39c471f94 100644 --- a/reactos/apps/utils/buildno/buildno.c +++ b/reactos/apps/utils/buildno/buildno.c @@ -1,4 +1,4 @@ -/* $Id: buildno.c,v 1.5 2000/12/10 16:23:15 ea Exp $ +/* $Id: buildno.c,v 1.6 2001/04/11 22:13:21 dwelch Exp $ * * buildno - Generate the build number for ReactOS * @@ -85,73 +85,70 @@ elapsed_days ( void write_h (int build) { - FILE *h = NULL; + FILE *h = NULL; + char* s; + char* s1; + int length; - h = fopen ( BUILDNO_INCLUDE_FILE, "w"); - if (!h) + s1 = s = malloc(256 * 1024); + + s = s + sprintf (s, "/* Do not edit - Machine generated */\n"); + + s = s + sprintf (s, "#ifndef _INC_REACTOS_BUILDNO\n" ); + s = s + sprintf (s, "#define _INC_REACTOS_BUILDNO\n" ); + + s = s + sprintf (s, "#define KERNEL_VERSION_BUILD\t%d\n", build); + s = s + sprintf (s, "#define KERNEL_VERSION_BUILD_STR\t\"%d\"\n", build); + s = s + sprintf (s, "#define KERNEL_RELEASE_RC\t\"%d.%d.%d.%d\\0\"\n", + KERNEL_VERSION_MAJOR, KERNEL_VERSION_MINOR, + KERNEL_VERSION_PATCH_LEVEL, build); + s = s + sprintf (s, "#define KERNEL_RELEASE_STR\t\"%d.%d.%d.%d\"\n", + KERNEL_VERSION_MAJOR, + KERNEL_VERSION_MINOR, + KERNEL_VERSION_PATCH_LEVEL, + build); + s = s + sprintf (s, "#define KERNEL_VERSION_RC\t\"%d.%d.%d\\0\"\n", + KERNEL_VERSION_MAJOR, + KERNEL_VERSION_MINOR, + KERNEL_VERSION_PATCH_LEVEL); + s = s + sprintf (s, "#define KERNEL_VERSION_STR\t\"%d.%d.%d\"\n", + KERNEL_VERSION_MAJOR, + KERNEL_VERSION_MINOR, + KERNEL_VERSION_PATCH_LEVEL); + s = s + sprintf (s, "#endif\n/* EOF */\n"); + + h = fopen (BUILDNO_INCLUDE_FILE, "r"); + if (h != NULL) + { + fseek(h, 0, SEEK_END); + length = ftell(h); + if (length == strlen(s1)) { - fprintf ( - stderr, - "%s: can not create file \"%s\"!\n", - argv0, - BUILDNO_INCLUDE_FILE - ); - return; + char* orig; + + orig = malloc(length); + fseek(h, 0, SEEK_SET); + fread(orig, 1, length, h); + if (memcmp(s1, orig, length) == 0) + { + fclose(h); + return; + } } - fprintf ( - h, - "/* Do not edit - Machine generated */\n" - ); - - fprintf (h, "#ifndef _INC_REACTOS_BUILDNO\n" ); - fprintf (h, "#define _INC_REACTOS_BUILDNO\n" ); + fclose(h); + } - fprintf ( - h, - "#define KERNEL_VERSION_BUILD\t%d\n", - build - ); - fprintf ( - h, - "#define KERNEL_VERSION_BUILD_STR\t\"%d\"\n", - build - ); - fprintf ( - h, - "#define KERNEL_RELEASE_RC\t\"%d.%d.%d.%d\\0\"\n", - KERNEL_VERSION_MAJOR, - KERNEL_VERSION_MINOR, - KERNEL_VERSION_PATCH_LEVEL, - build - ); - fprintf ( - h, - "#define KERNEL_RELEASE_STR\t\"%d.%d.%d.%d\"\n", - KERNEL_VERSION_MAJOR, - KERNEL_VERSION_MINOR, - KERNEL_VERSION_PATCH_LEVEL, - build - ); - fprintf ( - h, - "#define KERNEL_VERSION_RC\t\"%d.%d.%d\\0\"\n", - KERNEL_VERSION_MAJOR, - KERNEL_VERSION_MINOR, - KERNEL_VERSION_PATCH_LEVEL - ); - fprintf ( - h, - "#define KERNEL_VERSION_STR\t\"%d.%d.%d\"\n", - KERNEL_VERSION_MAJOR, - KERNEL_VERSION_MINOR, - KERNEL_VERSION_PATCH_LEVEL - ); - fprintf ( - h, - "#endif\n/* EOF */\n" - ); - - fclose (h); + h = fopen (BUILDNO_INCLUDE_FILE, "w"); + if (!h) + { + fprintf (stderr, + "%s: can not create file \"%s\"!\n", + argv0, + BUILDNO_INCLUDE_FILE); + return; + } + fwrite(s1, 1, strlen(s1), h); + fclose (h); } void diff --git a/reactos/ntoskrnl/Makefile b/reactos/ntoskrnl/Makefile index cbdf1d616bc..4ac5c2e5dc9 100644 --- a/reactos/ntoskrnl/Makefile +++ b/reactos/ntoskrnl/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.32 2001/04/10 22:13:22 dwelch Exp $ +# $Id: Makefile,v 1.33 2001/04/11 22:13:21 dwelch Exp $ # # ReactOS Operating System # @@ -524,7 +524,7 @@ $(TARGETNAME).nostrip.exe: $(TARGETNAME).o $(TARGETNAME).a $(IE_DATA) $(TARGETNAME).o -lgcc - $(RM) temp.exp -$(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a +$(TARGETNAME).exe: $(TARGETNAME).o $(TARGETNAME).a $(TARGETNAME).lnk $(CC) \ -Wl,-T,ntoskrnl.lnk \ -nostartfiles -nostdlib \ diff --git a/reactos/ntoskrnl/ke/i386/gdt.c b/reactos/ntoskrnl/ke/i386/gdt.c index 4dcf64ca731..4873277f6c4 100644 --- a/reactos/ntoskrnl/ke/i386/gdt.c +++ b/reactos/ntoskrnl/ke/i386/gdt.c @@ -49,6 +49,12 @@ USHORT KiGdt[11 * 4] = 0x0, 0x0, 0x0, 0x0 /* Trap TSS */ }; +struct +{ + USHORT Length; + ULONG Base; +} __attribute__((packed)) KiGdtDescriptor = { 11 * 8, (ULONG)KiGdt }; + static KSPIN_LOCK GdtLock; /* FUNCTIONS *****************************************************************/ diff --git a/reactos/ntoskrnl/ke/i386/idt.c b/reactos/ntoskrnl/ke/i386/idt.c index 9d646e29af8..1e2e2912705 100644 --- a/reactos/ntoskrnl/ke/i386/idt.c +++ b/reactos/ntoskrnl/ke/i386/idt.c @@ -19,5 +19,13 @@ IDT_DESCRIPTOR KiIdt[256]; +struct +{ + USHORT Length; + ULONG Base; +} __attribute__((packed)) KiIdtDescriptor = {256 * 8, (ULONG)KiIdt}; + + /* FUNCTIONS *****************************************************************/ + diff --git a/reactos/ntoskrnl/ke/i386/multiboot.S b/reactos/ntoskrnl/ke/i386/multiboot.S index ceb48af49c0..0feaacaa357 100644 --- a/reactos/ntoskrnl/ke/i386/multiboot.S +++ b/reactos/ntoskrnl/ke/i386/multiboot.S @@ -100,8 +100,8 @@ _multiboot_entry: * Load the GDTR and IDTR with new tables located above * 0xc0000000 */ - lgdt _gdt_descr - lidt _idt_descr + lgdt _KiGdtDescriptor + lidt _KiIdtDescriptor /* * Reload the data segment registers @@ -658,6 +658,7 @@ lowmem_pagetable: .long 0x3f0007,0x3f1007,0x3f2007,0x3f3007,0x3f4007,0x3f5007,0x3f6007,0x3f7007 .long 0x3f8007,0x3f9007,0x3fa007,0x3fb007,0x3fc007,0x3fd007,0x3fe007,0x3ff007 +.bss _unmap_me: .fill 4096, 1, 0 @@ -674,12 +675,5 @@ _trap_stack_top: _unmap_me3: .fill 4096, 1, 0 - -_gdt_descr: - .word (11*8)-1 - .long _KiGdt - -_idt_descr: - .word (256*8)-1 - .long _KiIdt + diff --git a/reactos/ntoskrnl/ntoskrnl.lnk b/reactos/ntoskrnl/ntoskrnl.lnk index 540669541f0..70d6f6c94e4 100644 --- a/reactos/ntoskrnl/ntoskrnl.lnk +++ b/reactos/ntoskrnl/ntoskrnl.lnk @@ -51,15 +51,15 @@ SECTIONS *(.debug$F) *(.drectve) } - .idata BLOCK(__section_alignment__) : + /DISCARD/ : { /* This cannot currently be handled with grouped sections. See pe.em:sort_sections. */ SORT(*)(.idata$2) SORT(*)(.idata$3) /* These zeroes mark the end of the import list. */ - LONG (0); LONG (0); LONG (0); LONG (0); LONG (0); - SORT(*)(.idata$4) +/* LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);*/ + SORT(*)(.idata$4) SORT(*)(.idata$5) SORT(*)(.idata$6) SORT(*)(.idata$7) @@ -80,12 +80,10 @@ SECTIONS *(COMMON) __bss_end__ = . ; } -/* - .reloc BLOCK(__section_alignment__) : - { - *(.reloc) - } -*/ + /DISCARD/ : + { + *(.reloc) + } .stab BLOCK(__section_alignment__) (NOLOAD) : { [ .stab ]