Add update to RIP after a userspace instruction decode (as is done for
the in-kernel counterpart of this case).
Details
- Reviewers
cem grehan markj - Group Reviewers
bhyve - Commits
- rS367834: Advance RIP after userspace instruction decode
Found while making use of this facility to prototype some instruction
emulations in userspace. Without this patch, the guest would hang,
endlessly repeating the userspace-prototyped instruction. With this
patch, the guest would continue executing past the userspace-prototyped
instruction as expected.
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
usr.sbin/bhyve/bhyverun.c | ||
---|---|---|
771 ↗ | (On Diff #79623) | Indentation should also be by 4 spaces on this line. It might be a bit clearer if the two conditions were split into separate if-statements. |
Some notes I sent Adam earlier, might be useful for someone in the future:
I think the key is sys/amd64/vmm/vmm.c vm_run(9), where
we set vcpu->nextrip to rip + inst_length on vm exit. Inst_length
will be zero if decoding failed in the kernel. Additionally,
libvmmapi vm_run(3) zeros out the entire passed-in vm_exit context, so
we can't just update vmexit->rip in userspace and expect it to be
passed in during the next vm_run(3) — we need the vm_set_register()
ioctl you've used.