Skip to contentSkip to conversation

ppc: Fix signal delivery in ppc-user and ppc64-user

PATCH Superseded Benjamin Herrenschmidt 1 participant 1 message Aug 3, 2016

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ppc: Fix signal delivery in ppc-user and ppc64-user

There were a number of bugs in the implementation:

- The structure alignment was wrong for 64-bit.

- Also 64-bit only does RT signals.

- On 64-bit, we need to put a pointer to the (aligned) vector registers in the frame and use it for restoring

- We had endian bugs when saving/restoring vector registers

- My recent fixes for exception NIP broke sigreturn in user mode causing us to resume one instruction too far.

This is still missing support for VSX which I will add separately.

---

v2. Fix endian bugs too
Fix bad PC on sigreturn

 linux-user/main.c           |   2 +-
 linux-user/ppc/syscall_nr.h |   2 +
 linux-user/signal.c         | 102 ++++++++++++++++++++++++++++----------------
 3 files changed, 68 insertions(+), 38 deletions(-)
linux-user/main.c +1 -1
index 1d149dc..24f34e6 100644
@@ -2003,12 +2003,12 @@ void cpu_loop(CPUPPCState *env)
             if (ret == -TARGET_ERESTARTSYS) {
                 break;
             }
-            env->nip += 4;
             if (ret == (target_ulong)(-TARGET_QEMU_ESIGRETURN)) {
                 /* Returning from a successful sigreturn syscall.
                    Avoid corrupting register state.  */
                 break;
             }
+            env->nip += 4;
             if (ret > (target_ulong)(-515)) {
                 env->crf[0] |= 0x1;
                 ret = -ret;
linux-user/ppc/syscall_nr.h +2 -0
index 46ed8a6..afa3654 100644
@@ -120,7 +120,9 @@
 #define TARGET_NR_sysinfo                116
 #define TARGET_NR_ipc                    117
 #define TARGET_NR_fsync                  118
+#if !defined(TARGET_PPC64)
 #define TARGET_NR_sigreturn              119
+#endif
 #define TARGET_NR_clone                  120
 #define TARGET_NR_setdomainname          121
 #define TARGET_NR_uname                  122
linux-user/signal.c +65 -37

201 lines not on this page · raw message