diff options
author | neel <neel@FreeBSD.org> | 2015-05-23 01:17:50 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2015-05-23 01:17:50 +0000 |
commit | f031069b05df001e73fbfa92d7d06c0917b87f98 (patch) | |
tree | cf8c5645040fe0ddc437ebcb6c75c98c67699ac8 | |
parent | 9c12e1b0949f8b43c61dbd040d9709ac07d5d8b2 (diff) | |
download | FreeBSD-src-f031069b05df001e73fbfa92d7d06c0917b87f98.zip FreeBSD-src-f031069b05df001e73fbfa92d7d06c0917b87f98.tar.gz |
Exceptions don't deliver an error code in real mode.
MFC after: 1 week
-rw-r--r-- | sys/amd64/vmm/vmm.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c index efaaa7d..2671295 100644 --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -1785,6 +1785,7 @@ vm_inject_exception(struct vm *vm, int vcpuid, int vector, int errcode_valid, uint32_t errcode, int restart_instruction) { struct vcpu *vcpu; + uint64_t regval; int error; if (vcpuid < 0 || vcpuid >= VM_MAXCPU) @@ -1809,6 +1810,16 @@ vm_inject_exception(struct vm *vm, int vcpuid, int vector, int errcode_valid, return (EBUSY); } + if (errcode_valid) { + /* + * Exceptions don't deliver an error code in real mode. + */ + error = vm_get_register(vm, vcpuid, VM_REG_GUEST_CR0, ®val); + KASSERT(!error, ("%s: error %d getting CR0", __func__, error)); + if (!(regval & CR0_PE)) + errcode_valid = 0; + } + /* * From section 26.6.1 "Interruptibility State" in Intel SDM: * |