[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/34] linux-user: Support for restarting system cal
From: |
Timothy E Baldwin |
Subject: |
[Qemu-devel] [PATCH 10/34] linux-user: Support for restarting system calls for Microblaze targets |
Date: |
Sun, 6 Sep 2015 00:57:04 +0100 |
Signed-off-by: Timothy Edward Baldwin <address@hidden>
---
Works without signals, but my signal test case
crashes with or without my changes.
linux-user/main.c | 14 +++++++++-----
linux-user/microblaze/syscall.h | 2 ++
linux-user/signal.c | 2 +-
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index d47e33f..3eacc9c 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2911,14 +2911,14 @@ void cpu_loop(CPUMBState *env)
queue_signal(env, info.si_signo, &info);
}
break;
- case EXCP_INTERRUPT:
- /* just indicate that signals should be handled asap */
- break;
+ case EXCP_INTERRUPT:
+ /* just indicate that signals should be handled asap */
+ break;
case EXCP_BREAK:
/* Return address is 4 bytes after the call. */
env->regs[14] += 4;
env->sregs[SR_PC] = env->regs[14];
- ret = do_syscall(env,
+ ret = do_syscall(env,
env->regs[12],
env->regs[5],
env->regs[6],
@@ -2927,7 +2927,11 @@ void cpu_loop(CPUMBState *env)
env->regs[9],
env->regs[10],
0, 0);
- env->regs[3] = ret;
+ if (ret == -TARGET_ERESTARTSYS) {
+ env->sregs[SR_PC] -= 4;
+ } else if (ret != -TARGET_QEMU_ESIGRETURN) {
+ env->regs[3] = ret;
+ }
break;
case EXCP_HW_EXCP:
env->regs[17] = env->sregs[SR_PC] + 4;
diff --git a/linux-user/microblaze/syscall.h b/linux-user/microblaze/syscall.h
index 3c1ed27..c38e700 100644
--- a/linux-user/microblaze/syscall.h
+++ b/linux-user/microblaze/syscall.h
@@ -54,3 +54,5 @@ struct target_pt_regs {
#define TARGET_MLOCKALL_MCL_FUTURE 2
#endif
+
+#define TARGET_USE_ERESTARTSYS 1
diff --git a/linux-user/signal.c b/linux-user/signal.c
index e432f97..abc7e30 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -3636,7 +3636,7 @@ long do_sigreturn(CPUMBState *env)
env->regs[14] = env->sregs[SR_PC];
unlock_user_struct(frame, frame_addr, 0);
- return env->regs[10];
+ return -TARGET_QEMU_ESIGRETURN;
badframe:
force_sig(TARGET_SIGSEGV);
}
--
2.1.4
- [Qemu-devel] [PATCH 03/34] linux-user: Support for restarting system calls, (continued)
- [Qemu-devel] [PATCH 03/34] linux-user: Support for restarting system calls, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 09/34] linux-user: Test for restarting system calls, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 19/34] linux-user: Restart fork() if signals pending, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 15/34] linux-user: Remove redundant get_errno() calls, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 17/34] linux-user: Use safe_syscall for wait system calls, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 21/34] linux-user: Remove redundant gdb_queuesig(), Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 10/34] linux-user: Support for restarting system calls for Microblaze targets,
Timothy E Baldwin <=
- [Qemu-devel] [PATCH 07/34] linux-user: Support for restarting system calls for PPC targets, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 14/34] linux-user: Use safe_syscall for read and write system calls, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 16/34] linux-user: Use safe_syscall for open and openat system calls, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 08/34] linux-user: Support for restarting system calls for SPARC targets, Timothy E Baldwin, 2015/09/05
- [Qemu-devel] [PATCH 20/34] linux-user: Remove redundant default action check in queue_signal(), Timothy E Baldwin, 2015/09/05