Adds the following new APIs - cpu_physical_memory_read_debug - cpu_physical_memory_write_debug - cpu_physical_memory_rw_debug - ldl_phys_debug - ldq_phys_debug
Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Peter Crosthwaite <crosthwaite.pe...@gmail.com> Cc: Richard Henderson <r...@twiddle.net> Signed-off-by: Brijesh Singh <brijesh.si...@amd.com> Reviewed-by: Paolo Bonzini <pbonz...@redhat.com> --- exec.c | 31 +++++++++++++++++++++++++++++++ include/exec/cpu-common.h | 15 +++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/exec.c b/exec.c index 9b0ab1648945..e1837cad61f9 100644 --- a/exec.c +++ b/exec.c @@ -3540,6 +3540,37 @@ void address_space_cache_destroy(MemoryRegionCache *cache) #define RCU_READ_UNLOCK() rcu_read_unlock() #include "memory_ldst.inc.c" +uint32_t ldl_phys_debug(CPUState *cpu, hwaddr addr) +{ + MemTxAttrs attrs = MEMTXATTRS_DEBUG; + int asidx = cpu_asidx_from_attrs(cpu, attrs); + uint32_t val; + + cpu_physical_memory_rw_debug_internal(cpu->cpu_ases[asidx].as, + addr, (void *) &val, + 4, attrs, READ_DATA); + return tswap32(val); +} + +uint64_t ldq_phys_debug(CPUState *cpu, hwaddr addr) +{ + MemTxAttrs attrs = MEMTXATTRS_DEBUG; + int asidx = cpu_asidx_from_attrs(cpu, attrs); + uint64_t val; + + cpu_physical_memory_rw_debug_internal(cpu->cpu_ases[asidx].as, + addr, (void *) &val, + 8, attrs, READ_DATA); + return val; +} + +void cpu_physical_memory_rw_debug(hwaddr addr, uint8_t *buf, + int len, int is_write) +{ + address_space_rw(&address_space_memory, addr, MEMTXATTRS_DEBUG, buf, + len, is_write); +} + /* virtual memory access for debug (includes writing to ROM) */ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr, uint8_t *buf, int len, int is_write) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index 74341b19d26a..fa01385d4f1b 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -77,11 +77,26 @@ size_t qemu_ram_pagesize_largest(void); void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf, int len, int is_write); +void cpu_physical_memory_rw_debug(hwaddr addr, uint8_t *buf, + int len, int is_write); static inline void cpu_physical_memory_read(hwaddr addr, void *buf, int len) { cpu_physical_memory_rw(addr, buf, len, 0); } +static inline void cpu_physical_memory_read_debug(hwaddr addr, + void *buf, int len) +{ + cpu_physical_memory_rw_debug(addr, buf, len, 0); +} +static inline void cpu_physical_memory_write_debug(hwaddr addr, + const void *buf, int len) +{ + cpu_physical_memory_rw_debug(addr, (void *)buf, len, 1); +} +uint32_t ldl_phys_debug(CPUState *cpu, hwaddr addr); +uint64_t ldq_phys_debug(CPUState *cpu, hwaddr addr); + static inline void cpu_physical_memory_write(hwaddr addr, const void *buf, int len) { -- 2.9.5