| 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_svm_h |
|---|
| 31 |
#define ___VBox_svm_h |
|---|
| 32 |
|
|---|
| 33 |
#include <VBox/types.h> |
|---|
| 34 |
#include <VBox/err.h> |
|---|
| 35 |
#include <iprt/assert.h> |
|---|
| 36 |
#include <iprt/asm.h> |
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
#define AMD_CPUID_SVM_FEATURE_EDX_NESTED_PAGING RT_BIT(0) |
|---|
| 47 |
#define AMD_CPUID_SVM_FEATURE_EDX_LBR_VIRT RT_BIT(1) |
|---|
| 48 |
#define AMD_CPUID_SVM_FEATURE_EDX_SVM_LOCK RT_BIT(2) |
|---|
| 49 |
#define AMD_CPUID_SVM_FEATURE_EDX_NRIP_SAVE RT_BIT(3) |
|---|
| 50 |
#define AMD_CPUID_SVM_FEATURE_EDX_SSE_3_5_DISABLE RT_BIT(9) |
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
#define SVM_EXIT_INVALID -1 |
|---|
| 59 |
|
|---|
| 60 |
#define SVM_EXIT_READ_CR0 0x0 |
|---|
| 61 |
#define SVM_EXIT_READ_CR1 0x1 |
|---|
| 62 |
#define SVM_EXIT_READ_CR2 0x2 |
|---|
| 63 |
#define SVM_EXIT_READ_CR3 0x3 |
|---|
| 64 |
#define SVM_EXIT_READ_CR4 0x4 |
|---|
| 65 |
#define SVM_EXIT_READ_CR5 0x5 |
|---|
| 66 |
#define SVM_EXIT_READ_CR6 0x6 |
|---|
| 67 |
#define SVM_EXIT_READ_CR7 0x7 |
|---|
| 68 |
#define SVM_EXIT_READ_CR8 0x8 |
|---|
| 69 |
#define SVM_EXIT_READ_CR9 0x9 |
|---|
| 70 |
#define SVM_EXIT_READ_CR10 0xA |
|---|
| 71 |
#define SVM_EXIT_READ_CR11 0xB |
|---|
| 72 |
#define SVM_EXIT_READ_CR12 0xC |
|---|
| 73 |
#define SVM_EXIT_READ_CR13 0xD |
|---|
| 74 |
#define SVM_EXIT_READ_CR14 0xE |
|---|
| 75 |
#define SVM_EXIT_READ_CR15 0xF |
|---|
| 76 |
|
|---|
| 77 |
#define SVM_EXIT_WRITE_CR0 0x10 |
|---|
| 78 |
#define SVM_EXIT_WRITE_CR1 0x11 |
|---|
| 79 |
#define SVM_EXIT_WRITE_CR2 0x12 |
|---|
| 80 |
#define SVM_EXIT_WRITE_CR3 0x13 |
|---|
| 81 |
#define SVM_EXIT_WRITE_CR4 0x14 |
|---|
| 82 |
#define SVM_EXIT_WRITE_CR5 0x15 |
|---|
| 83 |
#define SVM_EXIT_WRITE_CR6 0x16 |
|---|
| 84 |
#define SVM_EXIT_WRITE_CR7 0x17 |
|---|
| 85 |
#define SVM_EXIT_WRITE_CR8 0x18 |
|---|
| 86 |
#define SVM_EXIT_WRITE_CR9 0x19 |
|---|
| 87 |
#define SVM_EXIT_WRITE_CR10 0x1A |
|---|
| 88 |
#define SVM_EXIT_WRITE_CR11 0x1B |
|---|
| 89 |
#define SVM_EXIT_WRITE_CR12 0x1C |
|---|
| 90 |
#define SVM_EXIT_WRITE_CR13 0x1D |
|---|
| 91 |
#define SVM_EXIT_WRITE_CR14 0x1E |
|---|
| 92 |
#define SVM_EXIT_WRITE_CR15 0x1F |
|---|
| 93 |
|
|---|
| 94 |
#define SVM_EXIT_READ_DR0 0x20 |
|---|
| 95 |
#define SVM_EXIT_READ_DR1 0x21 |
|---|
| 96 |
#define SVM_EXIT_READ_DR2 0x22 |
|---|
| 97 |
#define SVM_EXIT_READ_DR3 0x23 |
|---|
| 98 |
#define SVM_EXIT_READ_DR4 0x24 |
|---|
| 99 |
#define SVM_EXIT_READ_DR5 0x25 |
|---|
| 100 |
#define SVM_EXIT_READ_DR6 0x26 |
|---|
| 101 |
#define SVM_EXIT_READ_DR7 0x27 |
|---|
| 102 |
#define SVM_EXIT_READ_DR8 0x28 |
|---|
| 103 |
#define SVM_EXIT_READ_DR9 0x29 |
|---|
| 104 |
#define SVM_EXIT_READ_DR10 0x2A |
|---|
| 105 |
#define SVM_EXIT_READ_DR11 0x2B |
|---|
| 106 |
#define SVM_EXIT_READ_DR12 0x2C |
|---|
| 107 |
#define SVM_EXIT_READ_DR13 0x2D |
|---|
| 108 |
#define SVM_EXIT_READ_DR14 0x2E |
|---|
| 109 |
#define SVM_EXIT_READ_DR15 0x2F |
|---|
| 110 |
|
|---|
| 111 |
#define SVM_EXIT_WRITE_DR0 0x30 |
|---|
| 112 |
#define SVM_EXIT_WRITE_DR1 0x31 |
|---|
| 113 |
#define SVM_EXIT_WRITE_DR2 0x32 |
|---|
| 114 |
#define SVM_EXIT_WRITE_DR3 0x33 |
|---|
| 115 |
#define SVM_EXIT_WRITE_DR4 0x34 |
|---|
| 116 |
#define SVM_EXIT_WRITE_DR5 0x35 |
|---|
| 117 |
#define SVM_EXIT_WRITE_DR6 0x36 |
|---|
| 118 |
#define SVM_EXIT_WRITE_DR7 0x37 |
|---|
| 119 |
#define SVM_EXIT_WRITE_DR8 0x38 |
|---|
| 120 |
#define SVM_EXIT_WRITE_DR9 0x39 |
|---|
| 121 |
#define SVM_EXIT_WRITE_DR10 0x3A |
|---|
| 122 |
#define SVM_EXIT_WRITE_DR11 0x3B |
|---|
| 123 |
#define SVM_EXIT_WRITE_DR12 0x3C |
|---|
| 124 |
#define SVM_EXIT_WRITE_DR13 0x3D |
|---|
| 125 |
#define SVM_EXIT_WRITE_DR14 0x3E |
|---|
| 126 |
#define SVM_EXIT_WRITE_DR15 0x3F |
|---|
| 127 |
|
|---|
| 128 |
#define SVM_EXIT_EXCEPTION_0 0x40 |
|---|
| 129 |
#define SVM_EXIT_EXCEPTION_1 0x41 |
|---|
| 130 |
#define SVM_EXIT_EXCEPTION_2 0x42 |
|---|
| 131 |
#define SVM_EXIT_EXCEPTION_3 0x43 |
|---|
| 132 |
#define SVM_EXIT_EXCEPTION_4 0x44 |
|---|
| 133 |
#define SVM_EXIT_EXCEPTION_5 0x45 |
|---|
| 134 |
#define SVM_EXIT_EXCEPTION_6 0x46 |
|---|
| 135 |
#define SVM_EXIT_EXCEPTION_7 0x47 |
|---|
| 136 |
#define SVM_EXIT_EXCEPTION_8 0x48 |
|---|
| 137 |
#define SVM_EXIT_EXCEPTION_9 0x49 |
|---|
| 138 |
#define SVM_EXIT_EXCEPTION_A 0x4A |
|---|
| 139 |
#define SVM_EXIT_EXCEPTION_B 0x4B |
|---|
| 140 |
#define SVM_EXIT_EXCEPTION_C 0x4C |
|---|
| 141 |
#define SVM_EXIT_EXCEPTION_D 0x4D |
|---|
| 142 |
#define SVM_EXIT_EXCEPTION_E 0x4E |
|---|
| 143 |
#define SVM_EXIT_EXCEPTION_F 0x4F |
|---|
| 144 |
#define SVM_EXIT_EXCEPTION_10 0x50 |
|---|
| 145 |
#define SVM_EXIT_EXCEPTION_11 0x51 |
|---|
| 146 |
#define SVM_EXIT_EXCEPTION_12 0x52 |
|---|
| 147 |
#define SVM_EXIT_EXCEPTION_13 0x53 |
|---|
| 148 |
#define SVM_EXIT_EXCEPTION_14 0x54 |
|---|
| 149 |
#define SVM_EXIT_EXCEPTION_15 0x55 |
|---|
| 150 |
#define SVM_EXIT_EXCEPTION_16 0x56 |
|---|
| 151 |
#define SVM_EXIT_EXCEPTION_17 0x57 |
|---|
| 152 |
#define SVM_EXIT_EXCEPTION_18 0x58 |
|---|
| 153 |
#define SVM_EXIT_EXCEPTION_19 0x59 |
|---|
| 154 |
#define SVM_EXIT_EXCEPTION_1A 0x5A |
|---|
| 155 |
#define SVM_EXIT_EXCEPTION_1B 0x5B |
|---|
| 156 |
#define SVM_EXIT_EXCEPTION_1C 0x5C |
|---|
| 157 |
#define SVM_EXIT_EXCEPTION_1D 0x5D |
|---|
| 158 |
#define SVM_EXIT_EXCEPTION_1E 0x5E |
|---|
| 159 |
#define SVM_EXIT_EXCEPTION_1F 0x5F |
|---|
| 160 |
|
|---|
| 161 |
#define SVM_EXIT_INTR 0x60 |
|---|
| 162 |
|
|---|
| 163 |
#define SVM_EXIT_NMI 0x61 |
|---|
| 164 |
|
|---|
| 165 |
#define SVM_EXIT_SMI 0x62 |
|---|
| 166 |
|
|---|
| 167 |
#define SVM_EXIT_INIT 0x63 |
|---|
| 168 |
|
|---|
| 169 |
#define SVM_EXIT_VINTR 0x64 |
|---|
| 170 |
|
|---|
| 171 |
#define SVM_EXIT_CR0_SEL_WRITE 0x65 |
|---|
| 172 |
|
|---|
| 173 |
#define SVM_EXIT_IDTR_READ 0x66 |
|---|
| 174 |
|
|---|
| 175 |
#define SVM_EXIT_GDTR_READ 0x67 |
|---|
| 176 |
|
|---|
| 177 |
#define SVM_EXIT_LDTR_READ 0x68 |
|---|
| 178 |
|
|---|
| 179 |
#define SVM_EXIT_TR_READ 0x69 |
|---|
| 180 |
|
|---|
| 181 |
#define SVM_EXIT_IDTR_WRITE 0x6A |
|---|
| 182 |
|
|---|
| 183 |
#define SVM_EXIT_GDTR_WRITE 0x6B |
|---|
| 184 |
|
|---|
| 185 |
#define SVM_EXIT_LDTR_WRITE 0x6C |
|---|
| 186 |
|
|---|
| 187 |
#define SVM_EXIT_TR_WRITE 0x6D |
|---|
| 188 |
|
|---|
| 189 |
#define SVM_EXIT_RDTSC 0x6E |
|---|
| 190 |
|
|---|
| 191 |
#define SVM_EXIT_RDPMC 0x6F |
|---|
| 192 |
|
|---|
| 193 |
#define SVM_EXIT_PUSHF 0x70 |
|---|
| 194 |
|
|---|
| 195 |
#define SVM_EXIT_POPF 0x71 |
|---|
| 196 |
|
|---|
| 197 |
#define SVM_EXIT_CPUID 0x72 |
|---|
| 198 |
|
|---|
| 199 |
#define SVM_EXIT_RSM 0x73 |
|---|
| 200 |
|
|---|
| 201 |
#define SVM_EXIT_IRET 0x74 |
|---|
| 202 |
|
|---|
| 203 |
#define SVM_EXIT_SWINT 0x75 |
|---|
| 204 |
|
|---|
| 205 |
#define SVM_EXIT_INVD 0x76 |
|---|
| 206 |
|
|---|
| 207 |
#define SVM_EXIT_PAUSE 0x77 |
|---|
| 208 |
|
|---|
| 209 |
#define SVM_EXIT_HLT 0x78 |
|---|
| 210 |
|
|---|
| 211 |
#define SVM_EXIT_INVLPG 0x79 |
|---|
| 212 |
|
|---|
| 213 |
#define SVM_EXIT_INVLPGA 0x7A |
|---|
| 214 |
|
|---|
| 215 |
#define SVM_EXIT_IOIO 0x7B |
|---|
| 216 |
|
|---|
| 217 |
#define SVM_EXIT_MSR 0x7C |
|---|
| 218 |
|
|---|
| 219 |
#define SVM_EXIT_TASK_SWITCH 0x7D |
|---|
| 220 |
|
|---|
| 221 |
#define SVM_EXIT_FERR_FREEZE 0x7E |
|---|
| 222 |
|
|---|
| 223 |
#define SVM_EXIT_SHUTDOWN 0x7F |
|---|
| 224 |
|
|---|
| 225 |
#define SVM_EXIT_VMRUN 0x80 |
|---|
| 226 |
|
|---|
| 227 |
#define SVM_EXIT_VMMCALL 0x81 |
|---|
| 228 |
|
|---|
| 229 |
#define SVM_EXIT_VMLOAD 0x82 |
|---|
| 230 |
|
|---|
| 231 |
#define SVM_EXIT_VMSAVE 0x83 |
|---|
| 232 |
|
|---|
| 233 |
#define SVM_EXIT_STGI 0x84 |
|---|
| 234 |
|
|---|
| 235 |
#define SVM_EXIT_CLGI 0x85 |
|---|
| 236 |
|
|---|
| 237 |
#define SVM_EXIT_SKINIT 0x86 |
|---|
| 238 |
|
|---|
| 239 |
#define SVM_EXIT_RDTSCP 0x87 |
|---|
| 240 |
|
|---|
| 241 |
#define SVM_EXIT_ICEBP 0x88 |
|---|
| 242 |
|
|---|
| 243 |
#define SVM_EXIT_WBINVD 0x89 |
|---|
| 244 |
|
|---|
| 245 |
#define SVM_EXIT_MONITOR 0x8A |
|---|
| 246 |
|
|---|
| 247 |
#define SVM_EXIT_MWAIT_UNCOND 0x8B |
|---|
| 248 |
|
|---|
| 249 |
#define SVM_EXIT_MWAIT_ARMED 0x8C |
|---|
| 250 |
|
|---|
| 251 |
#define SVM_EXIT_NPF 0x400 |
|---|
| 252 |
|
|---|
| 253 |
|
|---|
| 254 |
|
|---|
| 255 |
|
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 |
|
|---|
| 259 |
|
|---|
| 260 |
#define SVM_CTRL1_INTERCEPT_INTR RT_BIT(0) |
|---|
| 261 |
|
|---|
| 262 |
#define SVM_CTRL1_INTERCEPT_NMI RT_BIT(1) |
|---|
| 263 |
|
|---|
| 264 |
#define SVM_CTRL1_INTERCEPT_SMI RT_BIT(2) |
|---|
| 265 |
|
|---|
| 266 |
#define SVM_CTRL1_INTERCEPT_INIT RT_BIT(3) |
|---|
| 267 |
|
|---|
| 268 |
#define SVM_CTRL1_INTERCEPT_VINTR RT_BIT(4) |
|---|
| 269 |
|
|---|
| 270 |
#define SVM_CTRL1_INTERCEPT_CR0 RT_BIT(5) |
|---|
| 271 |
|
|---|
| 272 |
#define SVM_CTRL1_INTERCEPT_IDTR_READS RT_BIT(6) |
|---|
| 273 |
|
|---|
| 274 |
#define SVM_CTRL1_INTERCEPT_GDTR_READS RT_BIT(7) |
|---|
| 275 |
|
|---|
| 276 |
#define SVM_CTRL1_INTERCEPT_LDTR_READS RT_BIT(8) |
|---|
| 277 |
|
|---|
| 278 |
#define SVM_CTRL1_INTERCEPT_TR_READS RT_BIT(9) |
|---|
| 279 |
|
|---|
| 280 |
#define SVM_CTRL1_INTERCEPT_IDTR_WRITES RT_BIT(10) |
|---|
| 281 |
|
|---|
| 282 |
#define SVM_CTRL1_INTERCEPT_GDTR_WRITES RT_BIT(11) |
|---|
| 283 |
|
|---|
| 284 |
#define SVM_CTRL1_INTERCEPT_LDTR_WRITES RT_BIT(12) |
|---|
| 285 |
|
|---|
| 286 |
#define SVM_CTRL1_INTERCEPT_TR_WRITES RT_BIT(13) |
|---|
| 287 |
|
|---|
| 288 |
#define SVM_CTRL1_INTERCEPT_RDTSC RT_BIT(14) |
|---|
| 289 |
|
|---|
| 290 |
#define SVM_CTRL1_INTERCEPT_RDPMC RT_BIT(15) |
|---|
| 291 |
|
|---|
| 292 |
#define SVM_CTRL1_INTERCEPT_PUSHF RT_BIT(16) |
|---|
| 293 |
|
|---|
| 294 |
#define SVM_CTRL1_INTERCEPT_POPF RT_BIT(17) |
|---|
| 295 |
|
|---|
| 296 |
#define SVM_CTRL1_INTERCEPT_CPUID RT_BIT(18) |
|---|
| 297 |
|
|---|
| 298 |
#define SVM_CTRL1_INTERCEPT_RSM RT_BIT(19) |
|---|
| 299 |
|
|---|
| 300 |
#define SVM_CTRL1_INTERCEPT_IRET RT_BIT(20) |
|---|
| 301 |
|
|---|
| 302 |
#define SVM_CTRL1_INTERCEPT_INTN RT_BIT(21) |
|---|
| 303 |
|
|---|
| 304 |
#define SVM_CTRL1_INTERCEPT_INVD RT_BIT(22) |
|---|
| 305 |
|
|---|
| 306 |
#define SVM_CTRL1_INTERCEPT_PAUSE RT_BIT(23) |
|---|
| 307 |
|
|---|
| 308 |
#define SVM_CTRL1_INTERCEPT_HLT RT_BIT(24) |
|---|
| 309 |
|
|---|
| 310 |
#define SVM_CTRL1_INTERCEPT_INVLPG RT_BIT(25) |
|---|
| 311 |
|
|---|
| 312 |
#define SVM_CTRL1_INTERCEPT_INVLPGA RT_BIT(26) |
|---|
| 313 |
|
|---|
| 314 |
#define SVM_CTRL1_INTERCEPT_INOUT_BITMAP RT_BIT(27) |
|---|
| 315 |
|
|---|
| 316 |
#define SVM_CTRL1_INTERCEPT_MSR_SHADOW RT_BIT(28) |
|---|
| 317 |
|
|---|
| 318 |
#define SVM_CTRL1_INTERCEPT_TASK_SWITCH RT_BIT(29) |
|---|
| 319 |
|
|---|
| 320 |
#define SVM_CTRL1_INTERCEPT_FERR_FREEZE RT_BIT(30) |
|---|
| 321 |
|
|---|
| 322 |
#define SVM_CTRL1_INTERCEPT_SHUTDOWN RT_BIT(31) |
|---|
| 323 |
|
|---|
| 324 |
|
|---|
| 325 |
|
|---|
| 326 |
|
|---|
| 327 |
|
|---|
| 328 |
|
|---|
| 329 |
|
|---|
| 330 |
#define SVM_CTRL2_INTERCEPT_VMRUN RT_BIT(0) |
|---|
| 331 |
|
|---|
| 332 |
#define SVM_CTRL2_INTERCEPT_VMMCALL RT_BIT(1) |
|---|
| 333 |
|
|---|
| 334 |
#define SVM_CTRL2_INTERCEPT_VMLOAD RT_BIT(2) |
|---|
| 335 |
|
|---|
| 336 |
#define SVM_CTRL2_INTERCEPT_VMSAVE RT_BIT(3) |
|---|
| 337 |
|
|---|
| 338 |
#define SVM_CTRL2_INTERCEPT_STGI RT_BIT(4) |
|---|
| 339 |
|
|---|
| 340 |
#define SVM_CTRL2_INTERCEPT_CLGI RT_BIT(5) |
|---|
| 341 |
|
|---|
| 342 |
#define SVM_CTRL2_INTERCEPT_SKINIT RT_BIT(6) |
|---|
| 343 |
|
|---|
| 344 |
#define SVM_CTRL2_INTERCEPT_RDTSCP RT_BIT(7) |
|---|
| 345 |
|
|---|
| 346 |
#define SVM_CTRL2_INTERCEPT_ICEBP RT_BIT(8) |
|---|
| 347 |
|
|---|
| 348 |
#define SVM_CTRL2_INTERCEPT_WBINVD RT_BIT(9) |
|---|
| 349 |
|
|---|
| 350 |
#define SVM_CTRL2_INTERCEPT_MONITOR RT_BIT(10) |
|---|
| 351 |
|
|---|
| 352 |
#define SVM_CTRL2_INTERCEPT_MWAIT_UNCOND RT_BIT(11) |
|---|
| 353 |
|
|---|
| 354 |
#define SVM_CTRL2_INTERCEPT_MWAIT_ARMED RT_BIT(12) |
|---|
| 355 |
|
|---|
| 356 |
|
|---|
| 357 |
|
|---|
| 358 |
|
|---|
| 359 |
|
|---|
| 360 |
#define SVM_NESTED_PAGING_ENABLE RT_BIT(0) |
|---|
| 361 |
|
|---|
| 362 |
|
|---|
| 363 |
|
|---|
| 364 |
|
|---|
| 365 |
|
|---|
| 366 |
#define SVM_INTERRUPT_SHADOW_ACTIVE RT_BIT(0) |
|---|
| 367 |
|
|---|
| 368 |
|
|---|
| 369 |
|
|---|
| 370 |
|
|---|
| 371 |
|
|---|
| 372 |
|
|---|
| 373 |
|
|---|
| 374 |
#define SVM_EVENT_EXTERNAL_IRQ 0 |
|---|
| 375 |
|
|---|
| 376 |
#define SVM_EVENT_NMI 2 |
|---|
| 377 |
|
|---|
| 378 |
#define SVM_EVENT_EXCEPTION 3 |
|---|
| 379 |
|
|---|
| 380 |
#define SVM_EVENT_SOFTWARE_INT 4 |
|---|
| 381 |
|
|---|
| 382 |
|
|---|
| 383 |
|
|---|
| 384 |
|
|---|
| 385 |
|
|---|
| 386 |
|
|---|
| 387 |
|
|---|
| 388 |
|
|---|
| 389 |
#pragma pack(1) |
|---|
| 390 |
typedef struct |
|---|
| 391 |
{ |
|---|
| 392 |
uint16_t u16Sel; |
|---|
| 393 |
uint16_t u16Attr; |
|---|
| 394 |
uint32_t u32Limit; |
|---|
| 395 |
uint64_t u64Base; |
|---|
| 396 |
} SVMSEL; |
|---|
| 397 |
#pragma pack() |
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 |
|
|---|
| 401 |
|
|---|
| 402 |
#pragma pack(1) |
|---|
| 403 |
typedef struct |
|---|
| 404 |
{ |
|---|
| 405 |
uint16_t u16Reserved1; |
|---|
| 406 |
uint16_t u16Reserved2; |
|---|
| 407 |
uint32_t u32Limit; |
|---|
| 408 |
uint64_t u64Base; |
|---|
| 409 |
} SVMGDTR; |
|---|
| 410 |
#pragma pack() |
|---|
| 411 |
|
|---|
| 412 |
typedef SVMGDTR SVMIDTR; |
|---|
| 413 |
|
|---|
| 414 |
|
|---|
| 415 |
|
|---|
| 416 |
|
|---|
| 417 |
#pragma pack(1) |
|---|
| 418 |
typedef union |
|---|
| 419 |
{ |
|---|
| 420 |
struct |
|---|
| 421 |
{ |
|---|
| 422 |
uint32_t u8Vector : 8; |
|---|
| 423 |
uint32_t u3Type : 3; |
|---|
| 424 |
uint32_t u1ErrorCodeValid : 1; |
|---|
| 425 |
uint32_t u19Reserved : 19; |
|---|
| 426 |
uint32_t u1Valid : 1; |
|---|
| 427 |
uint32_t u32ErrorCode : 32; |
|---|
| 428 |
} n; |
|---|
| 429 |
uint64_t au64[1]; |
|---|
| 430 |
} SVM_EVENT; |
|---|
| 431 |
#pragma pack() |
|---|
| 432 |
|
|---|
| 433 |
|
|---|
| 434 |
|
|---|
| 435 |
|
|---|
| 436 |
|
|---|
| 437 |
#pragma pack(1) |
|---|
| 438 |
typedef union |
|---|
| 439 |
{ |
|---|
| 440 |
struct |
|---|
| 441 |
{ |
|---|
| 442 |
uint32_t u8VTPR : 8; |
|---|
| 443 |
uint32_t u1VIrqValid : 1; |
|---|
| 444 |
uint32_t u7Reserved : 7; |
|---|
| 445 |
uint32_t u4VIrqPriority : 4; |
|---|
| 446 |
uint32_t u1IgnoreTPR : 1; |
|---|
| 447 |
uint32_t u3Reserved : 3; |
|---|
| 448 |
uint32_t u1VIrqMasking : 1; |
|---|
| 449 |
uint32_t u7Reserved2 : 7; |
|---|
| 450 |
uint32_t u8VIrqVector : 8; |
|---|
| 451 |
uint32_t u24Reserved : 24; |
|---|
| 452 |
} n; |
|---|
| 453 |
uint64_t au64[1]; |
|---|
| 454 |
} SVM_INTCTRL; |
|---|
| 455 |
#pragma pack() |
|---|
| 456 |
|
|---|
| 457 |
|
|---|
| 458 |
|
|---|
| 459 |
|
|---|
| 460 |
|
|---|
| 461 |
#pragma pack(1) |
|---|
| 462 |
typedef union |
|---|
| 463 |
{ |
|---|
| 464 |
struct |
|---|
| 465 |
{ |
|---|
| 466 |
uint32_t u32ASID : 32; |
|---|
| 467 |
uint32_t u1TLBFlush : 1; |
|---|
| 468 |
uint32_t u7Reserved : 7; |
|---|
| 469 |
uint32_t u24Reserved : 24; |
|---|
| 470 |
} n; |
|---|
| 471 |
uint64_t au64[1]; |
|---|
| 472 |
} SVM_TLBCTRL; |
|---|
| 473 |
#pragma pack() |
|---|
| 474 |
|
|---|
| 475 |
|
|---|
| 476 |
|
|---|
| 477 |
|
|---|
| 478 |
|
|---|
| 479 |
#pragma pack(1) |
|---|
| 480 |
typedef union |
|---|
| 481 |
{ |
|---|
| 482 |
struct |
|---|
| 483 |
{ |
|---|
| 484 |
uint32_t u1Type : 1; |
|---|
| 485 |
uint32_t u1Reserved : 1; |
|---|
| 486 |
uint32_t u1STR : 1; |
|---|
| 487 |
uint32_t u1REP : 1; |
|---|
| 488 |
uint32_t u1OP8 : 1; |
|---|
| 489 |
uint32_t u1OP16 : 1; |
|---|
| 490 |
uint32_t u1OP32 : 1; |
|---|
| 491 |
uint32_t u1ADDR16 : 1; |
|---|
| 492 |
uint32_t u1ADDR32 : 1; |
|---|
| 493 |
uint32_t u1ADDR64 : 1; |
|---|
| 494 |
uint32_t u6Reserved : 6; |
|---|
| 495 |
uint32_t u16Port : 16; |
|---|
| 496 |
} n; |
|---|
| 497 |
uint32_t au32[1]; |
|---|
| 498 |
} SVM_IOIO_EXIT; |
|---|
| 499 |
#pragma pack() |
|---|
| 500 |
|
|---|
| 501 |
|
|---|
| 502 |
|
|---|
| 503 |
|
|---|
| 504 |
#pragma pack(1) |
|---|
| 505 |
typedef union |
|---|
| 506 |
{ |
|---|
| 507 |
struct |
|---|
| 508 |
{ |
|---|
| 509 |
uint32_t u1NestedPaging : 1; |
|---|
| 510 |
} n; |
|---|
| 511 |
uint64_t au64[1]; |
|---|
| 512 |
} SVM_NPCTRL; |
|---|
| 513 |
#pragma pack() |
|---|
| 514 |
|
|---|
| 515 |
|
|---|
| 516 |
|
|---|
| 517 |
|
|---|
| 518 |
#pragma pack(1) |
|---|
| 519 |
typedef struct _SVM_VMCB |
|---|
| 520 |
{ |
|---|
| 521 |
|
|---|
| 522 |
struct |
|---|
| 523 |
{ |
|---|
| 524 |
|
|---|
| 525 |
uint16_t u16InterceptRdCRx; |
|---|
| 526 |
|
|---|
| 527 |
uint16_t u16InterceptWrCRx; |
|---|
| 528 |
|
|---|
| 529 |
uint16_t u16InterceptRdDRx; |
|---|
| 530 |
|
|---|
| 531 |
uint16_t u16InterceptWrDRx; |
|---|
| 532 |
|
|---|
| 533 |
uint32_t u32InterceptException; |
|---|
| 534 |
|
|---|
| 535 |
uint32_t u32InterceptCtrl1; |
|---|
| 536 |
|
|---|
| 537 |
uint32_t u32InterceptCtrl2; |
|---|
| 538 |
|
|---|
| 539 |
uint8_t u8Reserved[0x40-0x14]; |
|---|
| 540 |
|
|---|
| 541 |
uint64_t u64IOPMPhysAddr; |
|---|
| 542 |
|
|---|
| 543 |
uint64_t u64MSRPMPhysAddr; |
|---|
| 544 |
|
|---|
| 545 |
uint64_t u64TSCOffset; |
|---|
| 546 |
|
|---|
| 547 |
SVM_TLBCTRL TLBCtrl; |
|---|
| 548 |
|
|---|
| 549 |
SVM_INTCTRL IntCtrl; |
|---|
| 550 |
|
|---|
| 551 |
uint64_t u64IntShadow; |
|---|
| 552 |
|
|---|
| 553 |
uint64_t u64ExitCode; |
|---|
| 554 |
|
|---|
| 555 |
uint64_t u64ExitInfo1; |
|---|
| 556 |
|
|---|
| 557 |
uint64_t u64ExitInfo2; |
|---|
| 558 |
|
|---|
| 559 |
SVM_EVENT ExitIntInfo; |
|---|
| 560 |
|
|---|
| 561 |
SVM_NPCTRL NestedPaging; |
|---|
| 562 |
|
|---|
| 563 |
uint8_t u8Reserved2[0xA8-0x98]; |
|---|
| 564 |
|
|---|
| 565 |
SVM_EVENT EventInject; |
|---|
| 566 |
|
|---|
| 567 |
uint64_t u64NestedPagingCR3; |
|---|
| 568 |
|
|---|
| 569 |
uint64_t u64LBRVirt; |
|---|
| 570 |
} ctrl; |
|---|
| 571 |
|
|---|
| 572 |
|
|---|
| 573 |
uint8_t u8Reserved3[0x400-0xC0]; |
|---|
| 574 |
|
|---|
| 575 |
|
|---|
| 576 |
struct |
|---|
| 577 |
{ |
|---|
| 578 |
|
|---|
| 579 |
SVMSEL ES; |
|---|
| 580 |
|
|---|
| 581 |
SVMSEL CS; |
|---|
| 582 |
|
|---|
| 583 |
SVMSEL SS; |
|---|
| 584 |
|
|---|
| 585 |
SVMSEL DS; |
|---|
| 586 |
|
|---|
| 587 |
SVMSEL FS; |
|---|
| 588 |
|
|---|
| 589 |
SVMSEL GS; |
|---|
| 590 |
|
|---|
| 591 |
SVMGDTR GDTR; |
|---|
| 592 |
|
|---|
| 593 |
SVMSEL LDTR; |
|---|
| 594 |
|
|---|
| 595 |
SVMIDTR IDTR; |
|---|
| 596 |
|
|---|
| 597 |
SVMSEL TR; |
|---|
| 598 |
|
|---|
| 599 |
uint8_t u8Reserved4[0x4CB-0x4A0]; |
|---|
| 600 |
|
|---|
| 601 |
uint8_t u8CPL; |
|---|
| 602 |
|
|---|
| 603 |
uint8_t u8Reserved5[0x4D0-0x4CC]; |
|---|
| 604 |
|
|---|
| 605 |
uint64_t u64EFER; |
|---|
| 606 |
|
|---|
| 607 |
uint8_t u8Reserved6[0x548-0x4D8]; |
|---|
| 608 |
|
|---|
| 609 |
uint64_t u64CR4; |
|---|
| 610 |
|
|---|
| 611 |
uint64_t u64CR3; |
|---|
| 612 |
|
|---|
| 613 |
uint64_t u64CR0; |
|---|
| 614 |
|
|---|
| 615 |
uint64_t u64DR7; |
|---|
| 616 |
|
|---|
| 617 |
uint64_t u64DR6; |
|---|
| 618 |
|
|---|
| 619 |
uint64_t u64RFlags; |
|---|
| 620 |
|
|---|
| 621 |
uint64_t u64RIP; |
|---|
| 622 |
|
|---|
| 623 |
uint8_t u8Reserved7[0x5D8-0x580]; |
|---|
| 624 |
|
|---|
| 625 |
uint64_t u64RSP; |
|---|
| 626 |
|
|---|
| 627 |
uint8_t u8Reserved8[0x5F8-0x5E0]; |
|---|
| 628 |
|
|---|
| 629 |
uint64_t u64RAX; |
|---|
| 630 |
|
|---|
| 631 |
uint64_t u64STAR; |
|---|
| 632 |
|
|---|
| 633 |
uint64_t u64LSTAR; |
|---|
| 634 |
|
|---|
| 635 |
uint64_t u64CSTAR; |
|---|
| 636 |
|
|---|
| 637 |
uint64_t u64SFMASK; |
|---|
| 638 |
|
|---|
| 639 |
uint64_t u64KernelGSBase; |
|---|
| 640 |
|
|---|
| 641 |
uint64_t u64SysEnterCS; |
|---|
| 642 |
|
|---|
| 643 |
uint64_t u64SysEnterESP; |
|---|
| 644 |
|
|---|
| 645 |
uint64_t u64SysEnterEIP; |
|---|
| 646 |
|
|---|
| 647 |
uint64_t u64CR2; |
|---|
| 648 |
|
|---|
| 649 |
uint8_t u8Reserved9[0x668-0x648]; |
|---|
| 650 |
|
|---|
| 651 |
uint64_t u64GPAT; |
|---|
| 652 |
|
|---|
| 653 |
uint64_t u64DBGCTL; |
|---|
| 654 |
|
|---|
| 655 |
uint64_t u64BR_FROM; |
|---|
| 656 |
|
|---|
| 657 |
uint64_t u64BR_TO; |
|---|
| 658 |
|
|---|
| 659 |
uint64_t u64LASTEXCPFROM; |
|---|
| 660 |
|
|---|
| 661 |
uint64_t u64LASTEXCPTO; |
|---|
| 662 |
} guest; |
|---|
| 663 |
|
|---|
| 664 |
|
|---|
| 665 |
uint8_t u8Reserved10[0x1000-0x698]; |
|---|
| 666 |
} SVM_VMCB; |
|---|
| 667 |
#pragma pack() |
|---|
| 668 |
|
|---|
| 669 |
|
|---|
| 670 |
|
|---|
| 671 |
|
|---|
| 672 |
|
|---|
| 673 |
|
|---|
| 674 |
|
|---|
| 675 |
|
|---|
| 676 |
|
|---|
| 677 |
|
|---|
| 678 |
DECLASM(int) SVMVMRun(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx); |
|---|
| 679 |
|
|---|
| 680 |
|
|---|
| 681 |
|
|---|
| 682 |
|
|---|
| 683 |
|
|---|
| 684 |
|
|---|
| 685 |
|
|---|
| 686 |
|
|---|
| 687 |
|
|---|
| 688 |
DECLASM(int) SVMVMRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx); |
|---|
| 689 |
|
|---|
| 690 |
|
|---|
| 691 |
|
|---|
| 692 |
|
|---|
| 693 |
|
|---|
| 694 |
|
|---|
| 695 |
|
|---|
| 696 |
DECLASM(void) SVMInvlpgA(RTGCPTR pPageGC, uint32_t u32ASID); |
|---|
| 697 |
|
|---|
| 698 |
#ifdef IN_RING0 |
|---|
| 699 |
VMMR0DECL(int) SVMR0InvalidatePage(PVM pVM, PVMCPU pVCpu, RTGCPTR GCVirt); |
|---|
| 700 |
VMMR0DECL(int) SVMR0InvalidatePhysPage(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys); |
|---|
| 701 |
#endif |
|---|
| 702 |
|
|---|
| 703 |
|
|---|
| 704 |
|
|---|
| 705 |
#endif |
|---|
| 706 |
|
|---|