Skip to contentSkip to conversation

x86: clear NX bit from address in cpu_get_phys_page_debug

PATCH New andrzej zaborowski 1 participant 1 message Feb 13, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: clear NX bit from address in cpu_get_phys_page_debug

All bits outside of PHYS_ADDR_MASK are zeroed in cpu_x86_handle_mmu_fault to produce the physical address, but not in cpu_get_phys_page_debug. The return value of cpu_get_phys_page_debug() is directly added to phys_ram_base by users so if the NX bit was set in the PTE, qemu will try to access outside phys_ram_base.
(This is my interpretation of the error but I'm no expert on x86)

Cheers

target-i386/helper.c +0 -0
@@ -1274,7 +1274,7 @@ target_phys_addr_t

cpu_get_phys_page_debug(CPUState *env, target_ulong addr)

     }

     page_offset = (addr & TARGET_PAGE_MASK) & (page_size - 1);
-    paddr = (pte & TARGET_PAGE_MASK) + page_offset;
+    paddr = (pte & PHYS_ADDR_MASK) + page_offset;
     return paddr;

}