| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
#ifndef ___VBox_em_h |
|---|
| 31 |
#define ___VBox_em_h |
|---|
| 32 |
|
|---|
| 33 |
#include <VBox/cdefs.h> |
|---|
| 34 |
#include <VBox/types.h> |
|---|
| 35 |
#include <VBox/trpm.h> |
|---|
| 36 |
#include <VBox/dis.h> |
|---|
| 37 |
|
|---|
| 38 |
__BEGIN_DECLS |
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
#define VBOX_RAW_V86 |
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
typedef enum EMSTATE |
|---|
| 51 |
{ |
|---|
| 52 |
|
|---|
| 53 |
EMSTATE_NONE = 1, |
|---|
| 54 |
|
|---|
| 55 |
EMSTATE_RAW, |
|---|
| 56 |
|
|---|
| 57 |
EMSTATE_HWACC, |
|---|
| 58 |
|
|---|
| 59 |
EMSTATE_PARAV, |
|---|
| 60 |
|
|---|
| 61 |
EMSTATE_REM, |
|---|
| 62 |
|
|---|
| 63 |
EMSTATE_HALTED, |
|---|
| 64 |
|
|---|
| 65 |
EMSTATE_SUSPENDED, |
|---|
| 66 |
|
|---|
| 67 |
EMSTATE_TERMINATING, |
|---|
| 68 |
|
|---|
| 69 |
EMSTATE_DEBUG_GUEST_RAW, |
|---|
| 70 |
|
|---|
| 71 |
EMSTATE_DEBUG_GUEST_HWACC, |
|---|
| 72 |
|
|---|
| 73 |
EMSTATE_DEBUG_GUEST_REM, |
|---|
| 74 |
|
|---|
| 75 |
EMSTATE_DEBUG_HYPER, |
|---|
| 76 |
|
|---|
| 77 |
EMSTATE_GURU_MEDITATION, |
|---|
| 78 |
|
|---|
| 79 |
EMSTATE_MAKE_32BIT_HACK = 0x7fffffff |
|---|
| 80 |
} EMSTATE; |
|---|
| 81 |
|
|---|
| 82 |
VMMDECL(EMSTATE) EMGetState(PVM pVM); |
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 |
|
|---|
| 87 |
|
|---|
| 88 |
typedef DECLCALLBACK(uint32_t) FNEMULATEPARAM2UINT32(void *pvParam1, uint64_t val2); |
|---|
| 89 |
typedef FNEMULATEPARAM2UINT32 *PFNEMULATEPARAM2UINT32; |
|---|
| 90 |
typedef DECLCALLBACK(uint32_t) FNEMULATEPARAM2(void *pvParam1, size_t val2); |
|---|
| 91 |
typedef FNEMULATEPARAM2 *PFNEMULATEPARAM2; |
|---|
| 92 |
typedef DECLCALLBACK(uint32_t) FNEMULATEPARAM3(void *pvParam1, uint64_t val2, size_t val3); |
|---|
| 93 |
typedef FNEMULATEPARAM3 *PFNEMULATEPARAM3; |
|---|
| 94 |
typedef DECLCALLBACK(int) FNEMULATELOCKPARAM2(void *pvParam1, uint64_t val2, RTGCUINTREG32 *pf); |
|---|
| 95 |
typedef FNEMULATELOCKPARAM2 *PFNEMULATELOCKPARAM2; |
|---|
| 96 |
typedef DECLCALLBACK(int) FNEMULATELOCKPARAM3(void *pvParam1, uint64_t val2, size_t cb, RTGCUINTREG32 *pf); |
|---|
| 97 |
typedef FNEMULATELOCKPARAM3 *PFNEMULATELOCKPARAM3; |
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
|
|---|
| 101 |
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 |
#define EMIsRawRing3Enabled(pVM) ((pVM)->fRawR3Enabled) |
|---|
| 109 |
|
|---|
| 110 |
|
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 |
#define EMIsRawRing0Enabled(pVM) ((pVM)->fRawR0Enabled) |
|---|
| 118 |
|
|---|
| 119 |
VMMDECL(void) EMSetInhibitInterruptsPC(PVM pVM, RTGCUINTPTR PC); |
|---|
| 120 |
VMMDECL(RTGCUINTPTR) EMGetInhibitInterruptsPC(PVM pVM); |
|---|
| 121 |
VMMDECL(int) EMInterpretDisasOne(PVM pVM, PCCPUMCTXCORE pCtxCore, PDISCPUSTATE pCpu, unsigned *pcbInstr); |
|---|
| 122 |
VMMDECL(int) EMInterpretDisasOneEx(PVM pVM, RTGCUINTPTR GCPtrInstr, PCCPUMCTXCORE pCtxCore, |
|---|
| 123 |
PDISCPUSTATE pCpu, unsigned *pcbInstr); |
|---|
| 124 |
VMMDECL(int) EMInterpretInstruction(PVM pVM, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize); |
|---|
| 125 |
VMMDECL(int) EMInterpretInstructionCPU(PVM pVM, PDISCPUSTATE pCpu, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, uint32_t *pcbSize); |
|---|
| 126 |
VMMDECL(int) EMInterpretCpuId(PVM pVM, PCPUMCTXCORE pRegFrame); |
|---|
| 127 |
VMMDECL(int) EMInterpretRdtsc(PVM pVM, PCPUMCTXCORE pRegFrame); |
|---|
| 128 |
VMMDECL(int) EMInterpretInvlpg(PVM pVM, PCPUMCTXCORE pRegFrame, RTGCPTR pAddrGC); |
|---|
| 129 |
VMMDECL(int) EMInterpretIret(PVM pVM, PCPUMCTXCORE pRegFrame); |
|---|
| 130 |
VMMDECL(int) EMInterpretDRxWrite(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t DestRegDrx, uint32_t SrcRegGen); |
|---|
| 131 |
VMMDECL(int) EMInterpretDRxRead(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t DestRegGen, uint32_t SrcRegDrx); |
|---|
| 132 |
VMMDECL(int) EMInterpretCRxWrite(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t DestRegCrx, uint32_t SrcRegGen); |
|---|
| 133 |
VMMDECL(int) EMInterpretCRxRead(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t DestRegGen, uint32_t SrcRegCrx); |
|---|
| 134 |
VMMDECL(int) EMInterpretLMSW(PVM pVM, PCPUMCTXCORE pRegFrame, uint16_t u16Data); |
|---|
| 135 |
VMMDECL(int) EMInterpretCLTS(PVM pVM); |
|---|
| 136 |
VMMDECL(int) EMInterpretPortIO(PVM pVM, PCPUMCTXCORE pCtxCore, PDISCPUSTATE pCpu, uint32_t cbOp); |
|---|
| 137 |
VMMDECL(int) EMInterpretRdmsr(PVM pVM, PCPUMCTXCORE pRegFrame); |
|---|
| 138 |
VMMDECL(int) EMInterpretWrmsr(PVM pVM, PCPUMCTXCORE pRegFrame); |
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 |
|
|---|
| 142 |
VMMDECL(uint32_t) EMEmulateCmp(uint32_t u32Param1, uint64_t u64Param2, size_t cb); |
|---|
| 143 |
VMMDECL(uint32_t) EMEmulateAnd(void *pvParam1, uint64_t u64Param2, size_t cb); |
|---|
| 144 |
VMMDECL(uint32_t) EMEmulateInc(void *pvParam1, size_t cb); |
|---|
| 145 |
VMMDECL(uint32_t) EMEmulateDec(void *pvParam1, size_t cb); |
|---|
| 146 |
VMMDECL(uint32_t) EMEmulateOr(void *pvParam1, uint64_t u64Param2, size_t cb); |
|---|
| 147 |
VMMDECL(int) EMEmulateLockOr(void *pvParam1, uint64_t u64Param2, size_t cbSize, RTGCUINTREG32 *pf); |
|---|
| 148 |
VMMDECL(uint32_t) EMEmulateXor(void *pvParam1, uint64_t u64Param2, size_t cb); |
|---|
| 149 |
VMMDECL(uint32_t) EMEmulateAdd(void *pvParam1, uint64_t u64Param2, size_t cb); |
|---|
| 150 |
VMMDECL(uint32_t) EMEmulateSub(void *pvParam1, uint64_t u64Param2, size_t cb); |
|---|
| 151 |
VMMDECL(uint32_t) EMEmulateAdcWithCarrySet(void *pvParam1, uint64_t u64Param2, size_t cb); |
|---|
| 152 |
VMMDECL(uint32_t) EMEmulateBtr(void *pvParam1, uint64_t u64Param2); |
|---|
| 153 |
VMMDECL(int) EMEmulateLockBtr(void *pvParam1, uint64_t u64Param2, RTGCUINTREG32 *pf); |
|---|
| 154 |
VMMDECL(uint32_t) EMEmulateBts(void *pvParam1, uint64_t u64Param2); |
|---|
| 155 |
VMMDECL(uint32_t) EMEmulateBtc(void *pvParam1, uint64_t u64Param2); |
|---|
| 156 |
VMMDECL(uint32_t) EMEmulateCmpXchg(void *pvParam1, uint64_t *pu32Param2, uint64_t u32Param3, size_t cbSize); |
|---|
| 157 |
VMMDECL(uint32_t) EMEmulateLockCmpXchg(void *pvParam1, uint64_t *pu64Param2, uint64_t u64Param3, size_t cbSize); |
|---|
| 158 |
VMMDECL(uint32_t) EMEmulateCmpXchg8b(void *pu32Param1, uint32_t *pEAX, uint32_t *pEDX, uint32_t uEBX, uint32_t uECX); |
|---|
| 159 |
VMMDECL(uint32_t) EMEmulateLockCmpXchg8b(void *pu32Param1, uint32_t *pEAX, uint32_t *pEDX, uint32_t uEBX, uint32_t uECX); |
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
#ifdef IN_RING3 |
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
VMMR3DECL(int) EMR3Init(PVM pVM); |
|---|
| 168 |
VMMR3DECL(int) EMR3InitCPU(PVM pVM); |
|---|
| 169 |
VMMR3DECL(void) EMR3Relocate(PVM pVM); |
|---|
| 170 |
VMMR3DECL(void) EMR3Reset(PVM pVM); |
|---|
| 171 |
VMMR3DECL(int) EMR3Term(PVM pVM); |
|---|
| 172 |
VMMR3DECL(int) EMR3TermCPU(PVM pVM); |
|---|
| 173 |
VMMR3DECL(DECLNORETURN(void)) EMR3FatalError(PVM pVM, int rc); |
|---|
| 174 |
VMMR3DECL(int) EMR3ExecuteVM(PVM pVM, RTCPUID idCpu); |
|---|
| 175 |
VMMR3DECL(int) EMR3CheckRawForcedActions(PVM pVM); |
|---|
| 176 |
VMMR3DECL(int) EMR3Interpret(PVM pVM); |
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 |
|
|---|
| 182 |
|
|---|
| 183 |
|
|---|
| 184 |
typedef enum EMRAWMODE |
|---|
| 185 |
{ |
|---|
| 186 |
|
|---|
| 187 |
EMRAW_NONE = 0, |
|---|
| 188 |
|
|---|
| 189 |
EMRAW_RING3_ENABLE, |
|---|
| 190 |
|
|---|
| 191 |
EMRAW_RING3_DISABLE, |
|---|
| 192 |
|
|---|
| 193 |
EMRAW_RING0_ENABLE, |
|---|
| 194 |
|
|---|
| 195 |
EMRAW_RING0_DISABLE, |
|---|
| 196 |
EMRAW_END |
|---|
| 197 |
} EMRAWMODE; |
|---|
| 198 |
|
|---|
| 199 |
VMMR3DECL(int) EMR3RawSetMode(PVM pVM, EMRAWMODE enmMode); |
|---|
| 200 |
|
|---|
| 201 |
#endif |
|---|
| 202 |
|
|---|
| 203 |
|
|---|
| 204 |
#ifdef IN_RC |
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 |
|
|---|
| 208 |
|
|---|
| 209 |
VMMRCDECL(int) EMGCTrap(PVM pVM, unsigned uTrap, PCPUMCTXCORE pRegFrame); |
|---|
| 210 |
VMMRCDECL(uint32_t) EMGCEmulateLockCmpXchg(RTRCPTR pu32Param1, uint32_t *pu32Param2, uint32_t u32Param3, size_t cbSize, uint32_t *pEflags); |
|---|
| 211 |
VMMRCDECL(uint32_t) EMGCEmulateCmpXchg(RTRCPTR pu32Param1, uint32_t *pu32Param2, uint32_t u32Param3, size_t cbSize, uint32_t *pEflags); |
|---|
| 212 |
VMMRCDECL(uint32_t) EMGCEmulateLockCmpXchg8b(RTRCPTR pu32Param1, uint32_t *pEAX, uint32_t *pEDX, uint32_t uEBX, uint32_t uECX, uint32_t *pEflags); |
|---|
| 213 |
VMMRCDECL(uint32_t) EMGCEmulateCmpXchg8b(RTRCPTR pu32Param1, uint32_t *pEAX, uint32_t *pEDX, uint32_t uEBX, uint32_t uECX, uint32_t *pEflags); |
|---|
| 214 |
VMMRCDECL(uint32_t) EMGCEmulateLockXAdd(RTRCPTR pu32Param1, uint32_t *pu32Param2, size_t cbSize, uint32_t *pEflags); |
|---|
| 215 |
VMMRCDECL(uint32_t) EMGCEmulateXAdd(RTRCPTR pu32Param1, uint32_t *pu32Param2, size_t cbSize, uint32_t *pEflags); |
|---|
| 216 |
|
|---|
| 217 |
#endif |
|---|
| 218 |
|
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 |
__END_DECLS |
|---|
| 222 |
|
|---|
| 223 |
#endif |
|---|
| 224 |
|
|---|