diff options
Diffstat (limited to 'arch/ppc64/boot/crt0.S')
| -rw-r--r-- | arch/ppc64/boot/crt0.S | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/ppc64/boot/crt0.S b/arch/ppc64/boot/crt0.S index da6618a865c9..5788a453a7a2 100644 --- a/arch/ppc64/boot/crt0.S +++ b/arch/ppc64/boot/crt0.S | |||
| @@ -14,9 +14,38 @@ | |||
| 14 | .text | 14 | .text |
| 15 | .globl _start | 15 | .globl _start |
| 16 | _start: | 16 | _start: |
| 17 | bl reloc_offset | ||
| 18 | |||
| 19 | reloc_offset: | ||
| 20 | mflr r0 | ||
| 21 | lis r9,reloc_offset@ha | ||
| 22 | addi r9,r9,reloc_offset@l | ||
| 23 | subf. r0,r9,r0 | ||
| 24 | beq clear_caches | ||
| 25 | |||
| 26 | reloc_got2: | ||
| 27 | lis r9,__got2_start@ha | ||
| 28 | addi r9,r9,__got2_start@l | ||
| 29 | lis r8,__got2_end@ha | ||
| 30 | addi r8,r8,__got2_end@l | ||
| 31 | subf. r8,r9,r8 | ||
| 32 | beq clear_caches | ||
| 33 | srwi. r8,r8,2 | ||
| 34 | mtctr r8 | ||
| 35 | add r9,r0,r9 | ||
| 36 | reloc_got2_loop: | ||
| 37 | lwz r8,0(r9) | ||
| 38 | add r8,r8,r0 | ||
| 39 | stw r8,0(r9) | ||
| 40 | addi r9,r9,4 | ||
| 41 | bdnz reloc_got2_loop | ||
| 42 | |||
| 43 | clear_caches: | ||
| 17 | lis r9,_start@h | 44 | lis r9,_start@h |
| 45 | add r9,r0,r9 | ||
| 18 | lis r8,_etext@ha | 46 | lis r8,_etext@ha |
| 19 | addi r8,r8,_etext@l | 47 | addi r8,r8,_etext@l |
| 48 | add r8,r0,r8 | ||
| 20 | 1: dcbf r0,r9 | 49 | 1: dcbf r0,r9 |
| 21 | icbi r0,r9 | 50 | icbi r0,r9 |
| 22 | addi r9,r9,0x20 | 51 | addi r9,r9,0x20 |
