diff options
author | Joakim Tjernlund <Joakim.Tjernlund@transmode.se> | 2010-01-19 14:41:56 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2010-01-26 19:30:13 +0100 |
commit | 0f8aa159175385ddd77bc91d11b9568583fbbd0c (patch) | |
tree | 5f2bd327b499525805cb7672eb7fca600ea5376e | |
parent | fc4e188789b01dc9f18c80869c43fdd7d1a51378 (diff) |
ppc: Use r12 instead of r14 as GOT pointer.
r14 is not supposed to be clobbered by functions. Switch
to r12 and call GET_GOT when needed. This will allow u-boot
to loose the -ffixed-r14 gcc option.
Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
-rw-r--r-- | cpu/74xx_7xx/start.S | 11 | ||||
-rw-r--r-- | cpu/mpc512x/start.S | 11 | ||||
-rw-r--r-- | cpu/mpc5xx/start.S | 11 | ||||
-rw-r--r-- | cpu/mpc5xxx/start.S | 11 | ||||
-rw-r--r-- | cpu/mpc8220/start.S | 11 | ||||
-rw-r--r-- | cpu/mpc824x/start.S | 11 | ||||
-rw-r--r-- | cpu/mpc8260/start.S | 15 | ||||
-rw-r--r-- | cpu/mpc83xx/start.S | 11 | ||||
-rw-r--r-- | cpu/mpc85xx/start.S | 11 | ||||
-rw-r--r-- | cpu/mpc86xx/start.S | 11 | ||||
-rw-r--r-- | cpu/mpc8xx/start.S | 11 | ||||
-rw-r--r-- | cpu/ppc4xx/start.S | 11 | ||||
-rw-r--r-- | include/ppc_asm.tmpl | 8 |
13 files changed, 79 insertions, 65 deletions
diff --git a/cpu/74xx_7xx/start.S b/cpu/74xx_7xx/start.S index efcd95f6923..88fdf88c342 100644 --- a/cpu/74xx_7xx/start.S +++ b/cpu/74xx_7xx/start.S @@ -63,7 +63,7 @@ /* * Set up GOT: Global Offset Table * - * Use r14 to access the GOT + * Use r12 to access the GOT */ START_GOT GOT_ENTRY(_GOT2_TABLE_) @@ -599,6 +599,7 @@ relocate_code: mr r9, r4 /* Save copy of Global Data pointer */ mr r10, r5 /* Save copy of Destination Address */ + GET_GOT mr r3, r5 /* Destination Address */ lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */ ori r4, r4, CONFIG_SYS_MONITOR_BASE@l @@ -616,7 +617,7 @@ relocate_code: sub r15, r10, r4 /* First our own GOT */ - add r14, r14, r15 + add r12, r12, r15 /* then the one used by the C code */ add r30, r30, r15 @@ -691,7 +692,7 @@ in_ram: bl board_init_ecc #endif /* - * Relocation Function, r14 point to got2+0x8000 + * Relocation Function, r12 point to got2+0x8000 * * Adjust got2 pointers, no need to check for 0, this code * already puts a few entries in the table. @@ -765,6 +766,8 @@ in_ram: */ .globl trap_init trap_init: + mflr r4 /* save link register */ + GET_GOT lwz r7, GOT(_start) lwz r8, GOT(_end_of_vectors) @@ -772,8 +775,6 @@ trap_init: cmplw 0, r7, r8 bgelr /* return if r7>=r8 - just in case */ - - mflr r4 /* save link register */ 1: lwz r0, 0(r7) stw r0, 0(r9) diff --git a/cpu/mpc512x/start.S b/cpu/mpc512x/start.S index 46c5efa053d..d26b61707e0 100644 --- a/cpu/mpc512x/start.S +++ b/cpu/mpc512x/start.S @@ -65,7 +65,7 @@ /* * Set up GOT: Global Offset Table * - * Use r14 to access the GOT + * Use r12 to access the GOT */ START_GOT GOT_ENTRY(_GOT2_TABLE_) @@ -486,6 +486,7 @@ relocate_code: mr r9, r4 /* Save copy of Global Data pointer */ mr r10, r5 /* Save copy of Destination Address */ + GET_GOT mr r3, r5 /* Destination Address */ lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */ ori r4, r4, CONFIG_SYS_MONITOR_BASE@l @@ -504,7 +505,7 @@ relocate_code: sub r15, r10, r4 /* First our own GOT */ - add r14, r14, r15 + add r12, r12, r15 /* then the one used by the C code */ add r30, r30, r15 @@ -584,7 +585,7 @@ relocate_code: in_ram: /* - * Relocation Function, r14 point to got2+0x8000 + * Relocation Function, r12 point to got2+0x8000 * * Adjust got2 pointers, no need to check for 0, this code * already puts a few entries in the table. @@ -648,6 +649,8 @@ clear_bss: */ .globl trap_init trap_init: + mflr r4 /* save link register */ + GET_GOT lwz r7, GOT(_start) lwz r8, GOT(_end_of_vectors) @@ -655,8 +658,6 @@ trap_init: cmplw 0, r7, r8 bgelr /* return if r7>=r8 - just in case */ - - mflr r4 /* save link register */ 1: lwz r0, 0(r7) stw r0, 0(r9) diff --git a/cpu/mpc5xx/start.S b/cpu/mpc5xx/start.S index be980a13564..0af879e3913 100644 --- a/cpu/mpc5xx/start.S +++ b/cpu/mpc5xx/start.S @@ -56,7 +56,7 @@ /* * Set up GOT: Global Offset Table * - * Use r14 to access the GOT + * Use r12 to access the GOT */ START_GOT GOT_ENTRY(_GOT2_TABLE_) @@ -372,6 +372,7 @@ relocate_code: mr r9, r4 /* Save copy of global data pointer in SRAM */ mr r10, r5 /* Save copy of monitor destination Address in SRAM */ + GET_GOT mr r3, r5 /* Destination Address */ lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */ ori r4, r4, CONFIG_SYS_MONITOR_BASE@l @@ -388,7 +389,7 @@ relocate_code: sub r15, r10, r4 /* First our own GOT */ - add r14, r14, r15 + add r12, r12, r15 /* the the one used by the C code */ add r30, r30, r15 @@ -433,7 +434,7 @@ relocate_code: in_ram: /* - * Relocation Function, r14 point to got2+0x8000 + * Relocation Function, r12 point to got2+0x8000 * * Adjust got2 pointers, no need to check for 0, this code * already puts a few entries in the table. @@ -497,6 +498,8 @@ clear_bss: */ .globl trap_init trap_init: + mflr r4 /* save link register */ + GET_GOT lwz r7, GOT(_start) lwz r8, GOT(_end_of_vectors) @@ -504,8 +507,6 @@ trap_init: cmplw 0, r7, r8 bgelr /* return if r7>=r8 - just in case */ - - mflr r4 /* save link register */ 1: lwz r0, 0(r7) stw r0, 0(r9) diff --git a/cpu/mpc5xxx/start.S b/cpu/mpc5xxx/start.S index 075a7dd8361..d499da5036a 100644 --- a/cpu/mpc5xxx/start.S +++ b/cpu/mpc5xxx/start.S @@ -56,7 +56,7 @@ /* * Set up GOT: Global Offset Table * - * Use r14 to access the GOT + * Use r12 to access the GOT */ START_GOT GOT_ENTRY(_GOT2_TABLE_) @@ -567,6 +567,7 @@ relocate_code: mr r9, r4 /* Save copy of Global Data pointer */ mr r10, r5 /* Save copy of Destination Address */ + GET_GOT mr r3, r5 /* Destination Address */ lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */ ori r4, r4, CONFIG_SYS_MONITOR_BASE@l @@ -584,7 +585,7 @@ relocate_code: sub r15, r10, r4 /* First our own GOT */ - add r14, r14, r15 + add r12, r12, r15 /* then the one used by the C code */ add r30, r30, r15 @@ -657,7 +658,7 @@ relocate_code: in_ram: /* - * Relocation Function, r14 point to got2+0x8000 + * Relocation Function, r12 point to got2+0x8000 * * Adjust got2 pointers, no need to check for 0, this code * already puts a few entries in the table. @@ -722,6 +723,8 @@ clear_bss: */ .globl trap_init trap_init: + mflr r4 /* save link register */ + GET_GOT lwz r7, GOT(_start) lwz r8, GOT(_end_of_vectors) @@ -729,8 +732,6 @@ trap_init: cmplw 0, r7, r8 bgelr /* return if r7>=r8 - just in case */ - - mflr r4 /* save link register */ 1: lwz r0, 0(r7) stw r0, 0(r9) diff --git a/cpu/mpc8220/start.S b/cpu/mpc8220/start.S index 5218c859dfc..e28999d3228 100644 --- a/cpu/mpc8220/start.S +++ b/cpu/mpc8220/start.S @@ -55,7 +55,7 @@ /* * Set up GOT: Global Offset Table * - * Use r14 to access the GOT + * Use r12 to access the GOT */ START_GOT GOT_ENTRY(_GOT2_TABLE_) @@ -532,6 +532,7 @@ relocate_code: mr r9, r4 /* Save copy of Global Data pointer */ mr r10, r5 /* Save copy of Destination Address */ + GET_GOT mr r3, r5 /* Destination Address */ lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */ ori r4, r4, CONFIG_SYS_MONITOR_BASE@l @@ -549,7 +550,7 @@ relocate_code: sub r15, r10, r4 /* First our own GOT */ - add r14, r14, r15 + add r12, r12, r15 /* then the one used by the C code */ add r30, r30, r15 @@ -622,7 +623,7 @@ relocate_code: in_ram: /* - * Relocation Function, r14 point to got2+0x8000 + * Relocation Function, r12 point to got2+0x8000 * * Adjust got2 pointers, no need to check for 0, this code * already puts a few entries in the table. @@ -687,6 +688,8 @@ clear_bss: */ .globl trap_init trap_init: + mflr r4 /* save link register */ + GET_GOT lwz r7, GOT(_start) lwz r8, GOT(_end_of_vectors) @@ -694,8 +697,6 @@ trap_init: cmplw 0, r7, r8 bgelr /* return if r7>=r8 - just in case */ - - mflr r4 /* save link register */ 1: lwz r0, 0(r7) stw r0, 0(r9) diff --git a/cpu/mpc824x/start.S b/cpu/mpc824x/start.S index 7f4064816fc..f3f595af25d 100644 --- a/cpu/mpc824x/start.S +++ b/cpu/mpc824x/start.S @@ -63,7 +63,7 @@ /* * Set up GOT: Global Offset Table * - * Use r14 to access the GOT + * Use r12 to access the GOT */ START_GOT GOT_ENTRY(_GOT2_TABLE_) @@ -462,6 +462,7 @@ relocate_code: mr r9, r4 /* Save copy of Global Data pointer */ mr r10, r5 /* Save copy of Destination Address */ + GET_GOT mr r3, r5 /* Destination Address */ #ifdef CONFIG_SYS_RAMBOOT lis r4, CONFIG_SYS_SDRAM_BASE@h /* Source Address */ @@ -484,7 +485,7 @@ relocate_code: sub r15, r10, r4 /* First our own GOT */ - add r14, r14, r15 + add r12, r12, r15 /* the the one used by the C code */ add r30, r30, r15 @@ -564,7 +565,7 @@ relocate_code: in_ram: /* - * Relocation Function, r14 point to got2+0x8000 + * Relocation Function, r12 point to got2+0x8000 * * Adjust got2 pointers, no need to check for 0, this code * already puts a few entries in the table. @@ -629,6 +630,8 @@ clear_bss: */ .globl trap_init trap_init: + mflr r4 /* save link register */ + GET_GOT lwz r7, GOT(_start) lwz r8, GOT(_end_of_vectors) @@ -636,8 +639,6 @@ trap_init: cmplw 0, r7, r8 bgelr /* return if r7>=r8 - just in case */ - - mflr r4 /* save link register */ 1: lwz r0, 0(r7) stw r0, 0(r9) diff --git a/cpu/mpc8260/start.S b/cpu/mpc8260/start.S index 7d80af5acd3..1fc70bc5e46 100644 --- a/cpu/mpc8260/start.S +++ b/cpu/mpc8260/start.S @@ -56,7 +56,7 @@ /* * Set up GOT: Global Offset Table * - * Use r14 to access the GOT + * Use r12 to access the GOT */ START_GOT GOT_ENTRY(_GOT2_TABLE_) @@ -650,7 +650,9 @@ init_debug: /* RAM should now be operational */ #define VEC_WRD_CNT ((_end_of_vectors - _start + EXC_OFF_SYS_RESET) / 4) - + mflr r3 + GET_GOT + mtlr r3 lwz r3, GOT(_end_of_vectors) rlwinm r4, r3, 0, 18, 31 /* _end_of_vectors & 0x3FFF */ lis r5, VEC_WRD_CNT@h @@ -792,6 +794,7 @@ relocate_code: mr r9, r4 /* Save copy of Global Data pointer */ mr r10, r5 /* Save copy of Destination Address */ + GET_GOT mr r3, r5 /* Destination Address */ lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */ ori r4, r4, CONFIG_SYS_MONITOR_BASE@l @@ -809,7 +812,7 @@ relocate_code: sub r15, r10, r4 /* First our own GOT */ - add r14, r14, r15 + add r12, r12, r15 /* then the one used by the C code */ add r30, r30, r15 @@ -882,7 +885,7 @@ relocate_code: in_ram: /* - * Relocation Function, r14 point to got2+0x8000 + * Relocation Function, r12 point to got2+0x8000 * * Adjust got2 pointers, no need to check for 0, this code * already puts a few entries in the table. @@ -958,6 +961,8 @@ clear_bss: */ .globl trap_init trap_init: + mflr r4 /* save link register */ + GET_GOT lwz r7, GOT(_start) lwz r8, GOT(_end_of_vectors) @@ -965,8 +970,6 @@ trap_init: cmplw 0, r7, r8 bgelr /* return if r7>=r8 - just in case */ - - mflr r4 /* save link register */ 1: lwz r0, 0(r7) stw r0, 0(r9) diff --git a/cpu/mpc83xx/start.S b/cpu/mpc83xx/start.S index 5a50b090583..68bb6209c3d 100644 --- a/cpu/mpc83xx/start.S +++ b/cpu/mpc83xx/start.S @@ -65,7 +65,7 @@ /* * Set up GOT: Global Offset Table * - * Use r14 to access the GOT + * Use r12 to access the GOT */ START_GOT GOT_ENTRY(_GOT2_TABLE_) @@ -830,6 +830,7 @@ relocate_code: mr r9, r4 /* Save copy of Global Data pointer */ mr r10, r5 /* Save copy of Destination Address */ + GET_GOT mr r3, r5 /* Destination Address */ lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */ ori r4, r4, CONFIG_SYS_MONITOR_BASE@l @@ -848,7 +849,7 @@ relocate_code: sub r15, r10, r4 /* First our own GOT */ - add r14, r14, r15 + add r12, r12, r15 /* then the one used by the C code */ add r30, r30, r15 @@ -930,7 +931,7 @@ relocate_code: in_ram: /* - * Relocation Function, r14 point to got2+0x8000 + * Relocation Function, r12 point to got2+0x8000 * * Adjust got2 pointers, no need to check for 0, this code * already puts a few entries in the table. @@ -1010,6 +1011,8 @@ clear_bss: */ .globl trap_init trap_init: + mflr r4 /* save link register */ + GET_GOT lwz r7, GOT(_start) lwz r8, GOT(_end_of_vectors) @@ -1017,8 +1020,6 @@ trap_init: cmplw 0, r7, r8 bgelr /* return if r7>=r8 - just in case */ - - mflr r4 /* save link register */ 1: lwz r0, 0(r7) stw r0, 0(r9) diff --git a/cpu/mpc85xx/start.S b/cpu/mpc85xx/start.S index d73c5c2315e..386fa81990f 100644 --- a/cpu/mpc85xx/start.S +++ b/cpu/mpc85xx/start.S @@ -51,7 +51,7 @@ /* * Set up GOT: Global Offset Table * - * Use r14 to access the GOT + * Use r12 to access the GOT */ START_GOT GOT_ENTRY(_GOT2_TABLE_) @@ -871,6 +871,7 @@ relocate_code: mr r9,r4 /* Save copy of Init Data pointer */ mr r10,r5 /* Save copy of Destination Address */ + GET_GOT mr r3,r5 /* Destination Address */ lis r4,CONFIG_SYS_MONITOR_BASE@h /* Source Address */ ori r4,r4,CONFIG_SYS_MONITOR_BASE@l @@ -888,7 +889,7 @@ relocate_code: sub r15,r10,r4 /* First our own GOT */ - add r14,r14,r15 + add r12,r12,r15 /* the the one used by the C code */ add r30,r30,r15 @@ -958,7 +959,7 @@ relocate_code: in_ram: /* - * Relocation Function, r14 point to got2+0x8000 + * Relocation Function, r12 point to got2+0x8000 * * Adjust got2 pointers, no need to check for 0, this code * already puts a few entries in the table. @@ -1024,6 +1025,8 @@ clear_bss: */ .globl trap_init trap_init: + mflr r4 /* save link register */ + GET_GOT lwz r7,GOT(_start_of_vectors) lwz r8,GOT(_end_of_vectors) @@ -1031,8 +1034,6 @@ trap_init: cmplw 0,r7,r8 bgelr /* return if r7>=r8 - just in case */ - - mflr r4 /* save link register */ 1: lwz r0,0(r7) stw r0,0(r9) diff --git a/cpu/mpc86xx/start.S b/cpu/mpc86xx/start.S index eaa2657d387..ed1e4ca6681 100644 --- a/cpu/mpc86xx/start.S +++ b/cpu/mpc86xx/start.S @@ -52,7 +52,7 @@ /* * Set up GOT: Global Offset Table * - * Use r14 to access the GOT + * Use r12 to access the GOT */ START_GOT GOT_ENTRY(_GOT2_TABLE_) @@ -630,6 +630,7 @@ relocate_code: mr r9, r4 /* Save copy of Global Data pointer */ mr r10, r5 /* Save copy of Destination Address */ + GET_GOT mr r3, r5 /* Destination Address */ lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */ ori r4, r4, CONFIG_SYS_MONITOR_BASE@l @@ -647,7 +648,7 @@ relocate_code: sub r15, r10, r4 /* First our own GOT */ - add r14, r14, r15 + add r12, r12, r15 /* then the one used by the C code */ add r30, r30, r15 @@ -708,7 +709,7 @@ relocate_code: in_ram: /* - * Relocation Function, r14 point to got2+0x8000 + * Relocation Function, r12 point to got2+0x8000 * * Adjust got2 pointers, no need to check for 0, this code * already puts a few entries in the table. @@ -775,6 +776,8 @@ in_ram: */ .globl trap_init trap_init: + mflr r4 /* save link register */ + GET_GOT lwz r7, GOT(_start) lwz r8, GOT(_end_of_vectors) @@ -782,8 +785,6 @@ trap_init: cmplw 0, r7, r8 bgelr /* return if r7>=r8 - just in case */ - - mflr r4 /* save link register */ 1: lwz r0, 0(r7) stw r0, 0(r9) diff --git a/cpu/mpc8xx/start.S b/cpu/mpc8xx/start.S index 24e9053f0ed..7cf602fd4b8 100644 --- a/cpu/mpc8xx/start.S +++ b/cpu/mpc8xx/start.S @@ -63,7 +63,7 @@ /* * Set up GOT: Global Offset Table * - * Use r14 to access the GOT + * Use r12 to access the GOT */ START_GOT GOT_ENTRY(_GOT2_TABLE_) @@ -482,6 +482,7 @@ relocate_code: mr r9, r4 /* Save copy of Global Data pointer */ mr r10, r5 /* Save copy of Destination Address */ + GET_GOT mr r3, r5 /* Destination Address */ lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */ ori r4, r4, CONFIG_SYS_MONITOR_BASE@l @@ -499,7 +500,7 @@ relocate_code: sub r15, r10, r4 /* First our own GOT */ - add r14, r14, r15 + add r12, r12, r15 /* then the one used by the C code */ add r30, r30, r15 @@ -564,7 +565,7 @@ relocate_code: in_ram: /* - * Relocation Function, r14 point to got2+0x8000 + * Relocation Function, r12 point to got2+0x8000 * * Adjust got2 pointers, no need to check for 0, this code * already puts a few entries in the table. @@ -629,6 +630,8 @@ clear_bss: */ .globl trap_init trap_init: + mflr r4 /* save link register */ + GET_GOT lwz r7, GOT(_start) lwz r8, GOT(_end_of_vectors) @@ -636,8 +639,6 @@ trap_init: cmplw 0, r7, r8 bgelr /* return if r7>=r8 - just in case */ - - mflr r4 /* save link register */ 1: lwz r0, 0(r7) stw r0, 0(r9) diff --git a/cpu/ppc4xx/start.S b/cpu/ppc4xx/start.S index 2eb21fab42c..927c88c78f2 100644 --- a/cpu/ppc4xx/start.S +++ b/cpu/ppc4xx/start.S @@ -228,7 +228,7 @@ /* * Set up GOT: Global Offset Table * - * Use r14 to access the GOT + * Use r12 to access the GOT */ #if !defined(CONFIG_NAND_SPL) START_GOT @@ -1489,6 +1489,7 @@ relocate_code: mr r9, r4 /* Save copy of Init Data pointer */ mr r10, r5 /* Save copy of Destination Address */ + GET_GOT mr r3, r5 /* Destination Address */ lis r4, CONFIG_SYS_MONITOR_BASE@h /* Source Address */ ori r4, r4, CONFIG_SYS_MONITOR_BASE@l @@ -1506,7 +1507,7 @@ relocate_code: sub r15, r10, r4 /* First our own GOT */ - add r14, r14, r15 + add r12, r12, r15 /* then the one used by the C code */ add r30, r30, r15 @@ -1571,7 +1572,7 @@ relocate_code: in_ram: /* - * Relocation Function, r14 point to got2+0x8000 + * Relocation Function, r12 point to got2+0x8000 * * Adjust got2 pointers, no need to check for 0, this code * already puts a few entries in the table. @@ -1645,6 +1646,8 @@ clear_bss: */ .globl trap_init trap_init: + mflr r4 /* save link register */ + GET_GOT lwz r7, GOT(_start_of_vectors) lwz r8, GOT(_end_of_vectors) @@ -1652,8 +1655,6 @@ trap_init: cmplw 0, r7, r8 bgelr /* return if r7>=r8 - just in case */ - - mflr r4 /* save link register */ 1: lwz r0, 0(r7) stw r0, 0(r9) diff --git a/include/ppc_asm.tmpl b/include/ppc_asm.tmpl index fa5c5f66c1c..84de146e5dd 100644 --- a/include/ppc_asm.tmpl +++ b/include/ppc_asm.tmpl @@ -50,13 +50,13 @@ .text 2 ; \ 0: .long .LCTOC1-1f ; \ .text ; \ -1: mflr r14 ; \ - lwz r0,0b-1b(r14) ; \ - add r14,r0,r14 ; +1: mflr r12 ; \ + lwz r0,0b-1b(r12) ; \ + add r12,r0,r12 ; #define GOT_ENTRY(NAME) .L_ ## NAME = . - .LCTOC1 ; .long NAME -#define GOT(NAME) .L_ ## NAME (r14) +#define GOT(NAME) .L_ ## NAME (r12) /*************************************************************************** |