In order to remove the convenient CPUState::as field, access the vcpu first address space using the cpu_get_address_space() helper.
Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- target/i386/arch_memory_mapping.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/target/i386/arch_memory_mapping.c b/target/i386/arch_memory_mapping.c index 560f4689abc..809c4cb0298 100644 --- a/target/i386/arch_memory_mapping.c +++ b/target/i386/arch_memory_mapping.c @@ -273,12 +273,14 @@ bool x86_cpu_get_memory_mapping(CPUState *cs, MemoryMappingList *list, X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; int32_t a20_mask; + AddressSpace *as; if (!cpu_paging_enabled(cs)) { /* paging is disabled */ return true; } + as = cpu_get_address_space(cs, 0); a20_mask = x86_get_a20_mask(env); if (env->cr[4] & CR4_PAE_MASK) { #ifdef TARGET_X86_64 @@ -287,12 +289,12 @@ bool x86_cpu_get_memory_mapping(CPUState *cs, MemoryMappingList *list, hwaddr pml5e_addr; pml5e_addr = (env->cr[3] & PLM4_ADDR_MASK) & a20_mask; - walk_pml5e(list, cs->as, pml5e_addr, a20_mask); + walk_pml5e(list, as, pml5e_addr, a20_mask); } else { hwaddr pml4e_addr; pml4e_addr = (env->cr[3] & PLM4_ADDR_MASK) & a20_mask; - walk_pml4e(list, cs->as, pml4e_addr, a20_mask, + walk_pml4e(list, as, pml4e_addr, a20_mask, 0xffffULL << 48); } } else @@ -301,7 +303,7 @@ bool x86_cpu_get_memory_mapping(CPUState *cs, MemoryMappingList *list, hwaddr pdpe_addr; pdpe_addr = (env->cr[3] & ~0x1f) & a20_mask; - walk_pdpe2(list, cs->as, pdpe_addr, a20_mask); + walk_pdpe2(list, as, pdpe_addr, a20_mask); } } else { hwaddr pde_addr; @@ -309,7 +311,7 @@ bool x86_cpu_get_memory_mapping(CPUState *cs, MemoryMappingList *list, pde_addr = (env->cr[3] & ~0xfff) & a20_mask; pse = !!(env->cr[4] & CR4_PSE_MASK); - walk_pde2(list, cs->as, pde_addr, a20_mask, pse); + walk_pde2(list, as, pde_addr, a20_mask, pse); } return true; -- 2.51.0
