Skip to contentSkip to conversation

linux-user: Add signal handling for AArch64

PATCH Superseded John Rigby 2 participants 2 messages Apr 30, 2013 – May 3, 2013

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

John Rigby

author
#0 lore raw

PATCH v2 9/12 linux-user: Add signal handling for AArch64

From: Andreas Schwab <[email protected]>

This patch adds signal handling for AArch64. The code is based on the respective source in the Linux kernel.

---
 linux-user/arm/target_signal.h |    4 +
 linux-user/signal.c            |  263 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 267 insertions(+)
linux-user/arm/target_signal.h +4 -0
index 2b32813..afc8698 100644
@@ -23,7 +23,11 @@ typedef struct target_sigaltstack {
 
 static inline abi_ulong get_sp_from_cpustate(CPUARMState *state)
 {
+#ifdef TARGET_AARCH64
+   return state->sp;
+#else
    return state->regs[13];
+#endif
 }
 
 #endif /* TARGET_SIGNAL_H */
linux-user/signal.c +263 -0

269 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

linux-user/signal.c badframe: · line 1165

Quoted 2 lines · John Rigby
linux-user/signal.c +2 -0
+    /* set up the stack frame for unwinding */
+    err |= __put_user(env->xregs[29], &sf->fp);

__put_user can't fail so all this collection of error status is unnecessary. (Every address we write with it has to be covered by the lock_user_struct() call which is where we'll find out if it wasn't writable memory. Existing code in signal.c that checks __put_user and __get_user return values is generally cut-n-paste from the Linux kernel, which does do access rights testing on each individual load/store.)

Quoted 11 lines
linux-user/signal.c +8 -0
+    err |= __put_user(env->xregs[30], &sf->lr);
+
+    for (i = 0; i < 31; i++) {
+        err |= __put_user(env->xregs[i], &sf->uc.tuc_mcontext.regs[i]);
+    }
+    err |= __put_user(env->sp, &sf->uc.tuc_mcontext.sp);
+    err |= __put_user(env->pc, &sf->uc.tuc_mcontext.pc);
+    err |= __put_user(env->pstate, &sf->uc.tuc_mcontext.pstate);
 
 
 

linux-user/signal.c badframe: · line 1234

Quoted 10 lines
linux-user/signal.c +9 -0
 
+
+    for (i = 0; i < 32 * 2; i++) {
+       err |= __get_user(env->vfp.regs[i], &aux->fpsimd.vregs[i]);
+    }
+
+#if 0
+    err |= __get_user(env->fpsr, &aux->fpsimd.fpsr);
+    err |= __get_user(env->fpcr, &aux->fpsimd.fpcr);
+#endif

No #if-0 code, please.

thanks
-- PMM