[ros-diffs] [dgorbachev] 53798: [FREELDR] Put uninitialized/zero-initialized data into .bss. Fill it with 0s at startup.

dgorbachev at svn.reactos.org dgorbachev at svn.reactos.org
Thu Sep 22 06:07:02 UTC 2011


Author: dgorbachev
Date: Thu Sep 22 06:06:51 2011
New Revision: 53798

URL: http://svn.reactos.org/svn/reactos?rev=53798&view=rev
Log:
[FREELDR]
Put uninitialized/zero-initialized data into .bss. Fill it with 0s at startup.

Modified:
    trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt
    trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S
    trunk/reactos/boot/freeldr/freeldr/arch/i386/multiboot.S
    trunk/reactos/boot/freeldr/freeldr/freeldr_i386.lnk

Modified: trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt?rev=53798&r1=53797&r2=53798&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/CMakeLists.txt [iso-8859-1] Thu Sep 22 06:06:51 2011
@@ -203,10 +203,6 @@
     list(APPEND SETUPLDR_SOURCE windows/setupldr.c)
 endif()
 
-if(NOT MSVC)
-    set_source_files_properties(${SETUPLDR_SOURCE} PROPERTIES COMPILE_FLAGS "-ffreestanding -fno-builtin -fno-inline -fno-zero-initialized-in-bss")
-endif()
-
 add_executable(setupldr_pe ${FREELDR_BASE_SOURCE} ${SETUPLDR_SOURCE})
 
 if(NOT MSVC)

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S?rev=53798&r1=53797&r2=53798&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/entry.S [iso-8859-1] Thu Sep 22 06:06:51 2011
@@ -70,11 +70,19 @@
     /* Initialize the idt */
     call _InitIdt
 
+#ifndef _USE_ML
+    /* Clean out bss */
+    xor eax, eax
+    mov edi, offset __bss_start__
+    mov ecx, offset __bss_end__ + 3
+    sub ecx, edi
+    shr ecx, 2
+    rep stosd
+
     /* Pass the command line to BootMain */
-#ifdef _USE_ML
+    mov eax, offset cmdline
+#else
     xor eax, eax
-#else
-    mov eax, offset cmdline
 #endif
 
 	/* GO! */

Modified: trunk/reactos/boot/freeldr/freeldr/arch/i386/multiboot.S
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/arch/i386/multiboot.S?rev=53798&r1=53797&r2=53798&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/arch/i386/multiboot.S [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/arch/i386/multiboot.S [iso-8859-1] Thu Sep 22 06:06:51 2011
@@ -58,7 +58,7 @@
     /* load_addr */
     .long INITIAL_BASE
     /* load_end_addr */
-    .long INITIAL_BASE + __bss_start__ - FREELDR_BASE
+    .long 0
     /* bss_end_addr */
     .long 0
     /* entry_addr */
@@ -98,16 +98,9 @@
     /* Relocate itself to lower address */
     mov esi, INITIAL_BASE
     mov edi, FREELDR_BASE
-    mov ecx, (offset __bss_start__ - FREELDR_BASE + 3)
+    mov ecx, offset __bss_start__ - FREELDR_BASE
     shr ecx, 2
     rep movsd
-
-    /* Clean out bss */
-    xor eax, eax
-    mov ecx, offset __bss_end__ + 3
-    sub ecx, offset __bss_start__
-    shr ecx, 2
-    rep stosd
 
     /* Load segment registers for real-address mode */
     lgdt gdtptr

Modified: trunk/reactos/boot/freeldr/freeldr/freeldr_i386.lnk
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/freeldr_i386.lnk?rev=53798&r1=53797&r2=53798&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/freeldr_i386.lnk [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/freeldr_i386.lnk [iso-8859-1] Thu Sep 22 06:06:51 2011
@@ -1,58 +1,103 @@
-OUTPUT_FORMAT(pei-i386)
-ENTRY(_mainCRTStartup)
 SECTIONS
 {
-  .text  __image_base__ + __section_alignment__  : 
+  .text __image_base__ + __section_alignment__ :
   {
-    __text_start__ = .;
-    *(.init)
     *(.text)
-    *(SORT(.text$*))
-    *(.glue_7t)
-    *(.glue_7)
-     ___CTOR_LIST__ = .; __CTOR_LIST__ = . ; 
-			LONG (-1); *(.ctors); *(.ctor); LONG (0); 
-     ___DTOR_LIST__ = .; __DTOR_LIST__ = . ; 
-			LONG (-1); *(.dtors); *(.dtor);  LONG (0); 
-     *(.fini)
-    /* ??? Why is .gcc_exc here?  */
-     *(.gcc_exc)
-     __text_end__ = .;
-    *(.gcc_except_table)
+    *(SORT(.text*))
+    *(.data)
+    *(SORT(.data*))
+    *(.rdata)
+    *(SORT(.rdata*))
   }
-  init BLOCK(__section_alignment__) :
+
+  .bss :
   {
-    __init_start__ = . ;
-    *(init)
-    __init_end__ = . ;
-  }
-  .data BLOCK(__section_alignment__) : 
-  {
-    __data_start__ = . ;
-    *(.data)
-    *(.data2)
-    *(SORT(.data$*))
-    *(.rdata)
-    *(SORT(.rdata$*))
-    *(.eh_frame)
-    __data_end__ = . ;
     __bss_start__ = . ;
     *(.bss)
     *(COMMON)
     __bss_end__ = . ;
   }
+
+  /* DWARF debug sections.
+     Symbols in the DWARF debugging sections are relative to the beginning
+     of the section.  Unlike other targets that fake this by putting the
+     section VMA at 0, the PE format will not allow it.  */
+  /* DWARF 1.1 and DWARF 2.  */
+  .debug_aranges BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_aranges)
+  }
+  .debug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_pubnames)
+  }
+  .debug_pubtypes BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_pubtypes)
+  }
+  /* DWARF 2.  */
+  .debug_info BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_info) *(.gnu.linkonce.wi.*)
+  }
+  .debug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_abbrev)
+  }
+  .debug_line BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_line)
+  }
+  .debug_frame BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_frame*)
+  }
+  .debug_str BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_str)
+  }
+  .debug_loc BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_loc)
+  }
+  .debug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_macinfo)
+  }
+  /* SGI/MIPS DWARF 2 extensions.  */
+  .debug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_weaknames)
+  }
+  .debug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_funcnames)
+  }
+  .debug_typenames BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_typenames)
+  }
+  .debug_varnames BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_varnames)
+  }
+  .debug_macro BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_macro)
+  }
+  /* DWARF 3.  */
+  .debug_ranges BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_ranges)
+  }
+  /* DWARF 4.  */
+  .debug_types BLOCK(__section_alignment__) (NOLOAD) :
+  {
+    *(.debug_types) *(.gnu.linkonce.wt.*)
+  }
+
   /DISCARD/ :
   {
-    *(.drectve)
+    *(*)
   }
-  .stab BLOCK(__section_alignment__) (NOLOAD) :
-  {
-    [ .stab ]
-  }
-  .stabstr BLOCK(__section_alignment__) (NOLOAD) :
-  {
-    [ .stabstr ]
-  }
-
 }
-




More information about the Ros-diffs mailing list