mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
semihosting: Return void from do_common_semihosting
Perform the cleanup in the FIXME comment in common_semi_gdb_syscall. Do not modify guest registers until the syscall is complete, which in the gdbstub case is asynchronous. In the synchronous non-gdbstub case, use common_semi_set_ret to set the result. Merge set_swi_errno into common_semi_cb. Rely on the latter for combined return value / errno setting. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
@@ -154,7 +154,7 @@ void cpu_loop(CPUARMState *env)
|
||||
force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc);
|
||||
break;
|
||||
case EXCP_SEMIHOST:
|
||||
env->xregs[0] = do_common_semihosting(cs);
|
||||
do_common_semihosting(cs);
|
||||
env->pc += 4;
|
||||
break;
|
||||
case EXCP_YIELD:
|
||||
|
||||
@@ -449,7 +449,7 @@ void cpu_loop(CPUARMState *env)
|
||||
}
|
||||
break;
|
||||
case EXCP_SEMIHOST:
|
||||
env->regs[0] = do_common_semihosting(cs);
|
||||
do_common_semihosting(cs);
|
||||
env->regs[15] += env->thumb ? 2 : 4;
|
||||
break;
|
||||
case EXCP_INTERRUPT:
|
||||
|
||||
@@ -81,7 +81,7 @@ void cpu_loop(CPURISCVState *env)
|
||||
force_sig_fault(TARGET_SIGTRAP, TARGET_TRAP_BRKPT, env->pc);
|
||||
break;
|
||||
case RISCV_EXCP_SEMIHOST:
|
||||
env->gpr[xA0] = do_common_semihosting(cs);
|
||||
do_common_semihosting(cs);
|
||||
env->pc += 4;
|
||||
break;
|
||||
default:
|
||||
|
||||
+256
-287
File diff suppressed because it is too large
Load Diff
@@ -34,6 +34,6 @@
|
||||
#ifndef COMMON_SEMI_H
|
||||
#define COMMON_SEMI_H
|
||||
|
||||
target_ulong do_common_semihosting(CPUState *cs);
|
||||
void do_common_semihosting(CPUState *cs);
|
||||
|
||||
#endif /* COMMON_SEMI_H */
|
||||
|
||||
+2
-2
@@ -10515,13 +10515,13 @@ static void handle_semihosting(CPUState *cs)
|
||||
qemu_log_mask(CPU_LOG_INT,
|
||||
"...handling as semihosting call 0x%" PRIx64 "\n",
|
||||
env->xregs[0]);
|
||||
env->xregs[0] = do_common_semihosting(cs);
|
||||
do_common_semihosting(cs);
|
||||
env->pc += 4;
|
||||
} else {
|
||||
qemu_log_mask(CPU_LOG_INT,
|
||||
"...handling as semihosting call 0x%x\n",
|
||||
env->regs[0]);
|
||||
env->regs[0] = do_common_semihosting(cs);
|
||||
do_common_semihosting(cs);
|
||||
env->regs[15] += env->thumb ? 2 : 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2373,7 +2373,7 @@ void arm_v7m_cpu_do_interrupt(CPUState *cs)
|
||||
"...handling as semihosting call 0x%x\n",
|
||||
env->regs[0]);
|
||||
#ifdef CONFIG_TCG
|
||||
env->regs[0] = do_common_semihosting(cs);
|
||||
do_common_semihosting(cs);
|
||||
#else
|
||||
g_assert_not_reached();
|
||||
#endif
|
||||
|
||||
@@ -1347,7 +1347,7 @@ void riscv_cpu_do_interrupt(CPUState *cs)
|
||||
|
||||
if (cause == RISCV_EXCP_SEMIHOST) {
|
||||
if (env->priv >= PRV_S) {
|
||||
env->gpr[xA0] = do_common_semihosting(cs);
|
||||
do_common_semihosting(cs);
|
||||
env->pc += 4;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user