gdbstub: specialise target_memory_rw_debug

The two implementations are different enough to encourage having a
specialisation and we can move some of the softmmu only stuff out of
gdbstub.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20230302190846.2593720-16-alex.bennee@linaro.org>
Message-Id: <20230303025805.625589-16-richard.henderson@linaro.org>
This commit is contained in:
Alex Bennée 2023-03-02 18:57:51 -08:00
parent 8a2025b36b
commit 589a58672e
4 changed files with 96 additions and 62 deletions

View file

@ -185,6 +185,10 @@ void gdb_handle_query_xfer_auxv(GArray *params, void *user_ctx); /*user */
void gdb_handle_query_attached(GArray *params, void *user_ctx); /* both */
/* softmmu only */
void gdb_handle_query_qemu_phy_mem_mode(GArray *params, void *user_ctx);
void gdb_handle_set_qemu_phy_mem_mode(GArray *params, void *user_ctx);
/*
* Break/Watch point support - there is an implementation for softmmu
* and user mode.
@ -194,4 +198,19 @@ int gdb_breakpoint_insert(CPUState *cs, int type, vaddr addr, vaddr len);
int gdb_breakpoint_remove(CPUState *cs, int type, vaddr addr, vaddr len);
void gdb_breakpoint_remove_all(CPUState *cs);
/**
* gdb_target_memory_rw_debug() - handle debug access to memory
* @cs: CPUState
* @addr: nominal address, could be an entire physical address
* @buf: data
* @len: length of access
* @is_write: is it a write operation
*
* This function is specialised depending on the mode we are running
* in. For softmmu guests we can switch the interpretation of the
* address to a physical address.
*/
int gdb_target_memory_rw_debug(CPUState *cs, hwaddr addr,
uint8_t *buf, int len, bool is_write);
#endif /* GDBSTUB_INTERNALS_H */