Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jul 2015 11:50:30 GMT
From:      mihai@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r288372 - in soc2015/mihai/bhyve-on-arm-head: sys/arm/vmm usr.sbin/bhyveloadarm
Message-ID:  <201507141150.t6EBoUI9040286@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mihai
Date: Tue Jul 14 11:50:29 2015
New Revision: 288372
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=288372

Log:
  soc2015: mihai: bhyve: sys: arm: vmm: vmm.c: fix set_registers functions

Modified:
  soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm.c
  soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm_dev.c
  soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyveloadarm/bhyveloadarm.c

Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm.c
==============================================================================
--- soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm.c	Tue Jul 14 11:47:13 2015	(r288371)
+++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm.c	Tue Jul 14 11:50:29 2015	(r288372)
@@ -46,7 +46,7 @@
 	int		 vcpuid;
 	void		*stats;
 	struct vm_exit	exitinfo;
-	uint64_t	nextrip;	/* (x) next instruction to execute */
+	uint64_t	nextpc;	/* (x) next instruction to execute */
 };
 
 #define	vcpu_lock_initialized(v) mtx_initialized(&((v)->mtx))
@@ -86,8 +86,8 @@
 #define	VMM_CLEANUP()	(ops != NULL ? (*ops->cleanup)() : 0)
 
 #define	VMINIT(vm) (ops != NULL ? (*ops->vminit)(vm, NULL): NULL)
-#define	VMRUN(vmi, vcpu, rip, pmap, rptr, sptr) \
-	(ops != NULL ? (*ops->vmrun)(vmi, vcpu, rip, pmap, rptr, sptr) : ENXIO)
+#define	VMRUN(vmi, vcpu, pc, pmap, rptr, sptr) \
+	(ops != NULL ? (*ops->vmrun)(vmi, vcpu, pc, pmap, rptr, sptr) : ENXIO)
 #define	VMCLEANUP(vmi)	(ops != NULL ? (*ops->vmcleanup)(vmi) : NULL)
 #define	VMMMAP_SET(vmi, gpa, hpa, len, prot)				\
     	(ops != NULL ? 							\
@@ -262,7 +262,6 @@
 	void *rptr = NULL, *sptr = NULL;
 
 	vcpuid = vmrun->cpuid;
-
 	if (vcpuid < 0 || vcpuid >= VM_MAXCPU)
 		return (EINVAL);
 
@@ -271,11 +270,15 @@
 
 	vcpu = &vm->vcpu[vcpuid];
 	vme = &vcpu->exitinfo;
+
+	printf("%s vcpuid: %d, nextpc: %llx\n",__func__, vcpuid, vcpu->nextpc);
+
 restart:
 	critical_enter();
 
-	error = VMRUN(vm->cookie, vcpuid, vcpu->nextrip, NULL, rptr, sptr);
+	error = VMRUN(vm->cookie, vcpuid, vcpu->nextpc, NULL, rptr, sptr);
 
+	printf("%s VMRUN error: %d\n",__func__, error);
 
 	critical_exit();
 
@@ -289,9 +292,11 @@
 
 	if (error == 0 && retu == false)
 		goto restart;
-
+	printf("%s before bhcopy\n",__func__);
 	/* copy the exit information */
 	bcopy(vme, &vmrun->vm_exit, sizeof(struct vm_exit));
+	printf("%s after bhcopy\n",__func__);
+
 	return (error);
 }
 
@@ -468,16 +473,24 @@
 }
 
 int
-vm_set_register(struct vm *vm, int vcpu, int reg, uint64_t val)
+vm_set_register(struct vm *vm, int vcpuid, int reg, uint64_t val)
 {
+	struct vcpu *vcpu;
+	int error;
 
-	if (vcpu < 0 || vcpu >= VM_MAXCPU)
+	if (vcpuid < 0 || vcpuid >= VM_MAXCPU)
 		return (EINVAL);
 
 	if (reg >= VM_REG_LAST)
 		return (EINVAL);
+	error = (VMSETREG(vm->cookie, vcpuid, reg, val));
+	if (error || reg != VM_REG_GUEST_PC)
+		return (error);
+
+	vcpu = &vm->vcpu[vcpuid];
+	vcpu->nextpc = val;
 
-	return (VMSETREG(vm->cookie, vcpu, reg, val));
+	return(0);
 }
 
 static void

Modified: soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm_dev.c
==============================================================================
--- soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm_dev.c	Tue Jul 14 11:47:13 2015	(r288371)
+++ soc2015/mihai/bhyve-on-arm-head/sys/arm/vmm/vmm_dev.c	Tue Jul 14 11:50:29 2015	(r288372)
@@ -142,6 +142,7 @@
 	case VM_RUN:
 		vmrun = (struct vm_run *)data;
 		error = vm_run(sc->vm, vmrun);
+		printf("%s VM_RUN returned error: %d\n", __func__, error);
 		break;
 	case VM_MAP_MEMORY:
 		seg = (struct vm_memory_segment *)data;

Modified: soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyveloadarm/bhyveloadarm.c
==============================================================================
--- soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyveloadarm/bhyveloadarm.c	Tue Jul 14 11:47:13 2015	(r288371)
+++ soc2015/mihai/bhyve-on-arm-head/usr.sbin/bhyveloadarm/bhyveloadarm.c	Tue Jul 14 11:50:29 2015	(r288372)
@@ -95,7 +95,6 @@
 	char kernel_image_name[KERNEL_IMAGE_NAME_LEN];
 	struct stat st;
 	void *addr;
-	char test[4];
 
 	progname = basename(argv[0]);
 



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