@@ -1307,3 +1307,13 @@ void qemu_cpu_kick(CPUState *cpu)
{
cpu_exit(cpu);
}
+
+void cpu_enter_syscall(CPUState *cs)
+{
+ cs->in_syscall = true;
+}
+
+void cpu_exit_syscall(CPUState *cs)
+{
+ cs->in_syscall = false;
+}
@@ -936,6 +936,8 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1,
{
abi_long ret;
+ cpu_enter_syscall(env_cpu(cpu_env));
+
bql_unlock();
if (do_strace) {
@@ -951,6 +953,8 @@ abi_long do_freebsd_syscall(void *cpu_env, int num, abi_long arg1,
bql_lock();
+ cpu_exit_syscall(env_cpu(cpu_env));
+
return ret;
}
@@ -228,6 +228,8 @@ G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc);
int cpu_exec(CPUState *cpu);
/* accel/tcg/user-exec.c */
int cpu_exec_user(CPUState *cs);
+void cpu_enter_syscall(CPUState *cs);
+void cpu_exit_syscall(CPUState *cs);
/**
* env_archcpu(env)
@@ -475,6 +475,7 @@ struct CPUState {
bool created;
bool stop;
bool stopped;
+ bool in_syscall;
/* Should CPU start in powered-off state? */
bool start_powered_off;
@@ -13771,6 +13771,8 @@ abi_long do_syscall(CPUArchState *cpu_env, int num, abi_long arg1,
}
#endif
+ cpu_enter_syscall(cpu);
+
record_syscall_start(cpu, num, arg1,
arg2, arg3, arg4, arg5, arg6, arg7, arg8);
@@ -13791,5 +13793,8 @@ abi_long do_syscall(CPUArchState *cpu_env, int num, abi_long arg1,
bql_lock();
record_syscall_return(cpu, num, ret);
+
+ cpu_exit_syscall(cpu);
+
return ret;
}
CPUs that execute syscalls should be considered paused by all_vcpus_paused(). Lay the groundwork by introducing a bool field in CPUState to track this. The field is not used by sysemu, but it's only one byte, so it should not be a problem. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> --- accel/tcg/user-exec.c | 10 ++++++++++ bsd-user/freebsd/os-syscall.c | 4 ++++ include/exec/cpu-common.h | 2 ++ include/hw/core/cpu.h | 1 + linux-user/syscall.c | 5 +++++ 5 files changed, 22 insertions(+)