StrikerX3/virt86

Add MSR and CPUID register information to VMExitInfo

StrikerX3 opened this issue · 1 comments

When a virtual machine exits due to RDMSR, WRMSR or CPUID, the exit context contains information about the relevant registers used with those instructions, but virt86 does not expose them in VMExitInfo.

This is currently only supported with WHPX. Here are the references for that platform:

The recommended design for this is to create new structs in VMExitInfo for each VM exit type:

struct VMExitInfo {
    ...
    // MSR access information, whem VMExitReason::MSRAccess
    struct {
        bool isWrite;
        uint32_t msrNumber;
        uint64_t rax;
        uint64_t rdx;
    } msr;

    // CPUID access information, whem VMExitReason::CPUID
    struct {
        uint64_t rax;
        uint64_t rcx;
        uint64_t rdx;
        uint64_t rbx;
        uint64_t defaultRax;
        uint64_t defaultRcx;
        uint64_t defaultRdx;
        uint64_t defaultRbx;
    } cpuid;
};

Fixed on commit 5ed178b.