Signed-off-by: Timothy Edward Baldwin <t.e.baldwi...@members.leeds.ac.uk> ---
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