In order to keep TCG-specific functions under a TCG
API namespace, add the "accel/tcg/cpu-loop.h" header
and move cpu_exec() declaration to it. Add a bit of
documentation.

Include "accel/tcg/cpu-loop.h" where appropriate.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-Id: <[email protected]>
---
 bsd-user/freebsd/os-proc.h   |  1 +
 include/accel/tcg/cpu-loop.h | 21 +++++++++++++++++++++
 include/exec/cpu-common.h    |  3 ---
 include/user/cpu_loop.h      |  2 +-
 accel/tcg/cpu-exec.c         |  1 +
 accel/tcg/tcg-accel-ops.c    |  1 +
 bsd-user/main.c              |  1 +
 7 files changed, 26 insertions(+), 4 deletions(-)
 create mode 100644 include/accel/tcg/cpu-loop.h

diff --git a/bsd-user/freebsd/os-proc.h b/bsd-user/freebsd/os-proc.h
index 72ccf23e17e..1cf3c43de34 100644
--- a/bsd-user/freebsd/os-proc.h
+++ b/bsd-user/freebsd/os-proc.h
@@ -14,6 +14,7 @@
 #include <sys/procdesc.h>
 #include <sys/wait.h>
 
+#include "accel/tcg/cpu-loop.h"
 #include "target_arch_cpu.h"
 
 pid_t safe_wait4(pid_t wpid, int *status, int options, struct rusage *rusage);
diff --git a/include/accel/tcg/cpu-loop.h b/include/accel/tcg/cpu-loop.h
new file mode 100644
index 00000000000..6a3c8ed48b2
--- /dev/null
+++ b/include/accel/tcg/cpu-loop.h
@@ -0,0 +1,21 @@
+/*
+ * QEMU TCG CPU loop API
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef ACCEL_TCG_CPU_LOOP_COMMON_H
+#define ACCEL_TCG_CPU_LOOP_COMMON_H
+
+#ifndef CONFIG_TCG
+#error Can only include this header with TCG
+#endif
+
+/**
+ * cpu_exec:
+ * @cpu: the cpu context
+ *
+ * Returns one of the EXCP_* definitions (see "exec/cpu-common.h").
+ */
+int cpu_exec(CPUState *cpu);
+
+#endif
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index a781dba770b..09915dc4c44 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -111,9 +111,6 @@ G_NORETURN void cpu_loop_exit_restore(CPUState *cpu, 
uintptr_t pc);
 #endif /* CONFIG_TCG */
 G_NORETURN void cpu_loop_exit(CPUState *cpu);
 
-/* accel/tcg/cpu-exec.c */
-int cpu_exec(CPUState *cpu);
-
 /**
  * env_archcpu(env)
  * @env: The architecture environment
diff --git a/include/user/cpu_loop.h b/include/user/cpu_loop.h
index 346e37ede8b..c9d49398f01 100644
--- a/include/user/cpu_loop.h
+++ b/include/user/cpu_loop.h
@@ -22,7 +22,7 @@
 
 #include "exec/vaddr.h"
 #include "exec/mmu-access-type.h"
-
+#include "accel/tcg/cpu-loop.h"
 
 /**
  * adjust_signal_pc:
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 7292ff15060..9c754b03656 100644
--- a/accel/tcg/cpu-exec.c
+++ b/accel/tcg/cpu-exec.c
@@ -22,6 +22,7 @@
 #include "qapi/error.h"
 #include "qapi/type-helpers.h"
 #include "hw/core/cpu.h"
+#include "accel/tcg/cpu-loop.h"
 #include "accel/tcg/cpu-ops.h"
 #include "accel/tcg/helper-retaddr.h"
 #include "trace.h"
diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
index 3bd98005042..c179cd4adeb 100644
--- a/accel/tcg/tcg-accel-ops.c
+++ b/accel/tcg/tcg-accel-ops.c
@@ -28,6 +28,7 @@
 #include "qemu/osdep.h"
 #include "accel/accel-ops.h"
 #include "accel/accel-cpu-ops.h"
+#include "accel/tcg/cpu-loop.h"
 #include "system/tcg.h"
 #include "system/replay.h"
 #include "exec/icount.h"
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 73aae8c3274..4f1544342eb 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -39,6 +39,7 @@
 #include "user/guest-base.h"
 #include "user/page-protection.h"
 #include "accel/accel-ops.h"
+#include "accel/tcg/cpu-loop.h"
 #include "tcg/startup.h"
 #include "qemu/timer.h"
 #include "qemu/envlist.h"
-- 
2.53.0


Reply via email to