diff mbox

[PULL,v2,09/38] linux-user: Support for restarting system calls for PPC targets

Message ID 6db9d00e2f05db0dfcc1a4d8b811fdd40170c91c.1464353863.git.riku.voipio@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Riku Voipio May 27, 2016, 1 p.m. UTC
From: Timothy E Baldwin <T.E.Baldwin99@members.leeds.ac.uk>

Update the PPC main loop code:
 * on TARGET_ERESTARTSYS, wind guest PC backwards to repeat syscall insn

(We already handle TARGET_QEMU_ESIGRETURN.)

Signed-off-by: Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
Message-id: 1441497448-32489-8-git-send-email-T.E.Baldwin99@members.leeds.ac.uk
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
[PMM: tweak commit message; drop TARGET_USE_ERESTARTSYS define]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
 linux-user/main.c              | 4 ++++
 linux-user/ppc/target_signal.h | 1 +
 2 files changed, 5 insertions(+)
diff mbox

Patch

diff --git a/linux-user/main.c b/linux-user/main.c
index 73e3668..dfc098f 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -1987,6 +1987,10 @@  void cpu_loop(CPUPPCState *env)
             ret = do_syscall(env, env->gpr[0], env->gpr[3], env->gpr[4],
                              env->gpr[5], env->gpr[6], env->gpr[7],
                              env->gpr[8], 0, 0);
+            if (ret == -TARGET_ERESTARTSYS) {
+                env->nip -= 4;
+                break;
+            }
             if (ret == (target_ulong)(-TARGET_QEMU_ESIGRETURN)) {
                 /* Returning from a successful sigreturn syscall.
                    Avoid corrupting register state.  */
diff --git a/linux-user/ppc/target_signal.h b/linux-user/ppc/target_signal.h
index a93b5cf..4f01dd4 100644
--- a/linux-user/ppc/target_signal.h
+++ b/linux-user/ppc/target_signal.h
@@ -26,4 +26,5 @@  static inline abi_ulong get_sp_from_cpustate(CPUPPCState *state)
     return state->gpr[1];
 }
 
+
 #endif /* TARGET_SIGNAL_H */