2 * Copyright (C) Paul Mackerras 1997.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
9 * NOTE: this code runs in 32 bit mode and is packaged as ELF32.
12 #include <asm/ppc_asm.h>
28 ## Clear out the BSS as per ANSI C requirements
31 addi r7,r7,_end@l # r7 = &_end
32 lis r8,__bss_start@ha #
33 addi r8,r8,__bss_start@l # r8 = &_bss_start
35 ## Determine how large an area, in number of words, to clear
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
44 2: stwu r0,4(r8) # Clear out a word
45 bdnz 2b # Keep clearing until done