On 13/3/25 04:45, Richard Henderson wrote:
Uninline the user-only stubs from hw/core/cpu.h.
Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
---
include/hw/core/cpu.h | 23 -----------------------
common-user/watchpoint-stub.c | 28 ++++++++++++++++++++++++++++
common-user/meson.build | 1 +
3 files changed, 29 insertions(+), 23 deletions(-)
create mode 100644 common-user/watchpoint-stub.c
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index 5d11d26556..2fdb115b19 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -1109,35 +1109,12 @@ static inline bool cpu_breakpoint_test(CPUState *cpu,
vaddr pc, int mask)
return false;
}
-#if defined(CONFIG_USER_ONLY)
-static inline int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
- int flags, CPUWatchpoint **watchpoint)
-{
- return -ENOSYS;
-}
-
-static inline int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
- vaddr len, int flags)
-{
- return -ENOSYS;
-}
-
-static inline void cpu_watchpoint_remove_by_ref(CPUState *cpu,
- CPUWatchpoint *wp)
-{
-}
-
-static inline void cpu_watchpoint_remove_all(CPUState *cpu, int mask)
-{
-}
-#else
int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
int flags, CPUWatchpoint **watchpoint);
int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
vaddr len, int flags);
void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint);
void cpu_watchpoint_remove_all(CPUState *cpu, int mask);
-#endif
/**
* cpu_get_address_space:
diff --git a/common-user/watchpoint-stub.c b/common-user/watchpoint-stub.c
new file mode 100644
index 0000000000..2489fca4f3
--- /dev/null
+++ b/common-user/watchpoint-stub.c
@@ -0,0 +1,28 @@
+/*
+ * CPU watchpoint stubs
+ *
+ * Copyright (c) 2003 Fabrice Bellard
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "hw/core/cpu.h"
+
+int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
+ int flags, CPUWatchpoint **watchpoint)
+{
+ return -ENOSYS;
+}
+
+int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, vaddr len, int flags)
+{
+ return -ENOSYS;
+}
+
+void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *wp)
+{
Again, can this be elide? Otherwise better use g_assert_not_reached().
+}
+
+void cpu_watchpoint_remove_all(CPUState *cpu, int mask)
+{
+}