mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
target/riscv/kvm: Replace legacy cpu_physical_memory_read/write() calls
Commit b7ecba0f6f ("docs/devel/loads-stores.rst: Document our
various load and store APIs") mentioned cpu_physical_memory_*()
methods are legacy, the replacement being address_space_*().
Since the SBI DBCN is handled within a vCPU context, use its
default address space. Replace using the address space API.
As with the previous implementation, ignore whether the memory
accesses succeeded or failed.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Message-Id: <20251002145742.75624-4-philmd@linaro.org>
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "hw/pci/pci.h"
|
||||
#include "exec/memattrs.h"
|
||||
#include "system/address-spaces.h"
|
||||
#include "system/memory.h"
|
||||
#include "hw/boards.h"
|
||||
#include "hw/irq.h"
|
||||
#include "hw/intc/riscv_imsic.h"
|
||||
@@ -1564,6 +1565,7 @@ bool kvm_arch_stop_on_emulation_error(CPUState *cs)
|
||||
|
||||
static void kvm_riscv_handle_sbi_dbcn(CPUState *cs, struct kvm_run *run)
|
||||
{
|
||||
const MemTxAttrs attrs = MEMTXATTRS_UNSPECIFIED;
|
||||
g_autofree uint8_t *buf = NULL;
|
||||
RISCVCPU *cpu = RISCV_CPU(cs);
|
||||
target_ulong num_bytes;
|
||||
@@ -1602,9 +1604,9 @@ static void kvm_riscv_handle_sbi_dbcn(CPUState *cs, struct kvm_run *run)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cpu_physical_memory_write(addr, buf, ret);
|
||||
address_space_write(cs->as, addr, attrs, buf, ret);
|
||||
} else {
|
||||
cpu_physical_memory_read(addr, buf, num_bytes);
|
||||
address_space_read(cs->as, addr, attrs, buf, num_bytes);
|
||||
|
||||
ret = qemu_chr_fe_write_all(serial_hd(0)->be, buf, num_bytes);
|
||||
if (ret < 0) {
|
||||
|
||||
Reference in New Issue
Block a user