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>
master
Joakim Tjernlund 15 years ago committed by Wolfgang Denk
parent fc4e188789
commit 0f8aa15917
  1. 11
      cpu/74xx_7xx/start.S
  2. 11
      cpu/mpc512x/start.S
  3. 11
      cpu/mpc5xx/start.S
  4. 11
      cpu/mpc5xxx/start.S
  5. 11
      cpu/mpc8220/start.S
  6. 11
      cpu/mpc824x/start.S
  7. 15
      cpu/mpc8260/start.S
  8. 11
      cpu/mpc83xx/start.S
  9. 11
      cpu/mpc85xx/start.S
  10. 11
      cpu/mpc86xx/start.S
  11. 11
      cpu/mpc8xx/start.S
  12. 11
      cpu/ppc4xx/start.S
  13. 8
      include/ppc_asm.tmpl

@ -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)

@ -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)

@ -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)

@ -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)

@ -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)

@ -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)

@ -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)

@ -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)

@ -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)

@ -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)

@ -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)

@ -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)

@ -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)
/***************************************************************************

Loading…
Cancel
Save