Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Jul 2013 19:19:29 +0000 (UTC)
From:      Neel Natu <neel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r253043 - in projects/bhyve_npt_pmap/sys/amd64: include vmm
Message-ID:  <201307081919.r68JJTPg085315@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: neel
Date: Mon Jul  8 19:19:29 2013
New Revision: 253043
URL: http://svnweb.freebsd.org/changeset/base/253043

Log:
  Require that the 'struct vie' be initialized before fetching and decoding
  the instruction.

Modified:
  projects/bhyve_npt_pmap/sys/amd64/include/vmm_instruction_emul.h
  projects/bhyve_npt_pmap/sys/amd64/vmm/vmm_instruction_emul.c

Modified: projects/bhyve_npt_pmap/sys/amd64/include/vmm_instruction_emul.h
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/include/vmm_instruction_emul.h	Mon Jul  8 17:57:11 2013	(r253042)
+++ projects/bhyve_npt_pmap/sys/amd64/include/vmm_instruction_emul.h	Mon Jul  8 19:19:29 2013	(r253043)
@@ -102,11 +102,15 @@ int vmm_emulate_instruction(void *vm, in
 #ifdef _KERNEL
 /*
  * APIs to fetch and decode the instruction from nested page fault handler.
+ *
+ * 'vie' must be initialized before calling 'vmm_fetch_instruction()'
  */
 int vmm_fetch_instruction(struct vm *vm, int cpuid,
 			  uint64_t rip, int inst_length, uint64_t cr3,
 			  struct vie *vie);
 
+void vie_init(struct vie *vie);
+
 /*
  * Decode the instruction fetched into 'vie' so it can be emulated.
  *

Modified: projects/bhyve_npt_pmap/sys/amd64/vmm/vmm_instruction_emul.c
==============================================================================
--- projects/bhyve_npt_pmap/sys/amd64/vmm/vmm_instruction_emul.c	Mon Jul  8 17:57:11 2013	(r253042)
+++ projects/bhyve_npt_pmap/sys/amd64/vmm/vmm_instruction_emul.c	Mon Jul  8 19:19:29 2013	(r253043)
@@ -399,7 +399,7 @@ vmm_emulate_instruction(void *vm, int vc
 }
 
 #ifdef _KERNEL
-static void
+void
 vie_init(struct vie *vie)
 {
 
@@ -474,8 +474,6 @@ vmm_fetch_instruction(struct vm *vm, int
 	if (inst_length > VIE_INST_SIZE)
 		panic("vmm_fetch_instruction: invalid length %d", inst_length);
 
-	vie_init(vie);
-
 	/* Copy the instruction into 'vie' */
 	while (vie->num_valid < inst_length) {
 		err = gla2gpa(vm, rip, cr3, &gpa, &gpaend);



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