@@ -182,8 +182,6 @@ abi_long do_openbsd_syscall(void *cpu_env, int num, abi_long arg1,
abi_long arg2, abi_long arg3, abi_long arg4,
abi_long arg5, abi_long arg6);
void gemu_log(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
-extern __thread CPUState *thread_cpu;
-void cpu_loop(CPUArchState *env);
char *target_strerror(int err);
int get_osversion(void);
void fork_start(void);
@@ -296,9 +296,8 @@ void *page_alloc_target_data(target_ulong address, size_t size);
* at @address, as per page_alloc_target_data.
*/
void *page_get_target_data(target_ulong address);
-#endif
-CPUArchState *cpu_copy(CPUArchState *env);
+#endif /* CONFIG_USER_ONLY */
/* Flags for use in ENV->INTERRUPT_PENDING.
@@ -639,16 +639,6 @@ static inline tb_page_addr_t get_page_addr_code_hostp(CPUArchState *env,
return addr;
}
-/**
- * adjust_signal_pc:
- * @pc: raw pc from the host signal ucontext_t.
- * @is_write: host memory operation was write, or read-modify-write.
- *
- * Alter @pc as required for unwinding. Return the type of the
- * guest memory access -- host reads may be for guest execution.
- */
-MMUAccessType adjust_signal_pc(uintptr_t *pc, bool is_write);
-
#else
static inline void mmap_lock(void) {}
static inline void mmap_unlock(void) {}
new file mode 100644
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * cpu-target.h: user-mode target-agnostic execution prototypes
+ *
+ */
+
+#ifndef USER_CPU_COMMON_H
+#define USER_CPU_COMMON_H
+
+#include "exec/cpu-tlb.h"
+
+extern __thread CPUState *thread_cpu;
+
+/**
+ * adjust_signal_pc:
+ * @pc: raw pc from the host signal ucontext_t.
+ * @is_write: host memory operation was write, or read-modify-write.
+ *
+ * Alter @pc as required for unwinding. Return the type of the
+ * guest memory access -- host reads may be for guest execution.
+ */
+MMUAccessType adjust_signal_pc(uintptr_t *pc, bool is_write);
+
+void QEMU_NORETURN cpu_loop(CPUArchState *env);
+
+CPUArchState *cpu_copy(CPUArchState *env);
+
+/**
+ * preexit_cleanup: housekeeping before the guest exits
+ *
+ * env: the CPU state
+ * code: the exit code
+ */
+void preexit_cleanup(CPUArchState *env, int code);
+
+#endif
@@ -9,6 +9,7 @@
#include "exec/cpu-tlb.h"
#include "exec/cpu_ldst.h" /* abi_ptr */
+#include "user/cpu-common.h"
/**
* handle_sigsegv_accerr_write:
@@ -19,8 +19,7 @@
#include "qemu/osdep.h"
#include "qemu/plugin.h"
#include "exec/gdbstub.h"
-#include "qemu.h"
-#include "user-internals.h"
+#include "user/cpu-common.h"
#ifdef CONFIG_GPROF
#include <sys/gmon.h>
#endif
@@ -63,8 +63,6 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
abi_long arg2, abi_long arg3, abi_long arg4,
abi_long arg5, abi_long arg6, abi_long arg7,
abi_long arg8);
-extern __thread CPUState *thread_cpu;
-void QEMU_NORETURN cpu_loop(CPUArchState *env);
const char *target_strerror(int err);
int get_osversion(void);
void init_qemu_uname_release(void);
@@ -166,14 +164,6 @@ static inline int regpairs_aligned(void *cpu_env, int num) { return 1; }
static inline int regpairs_aligned(void *cpu_env, int num) { return 0; }
#endif
-/**
- * preexit_cleanup: housekeeping before the guest exits
- *
- * env: the CPU state
- * code: the exit code
- */
-void preexit_cleanup(CPUArchState *env, int code);
-
/*
* Include target-specific struct and function definitions;
* they may need access to the target-independent structures
Move user-mode common prototypes from "exec/exec-all.h" to "user/cpu-common.h". Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> --- bsd-user/qemu.h | 2 -- include/exec/cpu-all.h | 3 +-- include/exec/exec-all.h | 10 ---------- include/user/cpu-common.h | 36 ++++++++++++++++++++++++++++++++++++ include/user/cpu-target.h | 1 + linux-user/exit.c | 3 +-- linux-user/user-internals.h | 10 ---------- 7 files changed, 39 insertions(+), 26 deletions(-) create mode 100644 include/user/cpu-common.h