Page MenuHomeFreeBSD

Simplify instruction restart logic in bhyve.

Authored by neel on Jan 14 2015, 8:51 AM.
Referenced Files
Unknown Object (File)
Dec 20 2023, 12:20 AM
Unknown Object (File)
Nov 15 2023, 6:57 PM
Unknown Object (File)
Nov 7 2023, 8:31 PM
Unknown Object (File)
Nov 7 2023, 4:16 PM
Unknown Object (File)
Oct 27 2023, 3:44 AM
Unknown Object (File)
Oct 14 2023, 5:56 PM
Unknown Object (File)
Oct 12 2023, 3:57 PM
Unknown Object (File)
Oct 12 2023, 3:57 PM



Keep track of the next instruction to be executed by the vcpu as 'nextrip'.
As a result the VM_RUN ioctl no longer takes the %rip where a vcpu should
start execution.

Also, instruction restart happens implicitly via 'vm_inject_exception()' or
explicitly via 'vm_restart_instruction()'. The APIs behave identically in
both kernel and userspace contexts. The main beneficiary is the instruction
emulation code that executes in both contexts.

bhyve(8) VM exit handlers now treat 'vmexit->rip' and 'vmexit->inst_length'
as readonly:

  • Restarting an instruction is now done by calling 'vm_restart_instruction()' as opposed to setting 'vmexit->inst_length' to 0 (e.g. emulate_inout())
  • Resuming vcpu at an arbitrary %rip is now done by setting VM_REG_GUEST_RIP as opposed to changing 'vmexit->rip' (e.g. vmexit_task_switch())
Test Plan
  • inout_str unit tests
  • i386 panic due to double fault (task switch)
  • exception tracing

Diff Detail

rS FreeBSD src repository - subversion
Lint Skipped
Tests Skipped

Event Timeline

neel retitled this revision from to Simplify instruction restart logic in bhyve..
neel updated this object.
neel edited the test plan for this revision. (Show Details)
neel added a reviewer: grehan.
grehan edited edge metadata.
This revision is now accepted and ready to land.Jan 17 2015, 6:09 AM
neel updated this revision to Diff 3231.

Closed by commit rS277310 (authored by @neel).