Skip to content

Commit

Permalink
powerpc/32: Perform normal function call in exception entry
Browse files Browse the repository at this point in the history
Now that the MMU is re-enabled before calling the transfer function,
we don't need anymore that hack with the address of the handler and
the return function sitting just after the 'bl' to the transfer
fonction, that function is retrieving via a read relative to 'lr'.

Do a regular call to the transfer function, then to the handler,
then branch to the return function.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/73c00f3361ca280ef8fd7814c291bd1f5b6e2081.1615552867.git.christophe.leroy@csgroup.eu
  • Loading branch information
Christophe Leroy authored and Michael Ellerman committed Mar 29, 2021
1 parent 32d2ca0 commit 0f2793e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
14 changes: 4 additions & 10 deletions arch/powerpc/kernel/entry_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ transfer_to_handler:
#ifdef CONFIG_PPC_BOOK3S_32
kuep_lock r11, r12
#endif
b 3f
blr

/* if from kernel, check interrupted DOZE/NAP mode */
2:
Expand All @@ -118,13 +118,7 @@ transfer_to_handler:
#endif /* CONFIG_PPC_BOOK3S_32 || CONFIG_E500 */
.globl transfer_to_handler_cont
transfer_to_handler_cont:
3:
mflr r9
lwz r11,0(r9) /* virtual address of handler */
lwz r9,4(r9) /* where to go when done */
mtctr r11
mtlr r9
bctr /* jump to handler */
blr

#if defined (CONFIG_PPC_BOOK3S_32) || defined(CONFIG_E500)
4: rlwinm r12,r12,0,~_TLF_NAPPING
Expand Down Expand Up @@ -404,8 +398,8 @@ fee_restarts:
stw r10,_TRAP(r11)
addi r3,r1,STACK_FRAME_OVERHEAD
bl transfer_to_handler_full
.long unrecoverable_exception
.long ret_from_except
bl unrecoverable_exception
b ret_from_except
#endif

.globl ret_from_except_full
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/kernel/head_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ _ASM_NOKPROBE_SYMBOL(\name\()_virt)
li r10,trap; \
stw r10,_TRAP(r11); \
bl tfer; \
.long hdlr; \
.long ret
bl hdlr; \
b ret

#define EXC_XFER_STD(n, hdlr) \
EXC_XFER_TEMPLATE(hdlr, n, MSR_KERNEL, transfer_to_handler_full, \
Expand Down
6 changes: 3 additions & 3 deletions arch/powerpc/kernel/head_booke.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,9 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
#define EXC_XFER_TEMPLATE(hdlr, trap, msr, tfer, ret) \
li r10,trap; \
stw r10,_TRAP(r11); \
bl tfer; \
.long hdlr; \
.long ret
bl tfer; \
bl hdlr; \
b ret; \

#define EXC_XFER_STD(n, hdlr) \
EXC_XFER_TEMPLATE(hdlr, n, MSR_KERNEL, transfer_to_handler_full, \
Expand Down

0 comments on commit 0f2793e

Please sign in to comment.