mirror of https://gitee.com/openkylin/linux.git
powerpc/signal: Use code patching instead of hardcoding
Instead of hardcoding code modifications, use code patching functions. Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
002cdfc2c7
commit
d16952a629
|
@ -257,6 +257,7 @@
|
|||
#define PPC_INST_MTSPR_DSCR_USER_MASK 0xfc1ffffe
|
||||
#define PPC_INST_MFVSRD 0x7c000066
|
||||
#define PPC_INST_MTVSRD 0x7c000166
|
||||
#define PPC_INST_SC 0x44000002
|
||||
#define PPC_INST_SLBFEE 0x7c0007a7
|
||||
#define PPC_INST_SLBIA 0x7c0003e4
|
||||
|
||||
|
|
|
@ -470,9 +470,9 @@ static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame,
|
|||
return 1;
|
||||
|
||||
if (sigret) {
|
||||
/* Set up the sigreturn trampoline: li r0,sigret; sc */
|
||||
if (__put_user(0x38000000UL + sigret, &frame->tramp[0])
|
||||
|| __put_user(0x44000002UL, &frame->tramp[1]))
|
||||
/* Set up the sigreturn trampoline: li 0,sigret; sc */
|
||||
if (__put_user(PPC_INST_ADDI + sigret, &frame->tramp[0])
|
||||
|| __put_user(PPC_INST_SC, &frame->tramp[1]))
|
||||
return 1;
|
||||
flush_icache_range((unsigned long) &frame->tramp[0],
|
||||
(unsigned long) &frame->tramp[2]);
|
||||
|
@ -619,9 +619,9 @@ static int save_tm_user_regs(struct pt_regs *regs,
|
|||
if (__put_user(msr, &frame->mc_gregs[PT_MSR]))
|
||||
return 1;
|
||||
if (sigret) {
|
||||
/* Set up the sigreturn trampoline: li r0,sigret; sc */
|
||||
if (__put_user(0x38000000UL + sigret, &frame->tramp[0])
|
||||
|| __put_user(0x44000002UL, &frame->tramp[1]))
|
||||
/* Set up the sigreturn trampoline: li 0,sigret; sc */
|
||||
if (__put_user(PPC_INST_ADDI + sigret, &frame->tramp[0])
|
||||
|| __put_user(PPC_INST_SC, &frame->tramp[1]))
|
||||
return 1;
|
||||
flush_icache_range((unsigned long) &frame->tramp[0],
|
||||
(unsigned long) &frame->tramp[2]);
|
||||
|
|
|
@ -598,11 +598,12 @@ static long setup_trampoline(unsigned int syscall, unsigned int __user *tramp)
|
|||
long err = 0;
|
||||
|
||||
/* addi r1, r1, __SIGNAL_FRAMESIZE # Pop the dummy stackframe */
|
||||
err |= __put_user(0x38210000UL | (__SIGNAL_FRAMESIZE & 0xffff), &tramp[0]);
|
||||
err |= __put_user(PPC_INST_ADDI | __PPC_RT(R1) | __PPC_RA(R1) |
|
||||
(__SIGNAL_FRAMESIZE & 0xffff), &tramp[0]);
|
||||
/* li r0, __NR_[rt_]sigreturn| */
|
||||
err |= __put_user(0x38000000UL | (syscall & 0xffff), &tramp[1]);
|
||||
err |= __put_user(PPC_INST_ADDI | (syscall & 0xffff), &tramp[1]);
|
||||
/* sc */
|
||||
err |= __put_user(0x44000002UL, &tramp[2]);
|
||||
err |= __put_user(PPC_INST_SC, &tramp[2]);
|
||||
|
||||
/* Minimal traceback info */
|
||||
for (i=TRAMP_TRACEBACK; i < TRAMP_SIZE ;i++)
|
||||
|
|
Loading…
Reference in New Issue