Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jul 2013 00:36:02 +0000 (UTC)
From:      Neel Natu <neel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r253125 - projects/bhyve_npt_pmap/sys/amd64/vmm
Message-ID:  <201307100036.r6A0a2w7007041@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



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