diff options
Diffstat (limited to 'arch/powerpc/boot/crt0.S')
-rw-r--r-- | arch/powerpc/boot/crt0.S | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S new file mode 100644 index 000000000000..d2f2ace56cd3 --- /dev/null +++ b/arch/powerpc/boot/crt0.S | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Copyright (C) Paul Mackerras 1997. | ||
3 | * | ||
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. | ||
8 | * | ||
9 | * NOTE: this code runs in 32 bit mode and is packaged as ELF32. | ||
10 | */ | ||
11 | |||
12 | #include "ppc_asm.h" | ||
13 | |||
14 | .text | ||
15 | .globl _zimage_start | ||
16 | _zimage_start: | ||
17 | bl 1f | ||
18 | |||
19 | 1: | ||
20 | mflr r0 | ||
21 | lis r9,1b@ha | ||
22 | addi r9,r9,1b@l | ||
23 | subf. r0,r9,r0 | ||
24 | beq 3f | ||
25 | |||
26 | lis r9,__got2_start@ha | ||
27 | addi r9,r9,__got2_start@l | ||
28 | lis r8,__got2_end@ha | ||
29 | addi r8,r8,__got2_end@l | ||
30 | subf. r8,r9,r8 | ||
31 | beq 3f | ||
32 | srwi. r8,r8,2 | ||
33 | mtctr r8 | ||
34 | add r9,r0,r9 | ||
35 | 2: | ||
36 | lwz r8,0(r9) | ||
37 | add r8,r8,r0 | ||
38 | stw r8,0(r9) | ||
39 | addi r9,r9,4 | ||
40 | bdnz 2b | ||
41 | |||
42 | 3: | ||
43 | lis r9,_start@h | ||
44 | add r9,r0,r9 | ||
45 | lis r8,_etext@ha | ||
46 | addi r8,r8,_etext@l | ||
47 | add r8,r0,r8 | ||
48 | 4: dcbf r0,r9 | ||
49 | icbi r0,r9 | ||
50 | addi r9,r9,0x20 | ||
51 | cmplwi 0,r9,8 | ||
52 | blt 4b | ||
53 | sync | ||
54 | isync | ||
55 | |||
56 | mr r6,r1 | ||
57 | b start | ||
58 | |||