svn commit: r283308 - head/sys/amd64/vmm

Neel Natu neel at FreeBSD.org
Sat May 23 01:17:51 UTC 2015


Author: neel
Date: Sat May 23 01:17:50 2015
New Revision: 283308
URL: https://svnweb.freebsd.org/changeset/base/283308

Log:
  Exceptions don't deliver an error code in real mode.
  
  MFC after:	1 week

Modified:
  head/sys/amd64/vmm/vmm.c

Modified: head/sys/amd64/vmm/vmm.c
==============================================================================
--- head/sys/amd64/vmm/vmm.c	Sat May 23 00:32:58 2015	(r283307)
+++ head/sys/amd64/vmm/vmm.c	Sat May 23 01:17:50 2015	(r283308)
@@ -1785,6 +1785,7 @@ vm_inject_exception(struct vm *vm, int v
     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 v
 		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, &regval);
+		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:
 	 *


More information about the svn-src-head mailing list