Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 May 2015 01:17:51 +0000 (UTC)
From:      Neel Natu <neel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r283308 - head/sys/amd64/vmm
Message-ID:  <201505230117.t4N1HpIU095761@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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:
 	 *



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201505230117.t4N1HpIU095761>