svn commit: r367834 - head/usr.sbin/bhyve
Peter Grehan
grehan at FreeBSD.org
Thu Nov 19 07:23:40 UTC 2020
Author: grehan
Date: Thu Nov 19 07:23:39 2020
New Revision: 367834
URL: https://svnweb.freebsd.org/changeset/base/367834
Log:
Advance RIP after userspace instruction decode
Add update to RIP after a userspace instruction decode (as is done for
the in-kernel counterpart of this case).
Submitted by: adam_fenn.io
Reviewed by: cem, markj
Approved by: grehan (bhyve)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D27243
Modified:
head/usr.sbin/bhyve/bhyverun.c
Modified: head/usr.sbin/bhyve/bhyverun.c
==============================================================================
--- head/usr.sbin/bhyve/bhyverun.c Thu Nov 19 06:30:25 2020 (r367833)
+++ head/usr.sbin/bhyve/bhyverun.c Thu Nov 19 07:23:39 2020 (r367834)
@@ -766,7 +766,11 @@ vmexit_inst_emul(struct vmctx *ctx, struct vm_exit *vm
vie_restart(vie);
mode = vmexit->u.inst_emul.paging.cpu_mode;
cs_d = vmexit->u.inst_emul.cs_d;
- (void)vmm_decode_instruction(mode, cs_d, vie);
+ if (vmm_decode_instruction(mode, cs_d, vie) != 0)
+ goto fail;
+ if (vm_set_register(ctx, *pvcpu, VM_REG_GUEST_RIP,
+ vmexit->rip + vie->num_processed) != 0)
+ goto fail;
}
err = emulate_mem(ctx, *pvcpu, vmexit->u.inst_emul.gpa,
@@ -777,15 +781,17 @@ vmexit_inst_emul(struct vmctx *ctx, struct vm_exit *vm
EPRINTLN("Unhandled memory access to 0x%lx\n",
vmexit->u.inst_emul.gpa);
}
-
- fprintf(stderr, "Failed to emulate instruction sequence [ ");
- for (i = 0; i < vie->num_valid; i++)
- fprintf(stderr, "%02x", vie->inst[i]);
- FPRINTLN(stderr, " ] at 0x%lx", vmexit->rip);
- return (VMEXIT_ABORT);
+ goto fail;
}
return (VMEXIT_CONTINUE);
+
+fail:
+ fprintf(stderr, "Failed to emulate instruction sequence [ ");
+ for (i = 0; i < vie->num_valid; i++)
+ fprintf(stderr, "%02x", vie->inst[i]);
+ FPRINTLN(stderr, " ] at 0x%lx", vmexit->rip);
+ return (VMEXIT_ABORT);
}
static pthread_mutex_t resetcpu_mtx = PTHREAD_MUTEX_INITIALIZER;
More information about the svn-src-all
mailing list