@@ -44,17 +44,6 @@
#define GDB_ATTACHED "0"
#endif
-static inline int target_memory_rw_debug(CPUState *cpu, target_ulong addr,
- uint8_t *buf, int len, bool is_write)
-{
- CPUClass *cc = CPU_GET_CLASS(cpu);
-
- if (cc->memory_rw_debug) {
- return cc->memory_rw_debug(cpu, addr, buf, len, is_write);
- }
- return cpu_memory_rw_debug(cpu, addr, buf, len, is_write);
-}
-
enum {
GDB_SIGNAL_0 = 0,
GDB_SIGNAL_INT = 2,
@@ -347,4 +347,26 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
int cpu_exec(CPUState *cpu);
+/**
+ * target_memory_rw_debug:
+ * @cpu: The CPU to use.
+ * @addr: The target address to read or write.
+ * @buf: Host buffer to read or write from or into.
+ * @len: Length of data.
+ * @is_write: True for write, false for read.
+ *
+ * A wrapper for cpu_memory_rw_debug that can be overridden with a
+ * CPUClass-specific version if required.
+ */
+static inline int target_memory_rw_debug(CPUState *cpu, target_ulong addr,
+ uint8_t *buf, int len, bool is_write)
+{
+ CPUClass *cc = CPU_GET_CLASS(cpu);
+
+ if (cc->memory_rw_debug) {
+ return cc->memory_rw_debug(cpu, addr, buf, len, is_write);
+ }
+ return cpu_memory_rw_debug(cpu, addr, buf, len, is_write);
+}
+
#endif /* CPU_ALL_H */
This patch moves the target_memory_rw_debug function to include/exec/cpu-all.h, so that it can be used by the ARM semihosting code as well as the gdbstub code. (I tried Peter Maydell's suggestion of include/qom/cpu.h as a location for the function, but that raised uncomfortably-many dependency problems for my taste). Signed-off-by: Julian Brown <julian@codesourcery.com> --- gdbstub.c | 11 ----------- include/exec/cpu-all.h | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 11 deletions(-)