On Wed, 29 Mar 2000, Richard Henderson wrote:

>The only reason you were able to move anything at all is that
>you were using bootpfile.[..]

Oh btw (talking about bootpfile), I recently noticed that bootpfile is
broken since via bootpfile nobody clears the bss and we rely on the bss to
be clear all over the kernel. To fix that instead of adding still more
assembler all over the place I removed the assembler from the x86 point
and I am doing now that in the common code so nobody can forget about that
anymore. Patch against 2.2.15pre16:

diff -urN 2.2.14/arch/alpha/vmlinux.lds bss/arch/alpha/vmlinux.lds
--- 2.2.14/arch/alpha/vmlinux.lds       Mon Jan 17 16:44:33 2000
+++ bss/arch/alpha/vmlinux.lds  Thu Mar 30 01:35:21 2000
@@ -39,9 +39,11 @@
   .got : { *(.got) }
   .sdata : { *(.sdata) }
   _edata = .;
-  _bss = .;
+
+  __bss_start = .;
   .sbss : { *(.sbss) *(.scommon) }
   .bss : { *(.bss) *(COMMON) }
+  __bss_stop = .;
   _end = .;
 
   .mdebug 0 : { *(.mdebug) }
diff -urN 2.2.14/arch/i386/kernel/head.S bss/arch/i386/kernel/head.S
--- 2.2.14/arch/i386/kernel/head.S      Mon Jan 17 16:44:33 2000
+++ bss/arch/i386/kernel/head.S Thu Mar 30 01:37:31 2000
@@ -83,22 +83,12 @@
 
 #ifdef __SMP__
        orw  %bx,%bx
-       jz  1f                          /* Initial CPU cleans BSS */
+       jz  1f                          /* Initial CPU setup the system */
        pushl $0
        popfl
        jmp checkCPUtype
 1:
 #endif __SMP__
-/*
- * Clear BSS first so that there are no surprises...
- */
-       xorl %eax,%eax
-       movl $ SYMBOL_NAME(__bss_start),%edi
-       movl $ SYMBOL_NAME(_end),%ecx
-       subl %edi,%ecx
-       cld
-       rep
-       stosb
 /*
  * start system 32-bit setup. We need to re-do some of the things done
  * in 16-bit mode for the "real" operations.
diff -urN 2.2.14/arch/i386/vmlinux.lds.S bss/arch/i386/vmlinux.lds.S
--- 2.2.14/arch/i386/vmlinux.lds.S      Mon Jan 17 16:44:33 2000
+++ bss/arch/i386/vmlinux.lds.S Thu Mar 30 01:35:01 2000
@@ -56,6 +56,7 @@
   .bss : {
        *(.bss)
        }
+  __bss_stop = .;
   _end = . ;
 
   /* Stabs debugging sections.  */
diff -urN 2.2.14/init/main.c bss/init/main.c
--- 2.2.14/init/main.c  Wed Jan  5 14:16:56 2000
+++ bss/init/main.c     Thu Mar 30 01:35:47 2000
@@ -1203,6 +1203,13 @@
 
 extern void initialize_secondary(void);
 
+static void __init clear_bss(void)
+{
+       extern char * __bss_start, __bss_stop;
+       memset(__bss_start, 0,
+              (unsigned long) __bss_stop - (unsigned long) __bss_start);
+}
+
 /*
  *     Activate the first processor.
  */
@@ -1210,9 +1217,13 @@
 asmlinkage void __init start_kernel(void)
 {
        char * command_line;
-
 #ifdef __SMP__
        static int boot_cpu = 1;
+#endif
+
+       clear_bss();
+
+#ifdef __SMP__
        /* "current" has been set up, we need to load it now */
        if (!boot_cpu)
                initialize_secondary();

Andrea

Reply via email to