Implement string IO emulation for MSHV#8365
Queued
liuw wants to merge 5 commits into
Queued
Conversation
Move scalar HVMSG_X64_IO_PORT_INTERCEPT handling into a helper so the string I/O implementation can build on the same dispatch path. Keep the existing fw_cfg/debug-port skip plus string/REP assertions in place. This is only code movement so later changes are easier to review. Signed-off-by: Wei Liu <liuwe@microsoft.com> Assisted-by: Copilot:GPT-5.5
Move common string instruction bookkeeping into the x86 instruction emulator so MOVS, STOS, and MSHV port string I/O use one implementation for REP counts, direction-flag handling, and index advancement. This keeps existing MOVS/STOS behavior unchanged while removing the need for MSHV to open-code the same string-operation details. Signed-off-by: Wei Liu <liuwe@microsoft.com> Assisted-by: Copilot:GPT-5.5
Decode MSHV port access size, direction, string, and REP state through small helpers instead of open-coded bitfield reads. Keep scalar I/O behavior unchanged and continue rejecting string I/O in this step. Put the x86_64 port I/O helpers in their own module so the string emulation path can grow without bloating the top-level MSHV code. Signed-off-by: Wei Liu <liuwe@microsoft.com> Assisted-by: Copilot:GPT-5.5
Handle MSHV INS/OUTS port intercepts by translating the guest string operand through MshvEmulatorContext and copying data between guest memory and existing PIO callbacks. Support REP counts, zero-count REP, and direction-flag based RSI/RDI updates. Commit RIP plus RCX/RSI/RDI after the transfer completes. This removes the fw_cfg/debug-port skip. OVMF can now use the real string I/O path instead of relying on ignored ports. Signed-off-by: Wei Liu <liuwe@microsoft.com> Assisted-by: Copilot:GPT-5.5
Re-enable the fw_cfg integration tests for MSHV now that port string I/O is handled by the hypervisor backend. Signed-off-by: Wei Liu <liuwe@microsoft.com> Assisted-by: Copilot:GPT-5.5
rbradford
approved these changes
Jun 10, 2026
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.
The old code was introduced when fw_cfg was considered legacy. Things have changed.