Rather than address_space_memory. Needs a few random callsites with hardcoded address_space_memory to be patched. Use first_cpu->as in these cases.
Signed-off-by: Peter Crosthwaite <[email protected]> --- Long term, cpu_physical_memory_rw and friends needs to be replaced. exec.c | 5 +++-- hw/core/loader.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/exec.c b/exec.c index aa39f6c..2535b32 100644 --- a/exec.c +++ b/exec.c @@ -487,7 +487,8 @@ void cpu_exec_init(CPUArchState *env) QTAILQ_INIT(&cpu->breakpoints); QTAILQ_INIT(&cpu->watchpoints); #ifndef CONFIG_USER_ONLY - cpu->as = &address_space_memory; + object_property_set_link(OBJECT(cpu), OBJECT(system_memory), "mr", + &error_abort); cpu->thread_id = qemu_get_thread_id(); #endif QTAILQ_INSERT_TAIL(&cpus, cpu, node); @@ -2105,7 +2106,7 @@ bool address_space_read(AddressSpace *as, hwaddr addr, uint8_t *buf, int len) void cpu_physical_memory_rw(hwaddr addr, uint8_t *buf, int len, int is_write) { - address_space_rw(&address_space_memory, addr, buf, len, is_write); + address_space_rw(first_cpu->as, addr, buf, len, is_write); } enum write_rom_type { diff --git a/hw/core/loader.c b/hw/core/loader.c index 2bf6b8f..16473a9 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -798,7 +798,7 @@ static void rom_reset(void *unused) void *host = memory_region_get_ram_ptr(rom->mr); memcpy(host, rom->data, rom->datasize); } else { - cpu_physical_memory_write_rom(&address_space_memory, + cpu_physical_memory_write_rom(first_cpu->as, rom->addr, rom->data, rom->datasize); } if (rom->isrom) { -- 2.0.0
