gdbstub/system: Replace legacy cpu_physical_memory_read/write() calls
cpu_physical_memory_read() and cpu_physical_memory_write() are legacy (see commit b7ecba0f6f6), replace the two calls by a single one to address_space_rw(). So far there is no logical change, but stop ignoring these functions returned value and propagate it, respecting the *memory_rw_debug() family error path. Thus this is effectively a logical change. Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20260616020839.19104-4-philmd@oss.qualcomm.com>
Philippe Mathieu-Daudé committed
Jun 11, 2026 at 10:46 UTC
3e4776d3f3ced5c36d9577a544068b5f96f37756
1 file changed
+5
-6
gdbstub/system.c
+5
-6
@@ -20,6 +20,7 @@
20
#include "exec/hwaddr.h"
21
#include "accel/accel-ops.h"
22
#include "accel/accel-cpu-ops.h"
23
+#include "system/address-spaces.h"
24
#include "system/cpus.h"
25
#include "system/runstate.h"
26
#include "system/replay.h"
@@ -453,12 +454,10 @@ int gdb_target_memory_rw_debug(CPUState *cpu, hwaddr addr,
454
uint8_t *buf, int len, bool is_write)
455
{
456
if (phy_memory_mode) {
456
- if (is_write) {
457
- cpu_physical_memory_write(addr, buf, len);
458
- } else {
459
- cpu_physical_memory_read(addr, buf, len);
460
- }
461
- return 0;
457
+ MemTxResult res = address_space_rw(&address_space_memory, addr,
458
+ MEMTXATTRS_UNSPECIFIED, buf, len,
459
+ is_write);
460
+ return res == MEMTX_OK ? 0 : -1;
461
}
462
463
if (cpu->cc->memory_rw_debug) {