Commit f2f8560c authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Richard Henderson
Browse files

target-i386: fix disassembly with PAE=1, PG=0



CR4.PAE=1 will not enable paging if CR0.PG=0, but the "if" chain
in x86_cpu_get_phys_page_debug says otherwise.  Check CR0.PG
before everything else.

Fixes "-d in_asm" for a code section at the beginning of OVMF.

Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarRichard Henderson <rth@twiddle.net>
Reviewed-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
parent 2d1fe187
Loading
Loading
Loading
Loading
+16 −18
Original line number Diff line number Diff line
@@ -894,7 +894,10 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
    uint32_t page_offset;
    int page_size;

    if (env->cr[4] & CR4_PAE_MASK) {
    if (!(env->cr[0] & CR0_PG_MASK)) {
        pte = addr & env->a20_mask;
        page_size = 4096;
    } else if (env->cr[4] & CR4_PAE_MASK) {
        target_ulong pdpe_addr;
        uint64_t pde, pdpe;

@@ -952,10 +955,6 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
    } else {
        uint32_t pde;

        if (!(env->cr[0] & CR0_PG_MASK)) {
            pte = addr;
            page_size = 4096;
        } else {
        /* page directory entry */
        pde_addr = ((env->cr[3] & ~0xfff) + ((addr >> 20) & 0xffc)) & env->a20_mask;
        pde = ldl_phys(pde_addr);
@@ -972,7 +971,6 @@ hwaddr x86_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
                return -1;
            page_size = 4096;
        }
        }
        pte = pte & env->a20_mask;
    }