Skip to content

Commit

Permalink
powerpc: Remove superflous function descriptors in assembly only code
Browse files Browse the repository at this point in the history
We have a number of places where we load the text address of a local
function and indirectly branch to it in assembly. Since it is an
indirect branch binutils will not know to use the function text
address, so that trick wont work.

There is no need for these functions to have a function descriptor
so we can replace it with a label and remove the dot symbol.

Signed-off-by: Anton Blanchard <anton@samba.org>
  • Loading branch information
Anton Blanchard committed Apr 23, 2014
1 parent b1576fe commit ad0289e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
10 changes: 5 additions & 5 deletions arch/powerpc/kernel/entry_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ _GLOBAL(enter_rtas)
std r6,PACASAVEDMSR(r13)

/* Setup our real return addr */
LOAD_REG_ADDR(r4,.rtas_return_loc)
LOAD_REG_ADDR(r4,rtas_return_loc)
clrldi r4,r4,2 /* convert to realmode address */
mtlr r4

Expand All @@ -1045,7 +1045,7 @@ _GLOBAL(enter_rtas)
rfid
b . /* prevent speculative execution */

_STATIC(rtas_return_loc)
rtas_return_loc:
FIXUP_ENDIAN

/* relocation is off at this point */
Expand All @@ -1054,7 +1054,7 @@ _STATIC(rtas_return_loc)

bcl 20,31,$+4
0: mflr r3
ld r3,(1f-0b)(r3) /* get &.rtas_restore_regs */
ld r3,(1f-0b)(r3) /* get &rtas_restore_regs */

mfmsr r6
li r0,MSR_RI
Expand All @@ -1071,9 +1071,9 @@ _STATIC(rtas_return_loc)
b . /* prevent speculative execution */

.align 3
1: .llong .rtas_restore_regs
1: .llong rtas_restore_regs

_STATIC(rtas_restore_regs)
rtas_restore_regs:
/* relocation is on at this point */
REST_GPR(2, r1) /* Restore the TOC */
REST_GPR(13, r1) /* Restore paca */
Expand Down
18 changes: 9 additions & 9 deletions arch/powerpc/kernel/exceptions-64s.S
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,13 @@ data_access_slb_pSeries:
b slb_miss_realmode
#else
/*
* We can't just use a direct branch to .slb_miss_realmode
* We can't just use a direct branch to slb_miss_realmode
* because the distance from here to there depends on where
* the kernel ends up being put.
*/
mfctr r11
ld r10,PACAKBASE(r13)
LOAD_HANDLER(r10, .slb_miss_realmode)
LOAD_HANDLER(r10, slb_miss_realmode)
mtctr r10
bctr
#endif
Expand All @@ -247,7 +247,7 @@ instruction_access_slb_pSeries:
#else
mfctr r11
ld r10,PACAKBASE(r13)
LOAD_HANDLER(r10, .slb_miss_realmode)
LOAD_HANDLER(r10, slb_miss_realmode)
mtctr r10
bctr
#endif
Expand Down Expand Up @@ -524,7 +524,7 @@ do_stab_bolted_pSeries:
std r12,PACA_EXSLB+EX_R12(r13)
GET_SCRATCH0(r10)
std r10,PACA_EXSLB+EX_R13(r13)
EXCEPTION_PROLOG_PSERIES_1(.do_stab_bolted, EXC_STD)
EXCEPTION_PROLOG_PSERIES_1(do_stab_bolted, EXC_STD)

KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x300)
KVM_HANDLER_SKIP(PACA_EXSLB, EXC_STD, 0x380)
Expand Down Expand Up @@ -832,13 +832,13 @@ data_access_slb_relon_pSeries:
b slb_miss_realmode
#else
/*
* We can't just use a direct branch to .slb_miss_realmode
* We can't just use a direct branch to slb_miss_realmode
* because the distance from here to there depends on where
* the kernel ends up being put.
*/
mfctr r11
ld r10,PACAKBASE(r13)
LOAD_HANDLER(r10, .slb_miss_realmode)
LOAD_HANDLER(r10, slb_miss_realmode)
mtctr r10
bctr
#endif
Expand All @@ -858,7 +858,7 @@ instruction_access_slb_relon_pSeries:
#else
mfctr r11
ld r10,PACAKBASE(r13)
LOAD_HANDLER(r10, .slb_miss_realmode)
LOAD_HANDLER(r10, slb_miss_realmode)
mtctr r10
bctr
#endif
Expand Down Expand Up @@ -1468,7 +1468,7 @@ machine_check_handle_early:
* r3 is saved in paca->slb_r3
* We assume we aren't going to take any exceptions during this procedure.
*/
_GLOBAL(slb_miss_realmode)
slb_miss_realmode:
mflr r10
#ifdef CONFIG_RELOCATABLE
mtctr r11
Expand Down Expand Up @@ -1646,7 +1646,7 @@ do_ste_alloc:
* We assume (DAR >> 60) == 0xc.
*/
.align 7
_GLOBAL(do_stab_bolted)
do_stab_bolted:
stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */
std r11,PACA_EXSLB+EX_SRR0(r13) /* save SRR0 in exc. frame */
mfspr r11,SPRN_DAR /* ea */
Expand Down
9 changes: 5 additions & 4 deletions arch/powerpc/kernel/head_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ __secondary_start:
stb r0,PACAIRQHAPPENED(r13)

/* enable MMU and jump to start_secondary */
LOAD_REG_ADDR(r3, .start_secondary_prolog)
LOAD_REG_ADDR(r3, start_secondary_prolog)
LOAD_REG_IMMEDIATE(r4, MSR_KERNEL)

mtspr SPRN_SRR0,r3
Expand All @@ -652,7 +652,7 @@ __secondary_start:
* zero the stack back-chain pointer and get the TOC virtual address
* before going into C code.
*/
_GLOBAL(start_secondary_prolog)
start_secondary_prolog:
ld r2,PACATOC(r13)
li r3,0
std r3,0(r1) /* Zero the stack frame pointer */
Expand Down Expand Up @@ -778,15 +778,16 @@ _INIT_STATIC(start_here_multiplatform)
mr r3,r31
bl early_setup /* also sets r13 and SPRG_PACA */

LOAD_REG_ADDR(r3, .start_here_common)
LOAD_REG_ADDR(r3, start_here_common)
ld r4,PACAKMSR(r13)
mtspr SPRN_SRR0,r3
mtspr SPRN_SRR1,r4
RFI
b . /* prevent speculative execution */

/* This is where all platforms converge execution */
_INIT_GLOBAL(start_here_common)

start_here_common:
/* relocation is on at this point */
std r1,PACAKSAVE(r13)

Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/powernv/opal-wrappers.S
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
std r12,PACASAVEDMSR(r13); \
andc r12,r12,r0; \
mtmsrd r12,1; \
LOAD_REG_ADDR(r0,.opal_return); \
LOAD_REG_ADDR(r0,opal_return); \
mtlr r0; \
li r0,MSR_DR|MSR_IR|MSR_LE;\
andc r12,r12,r0; \
Expand All @@ -44,7 +44,7 @@
mtspr SPRN_HSRR0,r12; \
hrfid

_STATIC(opal_return)
opal_return:
/*
* Fixup endian on OPAL return... we should be able to simplify
* this by instead converting the below trampoline to a set of
Expand Down

0 comments on commit ad0289e

Please sign in to comment.