Commit cc7efbf9 authored by Anton Blanchard's avatar Anton Blanchard

powerpc: ABIv2 function calls must place target address in r12

To establish addressability quickly, ABIv2 requires the target
address of the function being called to be in r12. Fix a number of
places in assembly code that we do indirect function calls.

We need to avoid function descriptors on ABIv2 too.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
parent 7167af7c
...@@ -174,8 +174,8 @@ system_call: /* label this so stack traces look sane */ ...@@ -174,8 +174,8 @@ system_call: /* label this so stack traces look sane */
clrldi r8,r8,32 clrldi r8,r8,32
15: 15:
slwi r0,r0,4 slwi r0,r0,4
ldx r10,r11,r0 /* Fetch system call handler [ptr] */ ldx r12,r11,r0 /* Fetch system call handler [ptr] */
mtctr r10 mtctr r12
bctrl /* Call handler */ bctrl /* Call handler */
syscall_exit: syscall_exit:
......
...@@ -140,16 +140,18 @@ __secondary_hold: ...@@ -140,16 +140,18 @@ __secondary_hold:
tovirt(r26,r26) tovirt(r26,r26)
#endif #endif
/* All secondary cpus wait here until told to start. */ /* All secondary cpus wait here until told to start. */
100: ld r4,__secondary_hold_spinloop-_stext(r26) 100: ld r12,__secondary_hold_spinloop-_stext(r26)
cmpdi 0,r4,0 cmpdi 0,r12,0
beq 100b beq 100b
#if defined(CONFIG_SMP) || defined(CONFIG_KEXEC) #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
#ifdef CONFIG_PPC_BOOK3E #ifdef CONFIG_PPC_BOOK3E
tovirt(r4,r4) tovirt(r12,r12)
#endif #endif
ld r4,0(r4) /* deref function descriptor */ #if !defined(_CALL_ELF) || _CALL_ELF != 2
mtctr r4 ld r12,0(r12) /* deref function descriptor */
#endif
mtctr r12
mr r3,r24 mr r3,r24
/* /*
* it may be the case that other platforms have r4 right to * it may be the case that other platforms have r4 right to
...@@ -267,8 +269,8 @@ generic_secondary_common_init: ...@@ -267,8 +269,8 @@ generic_secondary_common_init:
ld r23,CPU_SPEC_RESTORE(r23) ld r23,CPU_SPEC_RESTORE(r23)
cmpdi 0,r23,0 cmpdi 0,r23,0
beq 3f beq 3f
ld r23,0(r23) ld r12,0(r23)
mtctr r23 mtctr r12
bctrl bctrl
3: LOAD_REG_ADDR(r3, spinning_secondaries) /* Decrement spinning_secondaries */ 3: LOAD_REG_ADDR(r3, spinning_secondaries) /* Decrement spinning_secondaries */
...@@ -468,8 +470,8 @@ __after_prom_start: ...@@ -468,8 +470,8 @@ __after_prom_start:
/* this includes the code being */ /* this includes the code being */
/* executed here. */ /* executed here. */
addis r8,r3,(4f - _stext)@ha /* Jump to the copy of this code */ addis r8,r3,(4f - _stext)@ha /* Jump to the copy of this code */
addi r8,r8,(4f - _stext)@l /* that we just made */ addi r12,r8,(4f - _stext)@l /* that we just made */
mtctr r8 mtctr r12
bctr bctr
.balign 8 .balign 8
......
...@@ -595,8 +595,12 @@ _GLOBAL(kexec_sequence) ...@@ -595,8 +595,12 @@ _GLOBAL(kexec_sequence)
stw r6,kexec_flag-1b(5) stw r6,kexec_flag-1b(5)
/* clear out hardware hash page table and tlb */ /* clear out hardware hash page table and tlb */
ld r5,0(r27) /* deref function descriptor */ #if !defined(_CALL_ELF) || _CALL_ELF != 2
mtctr r5 ld r12,0(r27) /* deref function descriptor */
#else
mr r12,r27
#endif
mtctr r12
bctrl /* ppc_md.hpte_clear_all(void); */ bctrl /* ppc_md.hpte_clear_all(void); */
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment