diff options
author | Neel Natu <neel@FreeBSD.org> | 2014-05-24 19:13:25 +0000 |
---|---|---|
committer | Neel Natu <neel@FreeBSD.org> | 2014-05-24 19:13:25 +0000 |
commit | 37a723a5b32a80570ee31bd1c272c630bbd0be09 (patch) | |
tree | b6c3e4d6aa87835dcea4e12f5ba6efff47d7bd7e /sys/amd64/vmm/vmm.c | |
parent | 11d47032eec59ee3e57c84217839741d54ddcf5a (diff) | |
download | src-37a723a5b32a80570ee31bd1c272c630bbd0be09.tar.gz src-37a723a5b32a80570ee31bd1c272c630bbd0be09.zip |
When injecting a page fault into the guest also update the guest's %cr2 to
indicate the faulting linear address.
If the guest PML4 entry has the PG_PS bit set then inject a page fault into
the guest with the PGEX_RSV bit set in the error_code.
Get rid of redundant checks for the PG_RW violations when walking the page
tables.
Notes
Notes:
svn path=/head/; revision=266626
Diffstat (limited to 'sys/amd64/vmm/vmm.c')
-rw-r--r-- | sys/amd64/vmm/vmm.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c index 132af3638457..f5ed0fea606a 100644 --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -1441,13 +1441,20 @@ vm_inject_fault(struct vm *vm, int vcpuid, struct vm_exception *exception) } void -vm_inject_pf(struct vm *vm, int vcpuid, int error_code) +vm_inject_pf(struct vm *vm, int vcpuid, int error_code, uint64_t cr2) { struct vm_exception pf = { .vector = IDT_PF, .error_code_valid = 1, .error_code = error_code }; + int error; + + VCPU_CTR2(vm, vcpuid, "Injecting page fault: error_code %#x, cr2 %#lx", + error_code, cr2); + + error = vm_set_register(vm, vcpuid, VM_REG_GUEST_CR2, cr2); + KASSERT(error == 0, ("vm_set_register(cr2) error %d", error)); vm_inject_fault(vm, vcpuid, &pf); } |