source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/winhvemulation.h@ 1180

Last change on this file since 1180 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

File size: 3.4 KB
Line 
1/**
2 * This file is part of the mingw-w64 runtime package.
3 * No warranty is given; refer to the file DISCLAIMER within this package.
4 */
5
6#ifndef _WINHVEMUAPI_H_
7#define _WINHVEMUAPI_H_
8
9#include <apiset.h>
10#include <apisetcconv.h>
11#include <minwindef.h>
12#include <winapifamily.h>
13
14#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
15
16#include <winhvplatformdefs.h>
17
18typedef union WHV_EMULATOR_STATUS {
19 __C89_NAMELESS struct {
20 UINT32 EmulationSuccessful : 1;
21 UINT32 InternalEmulationFailure : 1;
22 UINT32 IoPortCallbackFailed : 1;
23 UINT32 MemoryCallbackFailed : 1;
24 UINT32 TranslateGvaPageCallbackFailed : 1;
25 UINT32 TranslateGvaPageCallbackGpaIsNotAligned : 1;
26 UINT32 GetVirtualProcessorRegistersCallbackFailed : 1;
27 UINT32 SetVirtualProcessorRegistersCallbackFailed : 1;
28 UINT32 InterruptCausedIntercept : 1;
29 UINT32 GuestCannotBeFaulted : 1;
30 UINT32 Reserved : 22;
31 };
32 UINT32 AsUINT32;
33} WHV_EMULATOR_STATUS;
34
35typedef struct WHV_EMULATOR_MEMORY_ACCESS_INFO {
36 WHV_GUEST_PHYSICAL_ADDRESS GpaAddress;
37 UINT8 Direction;
38 UINT8 AccessSize;
39 UINT8 Data[8];
40} WHV_EMULATOR_MEMORY_ACCESS_INFO;
41
42typedef struct WHV_EMULATOR_IO_ACCESS_INFO {
43 UINT8 Direction;
44 UINT16 Port;
45 UINT16 AccessSize;
46 UINT32 Data;
47} WHV_EMULATOR_IO_ACCESS_INFO;
48
49typedef HRESULT (CALLBACK *WHV_EMULATOR_IO_PORT_CALLBACK)(VOID *Context, WHV_EMULATOR_IO_ACCESS_INFO *IoAccess);
50typedef HRESULT (CALLBACK *WHV_EMULATOR_MEMORY_CALLBACK)(VOID *Context, WHV_EMULATOR_MEMORY_ACCESS_INFO *MemoryAccess);
51typedef HRESULT (CALLBACK *WHV_EMULATOR_GET_VIRTUAL_PROCESSOR_REGISTERS_CALLBACK)(VOID *Context, const WHV_REGISTER_NAME *RegisterNames, UINT32 RegisterCount, WHV_REGISTER_VALUE *RegisterValues);
52typedef HRESULT (CALLBACK *WHV_EMULATOR_SET_VIRTUAL_PROCESSOR_REGISTERS_CALLBACK)(VOID *Context, const WHV_REGISTER_NAME *RegisterNames, UINT32 RegisterCount, const WHV_REGISTER_VALUE *RegisterValues);
53typedef HRESULT (CALLBACK *WHV_EMULATOR_TRANSLATE_GVA_PAGE_CALLBACK)(VOID *Context, WHV_GUEST_VIRTUAL_ADDRESS Gva, WHV_TRANSLATE_GVA_FLAGS TranslateFlags, WHV_TRANSLATE_GVA_RESULT_CODE *TranslationResult, WHV_GUEST_PHYSICAL_ADDRESS *Gpa);
54
55typedef struct WHV_EMULATOR_CALLBACKS {
56 UINT32 Size;
57 UINT32 Reserved;
58 WHV_EMULATOR_IO_PORT_CALLBACK WHvEmulatorIoPortCallback;
59 WHV_EMULATOR_MEMORY_CALLBACK WHvEmulatorMemoryCallback;
60 WHV_EMULATOR_GET_VIRTUAL_PROCESSOR_REGISTERS_CALLBACK WHvEmulatorGetVirtualProcessorRegisters;
61 WHV_EMULATOR_SET_VIRTUAL_PROCESSOR_REGISTERS_CALLBACK WHvEmulatorSetVirtualProcessorRegisters;
62 WHV_EMULATOR_TRANSLATE_GVA_PAGE_CALLBACK WHvEmulatorTranslateGvaPage;
63} WHV_EMULATOR_CALLBACKS;
64
65typedef VOID* WHV_EMULATOR_HANDLE;
66
67#ifdef __cplusplus
68extern "C" {
69#endif
70
71HRESULT WINAPI WHvEmulatorCreateEmulator(const WHV_EMULATOR_CALLBACKS *Callbacks, WHV_EMULATOR_HANDLE *Emulator);
72HRESULT WINAPI WHvEmulatorDestroyEmulator(WHV_EMULATOR_HANDLE Emulator);
73HRESULT WINAPI WHvEmulatorTryIoEmulation(WHV_EMULATOR_HANDLE Emulator, VOID *Context, const WHV_VP_EXIT_CONTEXT *VpContext, const WHV_X64_IO_PORT_ACCESS_CONTEXT *IoInstructionContext, WHV_EMULATOR_STATUS *EmulatorReturnStatus);
74HRESULT WINAPI WHvEmulatorTryMmioEmulation(WHV_EMULATOR_HANDLE Emulator, VOID *Context, const WHV_VP_EXIT_CONTEXT *VpContext, const WHV_MEMORY_ACCESS_CONTEXT *MmioInstructionContext, WHV_EMULATOR_STATUS *EmulatorReturnStatus);
75
76#ifdef __cplusplus
77}
78#endif
79
80#endif
81
82#endif
Note: See TracBrowser for help on using the repository browser.