[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 28/33] target-i386: simplify pte/vaddr calculation
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 28/33] target-i386: simplify pte/vaddr calculation |
Date: |
Thu, 5 Jun 2014 16:22:18 +0200 |
They can moved to after the dirty bit processing, and unified between
CR0.PG=1 and CR0.PG=0.
Signed-off-by: Paolo Bonzini <address@hidden>
---
target-i386/helper.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/target-i386/helper.c b/target-i386/helper.c
index c52eb5a..153a91b 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -527,7 +527,7 @@ int x86_cpu_handle_mmu_fault(CPUState *cs, vaddr addr,
hwaddr paddr;
uint64_t rsvd_mask = PG_HI_RSVD_MASK;
uint32_t page_offset;
- target_ulong vaddr, virt_addr;
+ target_ulong vaddr;
is_user = mmu_idx == MMU_USER_IDX;
#if defined(DEBUG_MMU)
@@ -544,7 +544,6 @@ int x86_cpu_handle_mmu_fault(CPUState *cs, vaddr addr,
pte = (uint32_t)pte;
}
#endif
- virt_addr = addr & TARGET_PAGE_MASK;
prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
page_size = 4096;
goto do_mapping;
@@ -748,9 +747,6 @@ do_check_protect:
}
stl_phys_notdirty(cs->as, pte_addr, pte);
}
- /* align to page_size */
- pte &= ((PHYS_ADDR_MASK & ~(page_size - 1)) | 0xfff);
- virt_addr = addr & ~(page_size - 1);
/* the page can be put in the TLB */
prot = PAGE_READ;
@@ -771,11 +767,14 @@ do_check_protect:
do_mapping:
pte = pte & env->a20_mask;
+ /* align to page_size */
+ pte &= PG_ADDRESS_MASK & ~(page_size - 1);
+
/* Even if 4MB pages, we map only one 4KB page in the cache to
avoid filling it too fast */
- page_offset = (addr & TARGET_PAGE_MASK) & (page_size - 1);
- paddr = (pte & TARGET_PAGE_MASK) + page_offset;
- vaddr = virt_addr + page_offset;
+ vaddr = addr & TARGET_PAGE_MASK;
+ page_offset = vaddr & (page_size - 1);
+ paddr = pte + page_offset;
tlb_set_page(cs, vaddr, paddr, prot, mmu_idx, page_size);
return 0;
--
1.8.3.1
- [Qemu-devel] [PULL 18/33] target-i386: fix coding standards in x86_cpu_handle_mmu_fault, (continued)
- [Qemu-devel] [PULL 18/33] target-i386: fix coding standards in x86_cpu_handle_mmu_fault, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 20/33] target-i386: commonize checks for 4MB and 4KB pages, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 19/33] target-i386: commonize checks for 2MB and 4KB pages, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 21/33] target-i386: commonize checks for PAE and non-PAE, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 23/33] target-i386: introduce do_check_protect label, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 22/33] target-i386: tweak handling of PG_NX_MASK, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 24/33] target-i386: introduce support for 1 GB pages, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 26/33] target-i386: test reserved PS bit on PML4Es, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 25/33] target-i386: set correct error code for reserved bit access, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 27/33] target-i386: raise page fault for reserved physical address bits, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 28/33] target-i386: simplify pte/vaddr calculation,
Paolo Bonzini <=
- [Qemu-devel] [PULL 29/33] target-i386: unify reserved bits and NX bit check, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 31/33] target-i386: support long addresses for 4MB pages (PSE-36), Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 30/33] target-i386: raise page fault for reserved bits in large pages, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 32/33] target-i386: fix protection bits in the TLB for SMEP, Paolo Bonzini, 2014/06/05
- [Qemu-devel] [PULL 33/33] target-i386: cleanup x86_cpu_get_phys_page_debug, Paolo Bonzini, 2014/06/05
- Re: [Qemu-devel] [PULL 00/33] softmmu cleanups and target-i386 paging fixes, Peter Maydell, 2014/06/05