[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 04/52] linux-user: Split PPC Trampoline Encoding from R
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PULL 04/52] linux-user: Split PPC Trampoline Encoding from Register Save |
Date: |
Thu, 4 Sep 2014 19:19:52 +0200 |
From: Tom Musta <address@hidden>
Split the encoding of the PowerPC sigreturn trampoline from the saving of
register state onto the signal handler stack. This will make it easier
in subsequent patches to deal with variations in the stack frame layouts between
32 and 64 bit PowerPC.
Signed-off-by: Tom Musta <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
linux-user/signal.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 2952956..7365d5d 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -4491,8 +4491,7 @@ static target_ulong get_sigframe(struct target_sigaction
*ka,
return newsp;
}
-static void save_user_regs(CPUPPCState *env, struct target_mcontext *frame,
- int sigret)
+static void save_user_regs(CPUPPCState *env, struct target_mcontext *frame)
{
target_ulong msr = env->msr;
int i;
@@ -4559,11 +4558,14 @@ static void save_user_regs(CPUPPCState *env, struct
target_mcontext *frame,
/* Store MSR. */
__put_user(msr, &frame->mc_gregs[TARGET_PT_MSR]);
+}
+static void encode_trampoline(int sigret, uint32_t *tramp)
+{
/* Set up the sigreturn trampoline: li r0,sigret; sc. */
if (sigret) {
- __put_user(0x38000000UL | sigret, &frame->tramp[0]);
- __put_user(0x44000002UL, &frame->tramp[1]);
+ __put_user(0x38000000 | sigret, &tramp[0]);
+ __put_user(0x44000002, &tramp[1]);
}
}
@@ -4674,7 +4676,10 @@ static void setup_frame(int sig, struct target_sigaction
*ka,
__put_user(sig, &sc->signal);
/* Save user regs. */
- save_user_regs(env, &frame->mctx, TARGET_NR_sigreturn);
+ save_user_regs(env, &frame->mctx);
+
+ /* Construct the trampoline code on the stack. */
+ encode_trampoline(TARGET_NR_sigreturn, (uint32_t *)&frame->mctx.tramp);
/* The kernel checks for the presence of a VDSO here. We don't
emulate a vdso, so use a sigreturn system call. */
@@ -4740,7 +4745,8 @@ static void setup_rt_frame(int sig, struct
target_sigaction *ka,
}
frame = &rt_sf->uc.tuc_mcontext;
- save_user_regs(env, frame, TARGET_NR_rt_sigreturn);
+ save_user_regs(env, frame);
+ encode_trampoline(TARGET_NR_rt_sigreturn, (uint32_t *)&frame->tramp);
/* The kernel checks for the presence of a VDSO here. We don't
emulate a vdso, so use a sigreturn system call. */
--
1.8.1.4
- [Qemu-ppc] [PULL 00/52] ppc patch queue 2014-09-04, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 09/52] hw/ppc/spapr_hcall.c: Fix typo in function names, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 03/52] linux-user: Fix Stack Pointer Bug in PPC setup_rt_frame, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 12/52] spapr: fix possible memory leak, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 13/52] spapr: Move DT memory node rendering to a helper, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 04/52] linux-user: Split PPC Trampoline Encoding from Register Save,
Alexander Graf <=
- [Qemu-ppc] [PULL 07/52] linux-user: Implement do_setcontext for PPC64, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 15/52] spapr: Refactor spapr_populate_memory() to allow memoryless nodes, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 17/52] spapr: Add a helper for node0_size calculation, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 08/52] linux-user: Handle PPC64 ELFv2 Function Pointers, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 16/52] spapr: Split memory nodes to power-of-two blocks, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 01/52] PPC: KVM: Fix g3beige and mac99 when HV is loaded, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 18/52] spapr: Fix ibm, associativity for memory nodes, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 10/52] spapr: add uuid/host details to device tree, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 14/52] spapr: Use DT memory node rendering helper for other nodes, Alexander Graf, 2014/09/04
- [Qemu-ppc] [PULL 02/52] ppc: spapr-rtas - implement os-term rtas call, Alexander Graf, 2014/09/04