[PATCH] ppc64 boot: use memset to clear bss
authorOlaf Hering <olh@suse.de>
Sat, 29 Oct 2005 00:46:45 +0000 (17:46 -0700)
committerPaul Mackerras <paulus@samba.org>
Sat, 29 Oct 2005 05:07:38 +0000 (15:07 +1000)
Use memset to clear bss, instead of own version.

Signed-off-by: Olaf Hering <olh@suse.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Anton Blanchard <anton@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/ppc64/boot/crt0.S
arch/ppc64/boot/main.c

index 3861e7f9cf19fe47aafe8e65d52b600936d8b5c8..da6618a865c945916dfffe3f23d3521e2a6758aa 100644 (file)
@@ -25,24 +25,5 @@ _start:
        sync
        isync
 
-       ## Clear out the BSS as per ANSI C requirements
-
-       lis     r7,_end@ha
-       addi    r7,r7,_end@l            # r7 = &_end 
-       lis     r8,__bss_start@ha       # 
-       addi    r8,r8,__bss_start@l     # r8 = &_bss_start
-
-       ## Determine how large an area, in number of words, to clear
-
-       subf    r7,r8,r7                # r7 = &_end - &_bss_start + 1 
-       addi    r7,r7,3                 # r7 += 3 
-       srwi.   r7,r7,2                 # r7 = size in words.
-       beq     3f                      # If the size is zero, don't bother
-       addi    r8,r8,-4                # r8 -= 4 
-       mtctr   r7                      # SPRN_CTR = number of words to clear
-       li      r0,0                    # r0 = 0
-2:     stwu    r0,4(r8)                # Clear out a word
-       bdnz    2b                      # Keep clearing until done
-3:
        b       start
 
index d039c47f8e5a0d3be83b68c422498b2928dedd26..c2c1f3309113a3b0274078efff196d32fd91235a 100644 (file)
@@ -26,6 +26,7 @@ extern void flush_cache(void *, unsigned long);
 #define        ONE_MB          0x100000
 
 extern char _start[];
+extern char __bss_start[];
 extern char _end[];
 extern char _vmlinux_start[];
 extern char _vmlinux_end[];
@@ -138,6 +139,8 @@ void start(unsigned long a1, unsigned long a2, void *promptr)
        Elf64_Ehdr *elf64;
        Elf64_Phdr *elf64ph;
 
+       memset(__bss_start, 0, _end - __bss_start);
+
        prom = (int (*)(void *)) promptr;
        chosen_handle = finddevice("/chosen");
        if (chosen_handle == (void *) -1)