diff options
Diffstat (limited to 'arch/powerpc/boot/crt0.S')
-rw-r--r-- | arch/powerpc/boot/crt0.S | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S index 70e65b13e033..5a4215c4b014 100644 --- a/arch/powerpc/boot/crt0.S +++ b/arch/powerpc/boot/crt0.S | |||
@@ -16,8 +16,11 @@ | |||
16 | _zimage_start_opd: | 16 | _zimage_start_opd: |
17 | .long _zimage_start, 0, 0, 0 | 17 | .long _zimage_start, 0, 0, 0 |
18 | 18 | ||
19 | .weak _zimage_start | ||
19 | .globl _zimage_start | 20 | .globl _zimage_start |
20 | _zimage_start: | 21 | _zimage_start: |
22 | .globl _zimage_start_lib | ||
23 | _zimage_start_lib: | ||
21 | /* Work out the offset between the address we were linked at | 24 | /* Work out the offset between the address we were linked at |
22 | and the address where we're running. */ | 25 | and the address where we're running. */ |
23 | bl 1f | 26 | bl 1f |
@@ -44,7 +47,7 @@ _zimage_start: | |||
44 | addi r9,r9,4 | 47 | addi r9,r9,4 |
45 | bdnz 2b | 48 | bdnz 2b |
46 | 49 | ||
47 | /* Do a cache flush for our text, in case OF didn't */ | 50 | /* Do a cache flush for our text, in case the loader didn't */ |
48 | 3: lis r9,_start@ha | 51 | 3: lis r9,_start@ha |
49 | addi r9,r9,_start@l | 52 | addi r9,r9,_start@l |
50 | add r9,r0,r9 | 53 | add r9,r0,r9 |
@@ -59,6 +62,34 @@ _zimage_start: | |||
59 | sync | 62 | sync |
60 | isync | 63 | isync |
61 | 64 | ||
62 | mr r6,r1 | 65 | /* Clear the BSS */ |
63 | b start | 66 | lis r9,__bss_start@ha |
67 | addi r9,r9,__bss_start@l | ||
68 | add r9,r0,r9 | ||
69 | lis r8,_end@ha | ||
70 | addi r8,r8,_end@l | ||
71 | add r8,r0,r8 | ||
72 | li r10,0 | ||
73 | 5: stw r10,0(r9) | ||
74 | addi r9,r9,4 | ||
75 | cmplw cr0,r9,r8 | ||
76 | blt 5b | ||
64 | 77 | ||
78 | /* Possibly set up a custom stack */ | ||
79 | .weak _platform_stack_top | ||
80 | lis r8,_platform_stack_top@ha | ||
81 | addi r8,r8,_platform_stack_top@l | ||
82 | cmpwi r8,0 | ||
83 | beq 6f | ||
84 | add r8,r0,r8 | ||
85 | lwz r1,0(r8) | ||
86 | add r1,r0,r1 | ||
87 | li r0,0 | ||
88 | stwu r0,-16(r1) /* establish a stack frame */ | ||
89 | 6: | ||
90 | |||
91 | /* Call platform_init() */ | ||
92 | bl platform_init | ||
93 | |||
94 | /* Call start */ | ||
95 | b start | ||