diff options
author | Peter Maydell | 2016-12-22 20:23:51 +0100 |
---|---|---|
committer | Peter Maydell | 2016-12-22 20:23:51 +0100 |
commit | a470b33259bf82ef2336bfcd5d07640562d3f63b (patch) | |
tree | d86ac1e104302269c73ecac2e6540fc299934e7f /target/i386/arch_memory_mapping.c | |
parent | Merge remote-tracking branch 'remotes/berrange/tags/pull-qcrypto-2016-12-21-2... (diff) | |
parent | x86: implement la57 paging mode (diff) | |
download | qemu-a470b33259bf82ef2336bfcd5d07640562d3f63b.tar.gz qemu-a470b33259bf82ef2336bfcd5d07640562d3f63b.tar.xz qemu-a470b33259bf82ef2336bfcd5d07640562d3f63b.zip |
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
* core support for MemoryRegionCache from myself
* rules.mak speedup and cleanups from myself and Marc-Adnré
* multiboot command line fix from Vlad
* SCSI fixes from myself
* small qemu-timer speedup from myself
* x86 debugging improvements from Doug
* configurable Q35 devices from Chao
* x86 5-level paging support from Kirill
* x86 SHA_NI support for KVM from Yi Sun
* improved kvmclock migration logic from Marcelo
* bugfixes and doc fixes from others
# gpg: Signature made Thu 22 Dec 2016 15:01:13 GMT
# gpg: using RSA key 0xBFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg: aka "Paolo Bonzini <pbonzini@redhat.com>"
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1
# Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83
* remotes/bonzini/tags/for-upstream: (25 commits)
x86: implement la57 paging mode
target-i386: Fix eflags.TF/#DB handling of syscall/sysret insns
kvmclock: reduce kvmclock difference on migration
kvm: sync linux headers
scsi-disk: fix VERIFY for scsi-block
hw/block/pflash_cfi*.c: fix confusing assert fail message
multiboot: copy the cmdline verbatim, unescape module strings
x86: Fix x86_64 'g' packet response to gdb from 32-bit mode.
pc: make pit configurable
pc: make sata configurable
pc: make smbus configurable
target-i386: Add Intel SHA_NI instruction support.
block: drop remaining legacy aio functions in comment
main-loop: update comment for qemu_mutex_lock/unlock_iothread
timer: fix misleading comment in timer.h
qemu-timer: check active_timers outside lock/event
virtio-scsi: introduce virtio_scsi_acquire/release
build-sys: remove libtool left-over
rules.mak: add more rules to avoid chaining
rules.mak: speedup save-vars load-vars
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/i386/arch_memory_mapping.c')
-rw-r--r-- | target/i386/arch_memory_mapping.c | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/target/i386/arch_memory_mapping.c b/target/i386/arch_memory_mapping.c index 88f341e1bb..826aee597b 100644 --- a/target/i386/arch_memory_mapping.c +++ b/target/i386/arch_memory_mapping.c @@ -220,7 +220,8 @@ static void walk_pdpe(MemoryMappingList *list, AddressSpace *as, /* IA-32e Paging */ static void walk_pml4e(MemoryMappingList *list, AddressSpace *as, - hwaddr pml4e_start_addr, int32_t a20_mask) + hwaddr pml4e_start_addr, int32_t a20_mask, + target_ulong start_line_addr) { hwaddr pml4e_addr, pdpe_start_addr; uint64_t pml4e; @@ -236,11 +237,34 @@ static void walk_pml4e(MemoryMappingList *list, AddressSpace *as, continue; } - line_addr = ((i & 0x1ffULL) << 39) | (0xffffULL << 48); + line_addr = start_line_addr | ((i & 0x1ffULL) << 39); pdpe_start_addr = (pml4e & PLM4_ADDR_MASK) & a20_mask; walk_pdpe(list, as, pdpe_start_addr, a20_mask, line_addr); } } + +static void walk_pml5e(MemoryMappingList *list, AddressSpace *as, + hwaddr pml5e_start_addr, int32_t a20_mask) +{ + hwaddr pml5e_addr, pml4e_start_addr; + uint64_t pml5e; + target_ulong line_addr; + int i; + + for (i = 0; i < 512; i++) { + pml5e_addr = (pml5e_start_addr + i * 8) & a20_mask; + pml5e = address_space_ldq(as, pml5e_addr, MEMTXATTRS_UNSPECIFIED, + NULL); + if (!(pml5e & PG_PRESENT_MASK)) { + /* not present */ + continue; + } + + line_addr = (0x7fULL << 57) | ((i & 0x1ffULL) << 48); + pml4e_start_addr = (pml5e & PLM4_ADDR_MASK) & a20_mask; + walk_pml4e(list, as, pml4e_start_addr, a20_mask, line_addr); + } +} #endif void x86_cpu_get_memory_mapping(CPUState *cs, MemoryMappingList *list, @@ -257,10 +281,18 @@ void x86_cpu_get_memory_mapping(CPUState *cs, MemoryMappingList *list, if (env->cr[4] & CR4_PAE_MASK) { #ifdef TARGET_X86_64 if (env->hflags & HF_LMA_MASK) { - hwaddr pml4e_addr; + if (env->cr[4] & CR4_LA57_MASK) { + hwaddr pml5e_addr; + + pml5e_addr = (env->cr[3] & PLM4_ADDR_MASK) & env->a20_mask; + walk_pml5e(list, cs->as, pml5e_addr, env->a20_mask); + } else { + hwaddr pml4e_addr; - pml4e_addr = (env->cr[3] & PLM4_ADDR_MASK) & env->a20_mask; - walk_pml4e(list, cs->as, pml4e_addr, env->a20_mask); + pml4e_addr = (env->cr[3] & PLM4_ADDR_MASK) & env->a20_mask; + walk_pml4e(list, cs->as, pml4e_addr, env->a20_mask, + 0xffffULL << 48); + } } else #endif { |