WHvRunVirtualProcessor

Voert een virtuele processor uit in een partitie, zodat deze gastcode kan uitvoeren.

Syntaxis

// Exit reasons
typedef enum WHV_RUN_VP_EXIT_REASON
{
    WHvRunVpExitReasonNone                   = 0x00000000,

    // Standard exits caused by operations of the virtual processor
    WHvRunVpExitReasonMemoryAccess           = 0x00000001,
    WHvRunVpExitReasonX64IoPortAccess        = 0x00000002,
    WHvRunVpExitReasonUnrecoverableException = 0x00000004,
    WHvRunVpExitReasonInvalidVpRegisterValue = 0x00000005,
    WHvRunVpExitReasonUnsupportedFeature     = 0x00000006,
    WHvRunVpExitReasonX64InterruptWindow     = 0x00000007,
    WHvRunVpExitReasonX64Halt                = 0x00000008,
    WHvRunVpExitReasonX64ApicEoi             = 0x00000009,

    // Additional exits that can be configured through partition properties
    WHvRunVpExitReasonX64MsrAccess           = 0x00001000,
    WHvRunVpExitReasonX64Cpuid               = 0x00001001,
    WHvRunVpExitReasonException              = 0x00001002,
    WHvRunVpExitReasonX64Rdtsc               = 0x00001003,

    // Exits caused by the host
    WHvRunVpExitReasonCanceled               = 0x00002001
} WHV_RUN_VP_EXIT_REASON;
 
// WHvRunVirtualProcessor output buffer
typedef struct WHV_RUN_VP_EXIT_CONTEXT
{
    WHV_RUN_VP_EXIT_REASON ExitReason;
    UINT32 Reserved;
    WHV_VP_EXIT_CONTEXT VpContext;

    union
    {
        WHV_MEMORY_ACCESS_CONTEXT MemoryAccess;
        WHV_X64_IO_PORT_ACCESS_CONTEXT IoPortAccess;
        WHV_X64_MSR_ACCESS_CONTEXT MsrAccess;
        WHV_X64_CPUID_ACCESS_CONTEXT CpuidAccess;
        WHV_VP_EXCEPTION_CONTEXT VpException;
        WHV_X64_INTERRUPTION_DELIVERABLE_CONTEXT InterruptWindow;
        WHV_X64_UNSUPPORTED_FEATURE_CONTEXT UnsupportedFeature;
        WHV_RUN_VP_CANCELED_CONTEXT CancelReason;
        WHV_X64_APIC_EOI_CONTEXT ApicEoi;
        WHV_X64_RDTSC_CONTEXT ReadTsc;
    };
} WHV_RUN_VP_EXIT_CONTEXT;
 
HRESULT
WINAPI
WHvRunVirtualProcessor(
    _In_ WHV_PARTITION_HANDLE Partition,
    _In_ UINT32 VpIndex,
    _Out_writes_bytes_(ExitContextSizeInBytes) VOID* ExitContext,
    _In_ UINT32 ExitContextSizeInBytes
    );

Parameters

Partition

Greep naar het partitieobject.

VpIndex

Hiermee geeft u de index van de virtuele processor die wordt uitgevoerd.

ExitContext

Hiermee geeft u de uitvoerbuffer op die de contextstructuur ontvangt die de informatie geeft over de reden waarom de WHvRunVirtualProcessor functie werd geretourneerd.

ExitContextSizeInBytes

Hiermee geeft u de grootte op van de buffer die de afsluitcontext ontvangt, in bytes.

Retourwaarde

Als de functie slaagt, is S_OKde retourwaarde .

Remarks

Een virtuele processor wordt uitgevoerd (dat wil gezegd, ingeschakeld om gastcode uit te voeren) door de WHvRunVirtualProcessor functie aan te roepen. De aanroep blokkeert synchroon totdat de virtuele processor een bewerking uitvoert die door de virtualisatiestack moet worden verwerkt (bijvoorbeeld het openen van geheugen in de GPA-ruimte die niet is toegewezen of niet toegankelijk is) of de virtualisatiestack vraagt expliciet een exit van de functie aan (bijvoorbeeld om een onderbreking voor de virtuele processor te injecteren of om de status van de virtuele machine te wijzigen).

Vereisten

Requirement Value
Minimaal ondersteunde Windows Windows 10 versie 1803 (x64); Windows 11, versie 24H2, build 26100.3915 (Arm64)
Header WinHvPlatform.h
Bibliotheek WinHvPlatform.lib
DLL WinHvPlatform.dll
Architectuur x64, Arm64

Zie ook