mirror of https://gitee.com/openkylin/qemu.git
linux-user: Support for restarting system calls for OpenRISC targets
Update the OpenRISC main loop code: * on TARGET_ERESTARTSYS, wind guest PC backwards to repeat syscall insn * handle TARGET_QEMU_ESIGRETURN in the main loop as the indication that the main loop should not touch any guest CPU state (We don't implement sigreturn on this target so there is no code there to update.) Signed-off-by: Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk> Message-id: 1441497448-32489-31-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>
This commit is contained in:
parent
256cb6af7f
commit
7fe7231a49
|
@ -2724,6 +2724,7 @@ void cpu_loop(CPUOpenRISCState *env)
|
||||||
{
|
{
|
||||||
CPUState *cs = CPU(openrisc_env_get_cpu(env));
|
CPUState *cs = CPU(openrisc_env_get_cpu(env));
|
||||||
int trapnr, gdbsig;
|
int trapnr, gdbsig;
|
||||||
|
abi_long ret;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
cpu_exec_start(cs);
|
cpu_exec_start(cs);
|
||||||
|
@ -2769,14 +2770,19 @@ void cpu_loop(CPUOpenRISCState *env)
|
||||||
break;
|
break;
|
||||||
case EXCP_SYSCALL:
|
case EXCP_SYSCALL:
|
||||||
env->pc += 4; /* 0xc00; */
|
env->pc += 4; /* 0xc00; */
|
||||||
env->gpr[11] = do_syscall(env,
|
ret = do_syscall(env,
|
||||||
env->gpr[11], /* return value */
|
env->gpr[11], /* return value */
|
||||||
env->gpr[3], /* r3 - r7 are params */
|
env->gpr[3], /* r3 - r7 are params */
|
||||||
env->gpr[4],
|
env->gpr[4],
|
||||||
env->gpr[5],
|
env->gpr[5],
|
||||||
env->gpr[6],
|
env->gpr[6],
|
||||||
env->gpr[7],
|
env->gpr[7],
|
||||||
env->gpr[8], 0, 0);
|
env->gpr[8], 0, 0);
|
||||||
|
if (ret == -TARGET_ERESTARTSYS) {
|
||||||
|
env->pc -= 4;
|
||||||
|
} else if (ret != -TARGET_QEMU_ESIGRETURN) {
|
||||||
|
env->gpr[11] = ret;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case EXCP_FPE:
|
case EXCP_FPE:
|
||||||
qemu_log_mask(CPU_LOG_INT, "\nFloating point error\n");
|
qemu_log_mask(CPU_LOG_INT, "\nFloating point error\n");
|
||||||
|
|
|
@ -23,4 +23,5 @@ static inline abi_ulong get_sp_from_cpustate(CPUOpenRISCState *state)
|
||||||
return state->gpr[1];
|
return state->gpr[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* TARGET_SIGNAL_H */
|
#endif /* TARGET_SIGNAL_H */
|
||||||
|
|
Loading…
Reference in New Issue