Repository navigation
virtualbox: VBoxVMI register read and write - #306
Merged
Merged
Conversation
read_registers and write_registers go through the VBoxVMI REGS_READ and REGS_WRITE commands: the full X86Registers set of one vCPU, MSRs included, in one round trip, served by the vCPU's EMT between two of its instructions (a consistent snapshot, an atomic write, also on a running VM). A write is all or nothing: a value the CPU would not load (e.g. RFLAGS bit 1 clear) fails it without writing anything. efer and msr_efer are both EFER and must be equal in a write. rs-vboxvmi is bumped to 5452496 for the new commands. The register tests run under both methods: the invalid RFLAGS check goes through the driver instead of VBoxManage setregisters (which needs the MachineDebugger patch), registers_unchanged_while_paused checks that an unknown vCPU is an error, and the new virtualbox_write_registers_survive_resume checks that written registers are still there after the guest ran. The driver and test docs list registers as supported by VBoxVMI, with filters running every VBoxVMI test once, for 1 and 2 vCPUs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
VirtualBox has one EFER register, which X86Registers::efer and msr_efer both are. A register write giving them different values now fails with the shared EferMismatch error before anything is written, also with the MachineDebugger method, which wrote both to the same DBGF register and let the last one win. Documented on the driver page and the efer field. virtualbox_write_registers_survive_resume waits until a cold-booted guest has set SYSENTER_EIP on the vCPU it writes, and restores only the two MSRs it changed: the other registers moved on while the guest ran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #284.
read_registers/write_registers: one round trip each, via rs-vboxvmi5452496. Writes are all or nothing; values the CPU would refuse returnInvalidRegisters.efer != msr_eferwith a sharedEferMismatcherror (VirtualBox has one EFER register); documented on the driver page andX86Registers::efer.virtualbox_write_registers_survive_resume(SYSENTER MSRs written while paused survive 1 s of guest execution; restores only those MSRs afterwards).Server: Wenzel/virtualbox#7 (merged into
vmi/vboxvmi).Verified live with 1 and 2 vCPUs: full VBoxVMI suite (init, pause, vCPU, registers, page walk + banner, register writes, survive_resume, reads) and MachineDebugger register tests. fmt, clippy
-D warnings(virtualbox-api, virtualbox-vmi, both with --tests),virtualbox_errorspass.