Commit af661ad11bbcd00b1eb437ab5032817e7ecf35fc

Authored by ths
1 parent c94655b0

Ptable calculation broken for 32bit code under x86_64, by Bernhard Kauer.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2697 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 4 additions and 4 deletions
target-i386/helper2.c
... ... @@ -670,7 +670,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
670 670 #endif
671 671 {
672 672 /* XXX: load them when cr3 is loaded ? */
673   - pdpe_addr = ((env->cr[3] & ~0x1f) + ((addr >> 30) << 3)) &
  673 + pdpe_addr = ((env->cr[3] & ~0x1f) + ((addr >> 27) & 0x18)) &
674 674 env->a20_mask;
675 675 pdpe = ldq_phys(pdpe_addr);
676 676 if (!(pdpe & PG_PRESENT_MASK)) {
... ... @@ -765,7 +765,7 @@ int cpu_x86_handle_mmu_fault(CPUX86State *env, target_ulong addr,
765 765 uint32_t pde;
766 766  
767 767 /* page directory entry */
768   - pde_addr = ((env->cr[3] & ~0xfff) + ((addr >> 20) & ~3)) &
  768 + pde_addr = ((env->cr[3] & ~0xfff) + ((addr >> 20) & 0xffc)) &
769 769 env->a20_mask;
770 770 pde = ldl_phys(pde_addr);
771 771 if (!(pde & PG_PRESENT_MASK)) {
... ... @@ -910,7 +910,7 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
910 910 } else
911 911 #endif
912 912 {
913   - pdpe_addr = ((env->cr[3] & ~0x1f) + ((addr >> 30) << 3)) &
  913 + pdpe_addr = ((env->cr[3] & ~0x1f) + ((addr >> 27) & 0x18)) &
914 914 env->a20_mask;
915 915 pdpe = ldl_phys(pdpe_addr);
916 916 if (!(pdpe & PG_PRESENT_MASK))
... ... @@ -940,7 +940,7 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
940 940 page_size = 4096;
941 941 } else {
942 942 /* page directory entry */
943   - pde_addr = ((env->cr[3] & ~0xfff) + ((addr >> 20) & ~3)) & env->a20_mask;
  943 + pde_addr = ((env->cr[3] & ~0xfff) + ((addr >> 20) & 0xffc)) & env->a20_mask;
944 944 pde = ldl_phys(pde_addr);
945 945 if (!(pde & PG_PRESENT_MASK))
946 946 return -1;
... ...