From: Timothy E Baldwin <t.e.baldwi...@members.leeds.ac.uk>

Update the MIPS 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.baldwi...@members.leeds.ac.uk>
Message-id: 1441497448-32489-7-git-send-email-t.e.baldwi...@members.leeds.ac.uk
Reviewed-by: Peter Maydell <peter.mayd...@linaro.org>
[PMM: tweak commit message; drop TARGET_USE_ERESTARTSYS define]
Signed-off-by: Peter Maydell <peter.mayd...@linaro.org>
Signed-off-by: Riku Voipio <riku.voi...@linaro.org>
---
 linux-user/main.c                 | 4 ++++
 linux-user/mips/target_signal.h   | 1 +
 linux-user/mips64/target_signal.h | 1 +
 3 files changed, 6 insertions(+)

diff --git a/linux-user/main.c b/linux-user/main.c
index 7916efc..73e3668 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2528,6 +2528,10 @@ done_syscall:
                              env->active_tc.gpr[8], env->active_tc.gpr[9],
                              env->active_tc.gpr[10], env->active_tc.gpr[11]);
 # endif /* O32 */
+            if (ret == -TARGET_ERESTARTSYS) {
+                env->active_tc.PC -= 4;
+                break;
+            }
             if (ret == -TARGET_QEMU_ESIGRETURN) {
                 /* Returning from a successful sigreturn syscall.
                    Avoid clobbering register state.  */
diff --git a/linux-user/mips/target_signal.h b/linux-user/mips/target_signal.h
index 6e1dc8b..460cc9f 100644
--- a/linux-user/mips/target_signal.h
+++ b/linux-user/mips/target_signal.h
@@ -26,4 +26,5 @@ static inline abi_ulong get_sp_from_cpustate(CPUMIPSState 
*state)
     return state->active_tc.gpr[29];
 }
 
+
 #endif /* TARGET_SIGNAL_H */
diff --git a/linux-user/mips64/target_signal.h 
b/linux-user/mips64/target_signal.h
index 5fb6a2c..a2dc514 100644
--- a/linux-user/mips64/target_signal.h
+++ b/linux-user/mips64/target_signal.h
@@ -26,4 +26,5 @@ static inline abi_ulong get_sp_from_cpustate(CPUMIPSState 
*state)
     return state->active_tc.gpr[29];
 }
 
+
 #endif /* TARGET_SIGNAL_H */
-- 
2.1.4


Reply via email to