diff options
author | Olaf Hering <olh@suse.de> | 2005-10-28 20:46:45 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-10-29 01:07:38 -0400 |
commit | 9b0cbe97566dd7123eee0462d91703434fe61090 (patch) | |
tree | 816d6f93e2b84741c891e5edd600c6fdab91b675 /arch | |
parent | 06cf26beffc54bb43aebbefa60f84e0dffde3141 (diff) |
[PATCH] ppc64 boot: use memset to clear bss
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ppc64/boot/crt0.S | 19 | ||||
-rw-r--r-- | arch/ppc64/boot/main.c | 3 |
2 files changed, 3 insertions, 19 deletions
diff --git a/arch/ppc64/boot/crt0.S b/arch/ppc64/boot/crt0.S index 3861e7f9cf19..da6618a865c9 100644 --- a/arch/ppc64/boot/crt0.S +++ b/arch/ppc64/boot/crt0.S | |||
@@ -25,24 +25,5 @@ _start: | |||
25 | sync | 25 | sync |
26 | isync | 26 | isync |
27 | 27 | ||
28 | ## Clear out the BSS as per ANSI C requirements | ||
29 | |||
30 | lis r7,_end@ha | ||
31 | addi r7,r7,_end@l # r7 = &_end | ||
32 | lis r8,__bss_start@ha # | ||
33 | addi r8,r8,__bss_start@l # r8 = &_bss_start | ||
34 | |||
35 | ## Determine how large an area, in number of words, to clear | ||
36 | |||
37 | subf r7,r8,r7 # r7 = &_end - &_bss_start + 1 | ||
38 | addi r7,r7,3 # r7 += 3 | ||
39 | srwi. r7,r7,2 # r7 = size in words. | ||
40 | beq 3f # If the size is zero, don't bother | ||
41 | addi r8,r8,-4 # r8 -= 4 | ||
42 | mtctr r7 # SPRN_CTR = number of words to clear | ||
43 | li r0,0 # r0 = 0 | ||
44 | 2: stwu r0,4(r8) # Clear out a word | ||
45 | bdnz 2b # Keep clearing until done | ||
46 | 3: | ||
47 | b start | 28 | b start |
48 | 29 | ||
diff --git a/arch/ppc64/boot/main.c b/arch/ppc64/boot/main.c index d039c47f8e5a..c2c1f3309113 100644 --- a/arch/ppc64/boot/main.c +++ b/arch/ppc64/boot/main.c | |||
@@ -26,6 +26,7 @@ extern void flush_cache(void *, unsigned long); | |||
26 | #define ONE_MB 0x100000 | 26 | #define ONE_MB 0x100000 |
27 | 27 | ||
28 | extern char _start[]; | 28 | extern char _start[]; |
29 | extern char __bss_start[]; | ||
29 | extern char _end[]; | 30 | extern char _end[]; |
30 | extern char _vmlinux_start[]; | 31 | extern char _vmlinux_start[]; |
31 | extern char _vmlinux_end[]; | 32 | extern char _vmlinux_end[]; |
@@ -138,6 +139,8 @@ void start(unsigned long a1, unsigned long a2, void *promptr) | |||
138 | Elf64_Ehdr *elf64; | 139 | Elf64_Ehdr *elf64; |
139 | Elf64_Phdr *elf64ph; | 140 | Elf64_Phdr *elf64ph; |
140 | 141 | ||
142 | memset(__bss_start, 0, _end - __bss_start); | ||
143 | |||
141 | prom = (int (*)(void *)) promptr; | 144 | prom = (int (*)(void *)) promptr; |
142 | chosen_handle = finddevice("/chosen"); | 145 | chosen_handle = finddevice("/chosen"); |
143 | if (chosen_handle == (void *) -1) | 146 | if (chosen_handle == (void *) -1) |