buildno doesn't rewrite the include/reactos/buildno.h
authorDavid Welch <welch@cwcom.net>
Wed, 11 Apr 2001 22:13:21 +0000 (22:13 +0000)
committerDavid Welch <welch@cwcom.net>
Wed, 11 Apr 2001 22:13:21 +0000 (22:13 +0000)
Discard relocations and import table from ntoskrnl
Reorganise multiboot.S

svn path=/trunk/; revision=1787

reactos/apps/utils/buildno/Makefile
reactos/apps/utils/buildno/buildno.c
reactos/ntoskrnl/Makefile
reactos/ntoskrnl/ke/i386/gdt.c
reactos/ntoskrnl/ke/i386/idt.c
reactos/ntoskrnl/ke/i386/multiboot.S
reactos/ntoskrnl/ntoskrnl.lnk

index 9028abf..eb6f508 100644 (file)
@@ -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
 
 
 
index 933c9d9..0b39c47 100644 (file)
@@ -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
index cbdf1d6..4ac5c2e 100644 (file)
@@ -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 \
index 4dcf64c..4873277 100644 (file)
@@ -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 *****************************************************************/
index 9d646e2..1e2e291 100644 (file)
 
 IDT_DESCRIPTOR KiIdt[256];
 
+struct
+{
+  USHORT Length;
+  ULONG Base;
+} __attribute__((packed)) KiIdtDescriptor = {256 * 8, (ULONG)KiIdt};
+
+
 /* FUNCTIONS *****************************************************************/
 
+
index ceb48af..0feaaca 100644 (file)
@@ -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
+
 
index 5406695..70d6f6c 100644 (file)
@@ -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 ]