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
This commit is contained in:
parent
89744405e6
commit
887d46ef5b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367834
@ -766,7 +766,11 @@ vmexit_inst_emul(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
|
||||
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 *vmexit, int *pvcpu)
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user