Changeset 92356 in vbox
- Timestamp:
- Nov 11, 2021 10:57:57 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/include/NEMInternal.h
r92177 r92356 31 31 #include <iprt/nt/hyperv.h> 32 32 #include <iprt/critsect.h> 33 #elif defined(RT_OS_DARWIN) 34 # include "VMXInternal.h" 33 35 #endif 34 36 … … 111 113 112 114 #endif /* RT_OS_WINDOWS */ 115 116 117 #ifdef RT_OS_DARWIN 118 /** vCPU ID declaration to avoid dragging in HV headers here. */ 119 typedef unsigned hv_vcpuid_t; 120 /** The HV VM memory space ID (ASID). */ 121 typedef unsigned hv_vm_space_t; 122 123 124 /** @name Darwin: Our two-bit physical page state for PGMPAGE 125 * @{ */ 126 # define NEM_DARWIN_PAGE_STATE_NOT_SET 0 127 # define NEM_DARWIN_PAGE_STATE_UNMAPPED 1 128 # define NEM_DARWIN_PAGE_STATE_READABLE 2 129 # define NEM_DARWIN_PAGE_STATE_WRITABLE 3 130 /** @} */ 131 132 /** The CPUMCTX_EXTRN_XXX mask for IEM. */ 133 # define NEM_DARWIN_CPUMCTX_EXTRN_MASK_FOR_IEM ( IEM_CPUMCTX_EXTRN_MUST_MASK | CPUMCTX_EXTRN_NEM_WIN_INHIBIT_INT \ 134 | CPUMCTX_EXTRN_NEM_WIN_INHIBIT_NMI ) 135 /** The CPUMCTX_EXTRN_XXX mask for IEM when raising exceptions. */ 136 # define NEM_DARWIN_CPUMCTX_EXTRN_MASK_FOR_IEM_XCPT (IEM_CPUMCTX_EXTRN_XCPT_MASK | NEM_DARWIN_CPUMCTX_EXTRN_MASK_FOR_IEM) 137 138 #endif 113 139 114 140 … … 247 273 uint64_t cPagesInUse; 248 274 } R0Stats; 275 #elif defined(RT_OS_DARWIN) 276 /** Set if we've created the EMTs. */ 277 bool fCreatedEmts : 1; 278 /** Set if hv_vm_create() was called successfully. */ 279 bool fCreatedVm : 1; 280 /** Number of currently mapped pages. */ 281 uint32_t volatile cMappedPages; 282 STAMCOUNTER StatMapPage; 283 STAMCOUNTER StatUnmapPage; 284 STAMCOUNTER StatMapPageFailed; 285 STAMCOUNTER StatUnmapPageFailed; 249 286 #endif /* RT_OS_WINDOWS */ 250 287 } NEM; … … 372 409 STAMCOUNTER StatQueryCpuTick; 373 410 /** @} */ 374 #endif /* RT_OS_WINDOWS */ 411 #elif defined(RT_OS_DARWIN) 412 /** The vCPU handle associated with the EMT executing this vCPU. */ 413 hv_vcpuid_t hVCpuId; 414 415 /** @name State shared with the VT-x code. 416 * @{ */ 417 /** Whether we should use the debug loop because of single stepping or special 418 * debug breakpoints / events are armed. */ 419 bool fUseDebugLoop; 420 /** Whether we're executing a single instruction. */ 421 bool fSingleInstruction; 422 423 bool afAlignment0[2]; 424 425 /** An additional error code used for some gurus. */ 426 uint32_t u32HMError; 427 /** The last exit-to-ring-3 reason. */ 428 int32_t rcLastExitToR3; 429 /** CPU-context changed flags (see HM_CHANGED_xxx). */ 430 uint64_t fCtxChanged; 431 432 /** The guest VMCS information. */ 433 VMXVMCSINFO VmcsInfo; 434 435 /** VT-x data. */ 436 struct HMCPUVMX 437 { 438 /** @name Guest information. 439 * @{ */ 440 /** Guest VMCS information shared with ring-3. */ 441 VMXVMCSINFOSHARED VmcsInfo; 442 /** Nested-guest VMCS information shared with ring-3. */ 443 VMXVMCSINFOSHARED VmcsInfoNstGst; 444 /** Whether the nested-guest VMCS was the last current VMCS (shadow copy for ring-3). 445 * @see HMR0PERVCPU::vmx.fSwitchedToNstGstVmcs */ 446 bool fSwitchedToNstGstVmcsCopyForRing3; 447 /** Whether the static guest VMCS controls has been merged with the 448 * nested-guest VMCS controls. */ 449 bool fMergedNstGstCtls; 450 /** Whether the nested-guest VMCS has been copied to the shadow VMCS. */ 451 bool fCopiedNstGstToShadowVmcs; 452 /** Whether flushing the TLB is required due to switching to/from the 453 * nested-guest. */ 454 bool fSwitchedNstGstFlushTlb; 455 /** Alignment. */ 456 bool afAlignment0[4]; 457 /** Cached guest APIC-base MSR for identifying when to map the APIC-access page. */ 458 uint64_t u64GstMsrApicBase; 459 /** @} */ 460 461 /** @name Error reporting and diagnostics. 462 * @{ */ 463 /** VT-x error-reporting (mainly for ring-3 propagation). */ 464 struct 465 { 466 RTCPUID idCurrentCpu; 467 RTCPUID idEnteredCpu; 468 RTHCPHYS HCPhysCurrentVmcs; 469 uint32_t u32VmcsRev; 470 uint32_t u32InstrError; 471 uint32_t u32ExitReason; 472 uint32_t u32GuestIntrState; 473 } LastError; 474 /** @} */ 475 } vmx; 476 477 /** Event injection state. */ 478 HMEVENT Event; 479 480 /** Current shadow paging mode for updating CR4. 481 * @todo move later (@bugref{9217}). */ 482 PGMMODE enmShadowMode; 483 uint32_t u32TemporaryPadding; 484 485 /** The PAE PDPEs used with Nested Paging (only valid when 486 * VMCPU_FF_HM_UPDATE_PAE_PDPES is set). */ 487 X86PDPE aPdpes[4]; 488 /** Pointer to the VMX statistics. */ 489 PVMXSTATISTICS pVmxStats; 490 491 /** @name Statistics 492 * @{ */ 493 STAMCOUNTER StatBreakOnCancel; 494 STAMCOUNTER StatBreakOnFFPre; 495 STAMCOUNTER StatBreakOnFFPost; 496 STAMCOUNTER StatBreakOnStatus; 497 STAMCOUNTER StatImportOnDemand; 498 STAMCOUNTER StatImportOnReturn; 499 STAMCOUNTER StatImportOnReturnSkipped; 500 STAMCOUNTER StatQueryCpuTick; 501 /** @} */ 502 503 /** @} */ 504 #endif /* RT_OS_DARWIN */ 375 505 } NEMCPU; 376 506 /** Pointer to NEM VMCPU instance data. */
Note:
See TracChangeset
for help on using the changeset viewer.