diff options
Diffstat (limited to 'arch/powerpc/boot/crt0.S')
-rw-r--r-- | arch/powerpc/boot/crt0.S | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S index 70e65b13e033..3dc8d8f78499 100644 --- a/arch/powerpc/boot/crt0.S +++ b/arch/powerpc/boot/crt0.S | |||
@@ -16,6 +16,7 @@ | |||
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: |
21 | /* Work out the offset between the address we were linked at | 22 | /* Work out the offset between the address we were linked at |
@@ -44,7 +45,7 @@ _zimage_start: | |||
44 | addi r9,r9,4 | 45 | addi r9,r9,4 |
45 | bdnz 2b | 46 | bdnz 2b |
46 | 47 | ||
47 | /* Do a cache flush for our text, in case OF didn't */ | 48 | /* Do a cache flush for our text, in case the loader didn't */ |
48 | 3: lis r9,_start@ha | 49 | 3: lis r9,_start@ha |
49 | addi r9,r9,_start@l | 50 | addi r9,r9,_start@l |
50 | add r9,r0,r9 | 51 | add r9,r0,r9 |
@@ -59,6 +60,31 @@ _zimage_start: | |||
59 | sync | 60 | sync |
60 | isync | 61 | isync |
61 | 62 | ||
62 | mr r6,r1 | 63 | /* Clear the BSS */ |
63 | b start | 64 | lis r9,__bss_start@ha |
65 | addi r9,r9,__bss_start@l | ||
66 | lis r8,_end@ha | ||
67 | addi r8,r8,_end@l | ||
68 | li r0,0 | ||
69 | 5: stw r0,0(r9) | ||
70 | addi r9,r9,4 | ||
71 | cmplw cr0,r9,r8 | ||
72 | blt 5b | ||
64 | 73 | ||
74 | /* Possibly set up a custom stack */ | ||
75 | .weak _platform_stack_top | ||
76 | lis r8,_platform_stack_top@ha | ||
77 | addi r8,r8,_platform_stack_top@l | ||
78 | cmpwi r8,0 | ||
79 | beq 6f | ||
80 | lwz r1,0(r8) | ||
81 | li r0,0 | ||
82 | stwu r0,-16(r1) /* establish a stack frame */ | ||
83 | 6: | ||
84 | |||
85 | /* Call platform_init() */ | ||
86 | bl platform_init | ||
87 | |||
88 | /* Call start */ | ||
89 | mr r3,r1 | ||
90 | b start | ||