svn commit: r253125 - projects/bhyve_npt_pmap/sys/amd64/vmm

Neel Natu neel at FreeBSD.org
Wed Jul 10 00:36:03 UTC 2013


Author: neel
Date: Wed Jul 10 00:36:02 2013
New Revision: 253125
URL: http://svnweb.freebsd.org/changeset/base/253125

Log:
  Delay copying the exitinfo into vm_run.vm_exit until we know that we are
  returning to userland.

Modified:
  projects/bhyve_npt_pmap/sys/amd64/vmm/vmm.c

Modified: projects/bhyve_npt_pmap/sys/amd64/vmm/vmm.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/vmm/vmm.c	Wed Jul 10 00:31:28 2013	(r253124)
+++ projects/bhyve_npt_pmap/sys/amd64/vmm/vmm.c	Wed Jul 10 00:36:02 2013	(r253125)
@@ -680,7 +680,7 @@ vm_run(struct vm *vm, struct vm_run *vmr
 		return (EINVAL);
 
 	vcpu = &vm->vcpu[vcpuid];
-	vme = &vmrun->vm_exit;
+	vme = &vcpu->exitinfo;
 	rip = vmrun->rip;
 restart:
 	critical_enter();
@@ -704,9 +704,6 @@ restart:
 
 	vmm_stat_incr(vm, vcpuid, VCPU_TOTAL_RUNTIME, rdtsc() - tscval);
 
-	/* copy the exit information */
-	bcopy(&vcpu->exitinfo, vme, sizeof(struct vm_exit));
-
 	critical_exit();
 
 	if (error)
@@ -783,12 +780,15 @@ restart:
 			rip = vme->rip;
 			goto restart;
 		} else {
-			/* XXX */
-			vme->inst_length = 0;
+			error = EFAULT;
+			goto done;
 		}
 	}
 
 done:
+	/* copy the exit information */
+	bcopy(vme, &vmrun->vm_exit, sizeof(struct vm_exit));
+
 	return (error);
 }
 


More information about the svn-src-projects mailing list