VirtualBox

Changeset 80274 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 14, 2019 2:34:38 PM (5 years ago)
Author:
vboxsync
Message:

VMM: Refactoring VMMR0/* and VMMRZ/* to use VMCC & VMMCPUCC. bugref:9217

Location:
trunk/src/VBox/VMM
Files:
28 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/NEMAllNativeTemplate-win.cpp.h

    r80268 r80274  
    8787*   Internal Functions                                                                                                           *
    8888*********************************************************************************************************************************/
    89 NEM_TMPL_STATIC int nemHCNativeSetPhysPage(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhysSrc, RTGCPHYS GCPhysDst,
     89NEM_TMPL_STATIC int nemHCNativeSetPhysPage(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhysSrc, RTGCPHYS GCPhysDst,
    9090                                           uint32_t fPageProt, uint8_t *pu2State, bool fBackingChanged);
    9191
     
    105105 * @param   fFlags      HV_MAP_GPA_XXX.
    106106 */
    107 DECLINLINE(int) nemHCWinHypercallMapPage(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhysSrc, RTGCPHYS GCPhysDst, uint32_t fFlags)
     107DECLINLINE(int) nemHCWinHypercallMapPage(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhysSrc, RTGCPHYS GCPhysDst, uint32_t fFlags)
    108108{
    109109#ifdef IN_RING0
     
    133133 * @param   GCPhys      The page to unmap.  Does not need to be page aligned.
    134134 */
    135 DECLINLINE(int) nemHCWinHypercallUnmapPage(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys)
     135DECLINLINE(int) nemHCWinHypercallUnmapPage(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys)
    136136{
    137137# ifdef IN_RING0
     
    149149#ifndef IN_RING0
    150150
    151 NEM_TMPL_STATIC int nemHCWinCopyStateToHyperV(PVM pVM, PVMCPU pVCpu)
     151NEM_TMPL_STATIC int nemHCWinCopyStateToHyperV(PVMCC pVM, PVMCPUCC pVCpu)
    152152{
    153153# if defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS) || defined(NEM_WIN_WITH_RING0_RUNLOOP)
     
    483483
    484484
    485 NEM_TMPL_STATIC int nemHCWinCopyStateFromHyperV(PVM pVM, PVMCPU pVCpu, uint64_t fWhat)
     485NEM_TMPL_STATIC int nemHCWinCopyStateFromHyperV(PVMCC pVM, PVMCPUCC pVCpu, uint64_t fWhat)
    486486{
    487487# if defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS) || defined(NEM_WIN_WITH_RING0_RUNLOOP)
     
    11251125 * @param   fWhat       What to import, CPUMCTX_EXTRN_XXX.
    11261126 */
    1127 VMM_INT_DECL(int) NEMImportStateOnDemand(PVMCPU pVCpu, uint64_t fWhat)
     1127VMM_INT_DECL(int) NEMImportStateOnDemand(PVMCPUCC pVCpu, uint64_t fWhat)
    11281128{
    11291129    STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatImportOnDemand);
     
    11321132# ifdef NEM_WIN_WITH_RING0_RUNLOOP
    11331133    /** @todo improve and secure this translation */
     1134#  ifdef VBOX_BUGREF_9217
     1135    return nemR0WinImportState(pVCpu->pGVM, pVCpu, &pVCpu->cpum.GstCtx, fWhat, true /*fCanUpdateCr3*/);
     1136#  else
    11341137    PGVM pGVM = GVMMR0ByHandle(pVCpu->pVMR0->hSelf);
    11351138    AssertReturn(pGVM, VERR_INVALID_VMCPU_HANDLE);
     
    11391142
    11401143    return nemR0WinImportState(pGVM, &pGVM->aCpus[idCpu], &pVCpu->cpum.GstCtx, fWhat, true /*fCanUpdateCr3*/);
     1144#  endif
    11411145# else
    11421146    RT_NOREF(pVCpu, fWhat);
     
    11571161 * @param   puAux       Where to return the TSC_AUX register value.
    11581162 */
    1159 VMM_INT_DECL(int) NEMHCQueryCpuTick(PVMCPU pVCpu, uint64_t *pcTicks, uint32_t *puAux)
     1163VMM_INT_DECL(int) NEMHCQueryCpuTick(PVMCPUCC pVCpu, uint64_t *pcTicks, uint32_t *puAux)
    11601164{
    11611165    STAM_REL_COUNTER_INC(&pVCpu->nem.s.StatQueryCpuTick);
    11621166
    11631167#ifdef IN_RING3
    1164     PVM pVM = pVCpu->CTX_SUFF(pVM);
     1168    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    11651169    VMCPU_ASSERT_EMT_RETURN(pVCpu, VERR_VM_THREAD_NOT_EMT);
    11661170    AssertReturn(VM_IS_NEM_ENABLED(pVM), VERR_NEM_IPE_9);
     
    11981202#else  /* IN_RING0 */
    11991203# ifdef NEM_WIN_WITH_RING0_RUNLOOP
     1204#  ifdef VBOX_BUGREF_9217
     1205    int rc = nemR0WinQueryCpuTick(pVCpu->pGVM, pVCpu, pcTicks, puAux);
     1206#  else
    12001207    /** @todo improve and secure this translation */
    12011208    PGVM pGVM = GVMMR0ByHandle(pVCpu->pVMR0->hSelf);
     
    12041211    ASMCompilerBarrier();
    12051212    AssertReturn(idCpu < pGVM->cCpus, VERR_INVALID_VMCPU_HANDLE);
    1206 
    12071213    int rc = nemR0WinQueryCpuTick(pGVM, &pGVM->aCpus[idCpu], pcTicks, puAux);
     1214#  endif
    12081215    if (RT_SUCCESS(rc) && puAux && !(pVCpu->cpum.GstCtx.fExtrn & CPUMCTX_EXTRN_TSC_AUX))
    12091216        *puAux = CPUMGetGuestTscAux(pVCpu);
     
    12271234 * @param   uPausedTscValue The TSC value at the time of pausing.
    12281235 */
    1229 VMM_INT_DECL(int) NEMHCResumeCpuTickOnAll(PVM pVM, PVMCPU pVCpu, uint64_t uPausedTscValue)
     1236VMM_INT_DECL(int) NEMHCResumeCpuTickOnAll(PVMCC pVM, PVMCPUCC pVCpu, uint64_t uPausedTscValue)
    12301237{
    12311238#ifdef IN_RING0
    12321239# ifdef NEM_WIN_WITH_RING0_RUNLOOP
     1240#  ifdef VBOX_BUGREF_9217
     1241    return nemR0WinResumeCpuTickOnAll(pVM, pVCpu, uPausedTscValue);
     1242#  else
    12331243    /** @todo improve and secure this translation */
    12341244    PGVM pGVM = GVMMR0ByHandle(pVM->hSelf);
     
    12391249
    12401250    return nemR0WinResumeCpuTickOnAll(pGVM, &pGVM->aCpus[idCpu], uPausedTscValue);
     1251#  endif
    12411252# else
    12421253    RT_NOREF(pVM, pVCpu, uPausedTscValue);
     
    12961307# if defined(IN_RING0) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS)
    12971308/** Worker for assertion macro. */
    1298 NEM_TMPL_STATIC int nemHCWinGetRegister(PVMCPU pVCpu, PGVMCPU pGVCpu, uint32_t enmReg, HV_REGISTER_VALUE *pRetValue)
     1309NEM_TMPL_STATIC int nemHCWinGetRegister(PVMCPUCC pVCpu, PGVMCPU pGVCpu, uint32_t enmReg, HV_REGISTER_VALUE *pRetValue)
    12991310{
    13001311    RT_ZERO(*pRetValue);
     
    13361347# else
    13371348/** Worker for assertion macro. */
    1338 NEM_TMPL_STATIC int nemR3WinGetRegister(PVMCPU a_pVCpu, uint32_t a_enmReg, WHV_REGISTER_VALUE pValue)
     1349NEM_TMPL_STATIC int nemR3WinGetRegister(PVMCPUCC a_pVCpu, uint32_t a_enmReg, WHV_REGISTER_VALUE pValue)
    13391350{
    13401351    RT_ZERO(*pRetValue);
     
    13501361 * Get the virtual processor running status.
    13511362 */
    1352 DECLINLINE(VID_PROCESSOR_STATUS) nemHCWinCpuGetRunningStatus(PVMCPU pVCpu)
     1363DECLINLINE(VID_PROCESSOR_STATUS) nemHCWinCpuGetRunningStatus(PVMCPUCC pVCpu)
    13531364{
    13541365# ifdef IN_RING0
     
    13861397 *                          calling EMT.
    13871398 */
    1388 NEM_TMPL_STATIC int nemHCWinCancelRunVirtualProcessor(PVM pVM, PVMCPU pVCpu)
     1399NEM_TMPL_STATIC int nemHCWinCancelRunVirtualProcessor(PVMCC pVM, PVMCPUCC pVCpu)
    13891400{
    13901401    /*
     
    14481459 * Logs the current CPU state.
    14491460 */
    1450 NEM_TMPL_STATIC void nemHCWinLogState(PVM pVM, PVMCPU pVCpu)
     1461NEM_TMPL_STATIC void nemHCWinLogState(PVMCC pVM, PVMCPUCC pVCpu)
    14511462{
    14521463    if (LogIs3Enabled())
     
    15651576 */
    15661577DECLINLINE(void)
    1567 nemHCWinAdvanceGuestRipAndClearRF(PVMCPU pVCpu, HV_X64_INTERCEPT_MESSAGE_HEADER const *pMsgHdr, uint8_t cbMinInstr)
     1578nemHCWinAdvanceGuestRipAndClearRF(PVMCPUCC pVCpu, HV_X64_INTERCEPT_MESSAGE_HEADER const *pMsgHdr, uint8_t cbMinInstr)
    15681579{
    15691580    Assert(!(pVCpu->cpum.GstCtx.fExtrn & (CPUMCTX_EXTRN_RIP | CPUMCTX_EXTRN_RFLAGS)));
     
    15901601 * @param   cbMinInstr      The minimum instruction length, or 1 if not unknown.
    15911602 */
    1592 DECLINLINE(void) nemR3WinAdvanceGuestRipAndClearRF(PVMCPU pVCpu, WHV_VP_EXIT_CONTEXT const *pExitCtx, uint8_t cbMinInstr)
     1603DECLINLINE(void) nemR3WinAdvanceGuestRipAndClearRF(PVMCPUCC pVCpu, WHV_VP_EXIT_CONTEXT const *pExitCtx, uint8_t cbMinInstr)
    15931604{
    15941605    Assert(!(pVCpu->cpum.GstCtx.fExtrn & (CPUMCTX_EXTRN_RIP | CPUMCTX_EXTRN_RFLAGS)));
     
    16101621
    16111622NEM_TMPL_STATIC DECLCALLBACK(int)
    1612 nemHCWinUnmapOnePageCallback(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, uint8_t *pu2NemState, void *pvUser)
     1623nemHCWinUnmapOnePageCallback(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys, uint8_t *pu2NemState, void *pvUser)
    16131624{
    16141625    RT_NOREF_PV(pvUser);
     
    16631674 */
    16641675NEM_TMPL_STATIC DECLCALLBACK(int)
    1665 nemHCWinHandleMemoryAccessPageCheckerCallback(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, PPGMPHYSNEMPAGEINFO pInfo, void *pvUser)
     1676nemHCWinHandleMemoryAccessPageCheckerCallback(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys, PPGMPHYSNEMPAGEINFO pInfo, void *pvUser)
    16661677{
    16671678    NEMHCWINHMACPCCSTATE *pState = (NEMHCWINHMACPCCSTATE *)pvUser;
     
    18481859 * @param   pszCaller       Who is doing the importing.
    18491860 */
    1850 DECLINLINE(VBOXSTRICTRC) nemR0WinImportStateStrict(PGVM pGVM, PGVMCPU pGVCpu, PVMCPU pVCpu, uint64_t fWhat, const char *pszCaller)
     1861DECLINLINE(VBOXSTRICTRC) nemR0WinImportStateStrict(PGVM pGVM, PGVMCPU pGVCpu, PVMCPUCC pVCpu, uint64_t fWhat, const char *pszCaller)
    18511862{
    18521863    int rc = nemR0WinImportState(pGVM, pGVCpu, &pVCpu->cpum.GstCtx, fWhat, true /*fCanUpdateCr3*/);
     
    18791890 * @param   pszCaller       Who is doing the importing.
    18801891 */
    1881 DECLINLINE(VBOXSTRICTRC) nemHCWinImportStateIfNeededStrict(PVMCPU pVCpu, PGVMCPU pGVCpu, uint64_t fWhat, const char *pszCaller)
     1892DECLINLINE(VBOXSTRICTRC) nemHCWinImportStateIfNeededStrict(PVMCPUCC pVCpu, PGVMCPU pGVCpu, uint64_t fWhat, const char *pszCaller)
    18821893{
    18831894    if (pVCpu->cpum.GstCtx.fExtrn & fWhat)
     
    19051916 * @sa      nemR3WinCopyStateFromX64Header
    19061917 */
    1907 DECLINLINE(void) nemHCWinCopyStateFromX64Header(PVMCPU pVCpu, HV_X64_INTERCEPT_MESSAGE_HEADER const *pHdr)
     1918DECLINLINE(void) nemHCWinCopyStateFromX64Header(PVMCPUCC pVCpu, HV_X64_INTERCEPT_MESSAGE_HEADER const *pHdr)
    19081919{
    19091920    Assert(   (pVCpu->cpum.GstCtx.fExtrn & (CPUMCTX_EXTRN_RIP | CPUMCTX_EXTRN_RFLAGS | CPUMCTX_EXTRN_CS | CPUMCTX_EXTRN_NEM_WIN_INHIBIT_INT))
     
    19361947 * @sa      nemHCWinCopyStateFromX64Header
    19371948 */
    1938 DECLINLINE(void) nemR3WinCopyStateFromX64Header(PVMCPU pVCpu, WHV_VP_EXIT_CONTEXT const *pExitCtx)
     1949DECLINLINE(void) nemR3WinCopyStateFromX64Header(PVMCPUCC pVCpu, WHV_VP_EXIT_CONTEXT const *pExitCtx)
    19391950{
    19401951    Assert(   (pVCpu->cpum.GstCtx.fExtrn & (CPUMCTX_EXTRN_RIP | CPUMCTX_EXTRN_RFLAGS | CPUMCTX_EXTRN_CS | CPUMCTX_EXTRN_NEM_WIN_INHIBIT_INT))
     
    19721983 */
    19731984NEM_TMPL_STATIC VBOXSTRICTRC
    1974 nemHCWinHandleMessageMemory(PVM pVM, PVMCPU pVCpu, HV_X64_MEMORY_INTERCEPT_MESSAGE const *pMsg, PGVMCPU pGVCpu)
     1985nemHCWinHandleMessageMemory(PVMCC pVM, PVMCPUCC pVCpu, HV_X64_MEMORY_INTERCEPT_MESSAGE const *pMsg, PGVMCPU pGVCpu)
    19751986{
    19761987    uint64_t const uHostTsc = ASMReadTSC();
     
    20982109 */
    20992110NEM_TMPL_STATIC VBOXSTRICTRC
    2100 nemR3WinHandleExitMemory(PVM pVM, PVMCPU pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
     2111nemR3WinHandleExitMemory(PVMCC pVM, PVMCPUCC pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
    21012112{
    21022113    uint64_t const uHostTsc = ASMReadTSC();
     
    21962207 */
    21972208NEM_TMPL_STATIC VBOXSTRICTRC
    2198 nemHCWinHandleMessageIoPort(PVM pVM, PVMCPU pVCpu, HV_X64_IO_PORT_INTERCEPT_MESSAGE const *pMsg, PGVMCPU pGVCpu)
     2209nemHCWinHandleMessageIoPort(PVMCC pVM, PVMCPUCC pVCpu, HV_X64_IO_PORT_INTERCEPT_MESSAGE const *pMsg, PGVMCPU pGVCpu)
    21992210{
    22002211    /*
     
    24112422 * @sa      nemHCWinHandleMessageIoPort
    24122423 */
    2413 NEM_TMPL_STATIC VBOXSTRICTRC nemR3WinHandleExitIoPort(PVM pVM, PVMCPU pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
     2424NEM_TMPL_STATIC VBOXSTRICTRC nemR3WinHandleExitIoPort(PVMCC pVM, PVMCPUCC pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
    24142425{
    24152426    Assert(   pExit->IoPortAccess.AccessInfo.AccessSize == 1
     
    25792590 */
    25802591NEM_TMPL_STATIC VBOXSTRICTRC
    2581 nemHCWinHandleMessageInterruptWindow(PVM pVM, PVMCPU pVCpu, HV_X64_INTERRUPT_WINDOW_MESSAGE const *pMsg, PGVMCPU pGVCpu)
     2592nemHCWinHandleMessageInterruptWindow(PVMCC pVM, PVMCPUCC pVCpu, HV_X64_INTERRUPT_WINDOW_MESSAGE const *pMsg, PGVMCPU pGVCpu)
    25822593{
    25832594    /*
     
    26142625 * @sa      nemHCWinHandleMessageInterruptWindow
    26152626 */
    2616 NEM_TMPL_STATIC VBOXSTRICTRC nemR3WinHandleExitInterruptWindow(PVM pVM, PVMCPU pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
     2627NEM_TMPL_STATIC VBOXSTRICTRC nemR3WinHandleExitInterruptWindow(PVMCC pVM, PVMCPUCC pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
    26172628{
    26182629    /*
     
    26532664 * @sa      nemR3WinHandleExitCpuId
    26542665 */
    2655 NEM_TMPL_STATIC VBOXSTRICTRC nemHCWinHandleMessageCpuId(PVM pVM, PVMCPU pVCpu, HV_X64_CPUID_INTERCEPT_MESSAGE const *pMsg,
     2666NEM_TMPL_STATIC VBOXSTRICTRC nemHCWinHandleMessageCpuId(PVMCC pVM, PVMCPUCC pVCpu, HV_X64_CPUID_INTERCEPT_MESSAGE const *pMsg,
    26562667                                                        PGVMCPU pGVCpu)
    26572668{
     
    27452756 */
    27462757NEM_TMPL_STATIC VBOXSTRICTRC
    2747 nemR3WinHandleExitCpuId(PVM pVM, PVMCPU pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
     2758nemR3WinHandleExitCpuId(PVMCC pVM, PVMCPUCC pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
    27482759{
    27492760    PCEMEXITREC pExitRec = EMHistoryAddExit(pVCpu, EMEXIT_MAKE_FT(EMEXIT_F_KIND_EM, EMEXITTYPE_CPUID),
     
    28202831 * @sa      nemR3WinHandleExitMsr
    28212832 */
    2822 NEM_TMPL_STATIC VBOXSTRICTRC nemHCWinHandleMessageMsr(PVMCPU pVCpu, HV_X64_MSR_INTERCEPT_MESSAGE const *pMsg, PGVMCPU pGVCpu)
     2833NEM_TMPL_STATIC VBOXSTRICTRC nemHCWinHandleMessageMsr(PVMCPUCC pVCpu, HV_X64_MSR_INTERCEPT_MESSAGE const *pMsg, PGVMCPU pGVCpu)
    28232834{
    28242835    /*
     
    29722983 * @sa      nemHCWinHandleMessageMsr
    29732984 */
    2974 NEM_TMPL_STATIC VBOXSTRICTRC nemR3WinHandleExitMsr(PVM pVM, PVMCPU pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
     2985NEM_TMPL_STATIC VBOXSTRICTRC nemR3WinHandleExitMsr(PVMCC pVM, PVMCPUCC pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
    29752986{
    29762987    /*
     
    31683179 */
    31693180DECLINLINE(void)
    3170 nemHCWinCopyStateFromExceptionMessage(PVMCPU pVCpu, HV_X64_EXCEPTION_INTERCEPT_MESSAGE const *pMsg, bool fClearXcpt)
     3181nemHCWinCopyStateFromExceptionMessage(PVMCPUCC pVCpu, HV_X64_EXCEPTION_INTERCEPT_MESSAGE const *pMsg, bool fClearXcpt)
    31713182{
    31723183    nemHCWinCopyStateFromX64Header(pVCpu, &pMsg->Header);
     
    32003211 * @param   fClearXcpt      Clear pending exception.
    32013212 */
    3202 DECLINLINE(void) nemR3WinCopyStateFromExceptionMessage(PVMCPU pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit, bool fClearXcpt)
     3213DECLINLINE(void) nemR3WinCopyStateFromExceptionMessage(PVMCPUCC pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit, bool fClearXcpt)
    32033214{
    32043215    nemR3WinCopyStateFromX64Header(pVCpu, &pExit->VpContext);
     
    32203231 */
    32213232NEM_TMPL_STATIC VBOXSTRICTRC
    3222 nemHCWinHandleMessageException(PVMCPU pVCpu, HV_X64_EXCEPTION_INTERCEPT_MESSAGE const *pMsg, PGVMCPU pGVCpu)
     3233nemHCWinHandleMessageException(PVMCPUCC pVCpu, HV_X64_EXCEPTION_INTERCEPT_MESSAGE const *pMsg, PGVMCPU pGVCpu)
    32233234{
    32243235    /*
     
    33473358 * @sa      nemR3WinHandleExitException
    33483359 */
    3349 NEM_TMPL_STATIC VBOXSTRICTRC nemR3WinHandleExitException(PVM pVM, PVMCPU pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
     3360NEM_TMPL_STATIC VBOXSTRICTRC nemR3WinHandleExitException(PVMCC pVM, PVMCPUCC pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
    33503361{
    33513362    /*
     
    34563467 */
    34573468NEM_TMPL_STATIC VBOXSTRICTRC
    3458 nemHCWinHandleMessageUnrecoverableException(PVMCPU pVCpu, HV_X64_INTERCEPT_MESSAGE_HEADER const *pMsgHdr, PGVMCPU pGVCpu)
     3469nemHCWinHandleMessageUnrecoverableException(PVMCPUCC pVCpu, HV_X64_INTERCEPT_MESSAGE_HEADER const *pMsgHdr, PGVMCPU pGVCpu)
    34593470{
    34603471    /* Check message register value sanity. */
     
    35143525 * @sa      nemHCWinHandleMessageUnrecoverableException
    35153526 */
    3516 NEM_TMPL_STATIC VBOXSTRICTRC nemR3WinHandleExitUnrecoverableException(PVM pVM, PVMCPU pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
     3527NEM_TMPL_STATIC VBOXSTRICTRC nemR3WinHandleExitUnrecoverableException(PVMCC pVM, PVMCPUCC pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
    35173528{
    35183529# if 0
     
    35743585 */
    35753586NEM_TMPL_STATIC VBOXSTRICTRC
    3576 nemHCWinHandleMessage(PVM pVM, PVMCPU pVCpu, VID_MESSAGE_MAPPING_HEADER volatile *pMappingHeader, PGVMCPU pGVCpu)
     3587nemHCWinHandleMessage(PVMCC pVM, PVMCPUCC pVCpu, VID_MESSAGE_MAPPING_HEADER volatile *pMappingHeader, PGVMCPU pGVCpu)
    35773588{
    35783589    if (pMappingHeader->enmVidMsgType == VidMessageHypervisorMessage)
     
    36683679 * @sa      nemHCWinHandleMessage
    36693680 */
    3670 NEM_TMPL_STATIC VBOXSTRICTRC nemR3WinHandleExit(PVM pVM, PVMCPU pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
     3681NEM_TMPL_STATIC VBOXSTRICTRC nemR3WinHandleExit(PVMCC pVM, PVMCPUCC pVCpu, WHV_RUN_VP_EXIT_CONTEXT const *pExit)
    36713682{
    36723683    switch (pExit->ExitReason)
     
    37383749 * @param   cMillies        The timeout in milliseconds
    37393750 */
    3740 static NTSTATUS nemR0NtPerformIoCtlMessageSlotHandleAndGetNext(PGVM pGVM, PGVMCPU pGVCpu, PVMCPU pVCpu,
     3751static NTSTATUS nemR0NtPerformIoCtlMessageSlotHandleAndGetNext(PGVM pGVM, PGVMCPU pGVCpu, PVMCPUCC pVCpu,
    37413752                                                               uint32_t fFlags, uint32_t cMillies)
    37423753{
     
    37443755    pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.fFlags   = fFlags;
    37453756    pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.cMillies = cMillies;
    3746     NTSTATUS rcNt = nemR0NtPerformIoControl(pGVM, pGVM->nemr0.s.IoCtlMessageSlotHandleAndGetNext.uFunction,
     3757    NTSTATUS rcNt = nemR0NtPerformIoControl(pGVM, pVCpu, pGVM->nemr0.s.IoCtlMessageSlotHandleAndGetNext.uFunction,
    37473758                                            &pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext,
    37483759                                            pGVM->nemr0.s.IoCtlMessageSlotHandleAndGetNext.cbInput,
     
    37683779        pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.fFlags   = fFlags & ~VID_MSHAGN_F_HANDLE_MESSAGE;
    37693780        pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.cMillies = cMillies;
    3770         rcNt = nemR0NtPerformIoControl(pGVM, pGVM->nemr0.s.IoCtlMessageSlotHandleAndGetNext.uFunction,
     3781        rcNt = nemR0NtPerformIoControl(pGVM, pVCpu, pGVM->nemr0.s.IoCtlMessageSlotHandleAndGetNext.uFunction,
    37713782                                       &pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext,
    37723783                                       pGVM->nemr0.s.IoCtlMessageSlotHandleAndGetNext.cbInput,
     
    37983809 * @param   pGVCpu          The global (ring-0) per CPU structure (NULL in r3).
    37993810 */
    3800 NEM_TMPL_STATIC VBOXSTRICTRC nemHCWinStopCpu(PVM pVM, PVMCPU pVCpu, VBOXSTRICTRC rcStrict,
     3811NEM_TMPL_STATIC VBOXSTRICTRC nemHCWinStopCpu(PVMCC pVM, PVMCPUCC pVCpu, VBOXSTRICTRC rcStrict,
    38013812                                             VID_MESSAGE_MAPPING_HEADER volatile *pMappingHeader,
    38023813                                             PGVM pGVM, PGVMCPU pGVCpu)
     
    38133824# ifdef IN_RING0
    38143825    pVCpu->nem.s.uIoCtlBuf.idCpu = pGVCpu->idCpu;
    3815     NTSTATUS rcNt = nemR0NtPerformIoControl(pGVM, pGVM->nemr0.s.IoCtlStopVirtualProcessor.uFunction,
     3826    NTSTATUS rcNt = nemR0NtPerformIoControl(pGVM, pVCpu, pGVM->nemr0.s.IoCtlStopVirtualProcessor.uFunction,
    38163827                                            &pVCpu->nem.s.uIoCtlBuf.idCpu, sizeof(pVCpu->nem.s.uIoCtlBuf.idCpu),
    38173828                                            NULL, 0);
     
    39513962 * @param   pfInterruptWindows  Where to return interrupt window flags.
    39523963 */
    3953 NEM_TMPL_STATIC VBOXSTRICTRC nemHCWinHandleInterruptFF(PVM pVM, PVMCPU pVCpu, PGVMCPU pGVCpu, uint8_t *pfInterruptWindows)
     3964NEM_TMPL_STATIC VBOXSTRICTRC nemHCWinHandleInterruptFF(PVMCC pVM, PVMCPUCC pVCpu, PGVMCPU pGVCpu, uint8_t *pfInterruptWindows)
    39543965{
    39553966    Assert(!TRPMHasTrap(pVCpu));
     
    40594070 * @param   pGVCpu          The ring-0 per CPU structure (NULL in ring-3).
    40604071 */
    4061 NEM_TMPL_STATIC VBOXSTRICTRC nemHCWinRunGC(PVM pVM, PVMCPU pVCpu, PGVM pGVM, PGVMCPU pGVCpu)
     4072NEM_TMPL_STATIC VBOXSTRICTRC nemHCWinRunGC(PVMCC pVM, PVMCPUCC pVCpu, PGVM pGVM, PGVMCPU pGVCpu)
    40624073{
    40634074    LogFlow(("NEM/%u: %04x:%08RX64 efl=%#08RX64 <=\n", pVCpu->idCpu, pVCpu->cpum.GstCtx.cs.Sel, pVCpu->cpum.GstCtx.rip, pVCpu->cpum.GstCtx.rflags));
     
    41984209#  ifdef IN_RING0
    41994210                pVCpu->nem.s.uIoCtlBuf.idCpu = pGVCpu->idCpu;
    4200                 NTSTATUS rcNt = nemR0NtPerformIoControl(pGVM, pGVM->nemr0.s.IoCtlStartVirtualProcessor.uFunction,
     4211                NTSTATUS rcNt = nemR0NtPerformIoControl(pGVM, pVCpu, pGVM->nemr0.s.IoCtlStartVirtualProcessor.uFunction,
    42014212                                                        &pVCpu->nem.s.uIoCtlBuf.idCpu, sizeof(pVCpu->nem.s.uIoCtlBuf.idCpu),
    42024213                                                        NULL, 0);
     
    42354246                pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.fFlags   = pVCpu->nem.s.fHandleAndGetFlags;
    42364247                pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext.cMillies = cMsWait;
    4237                 NTSTATUS rcNt = nemR0NtPerformIoControl(pGVM, pGVM->nemr0.s.IoCtlMessageSlotHandleAndGetNext.uFunction,
     4248                NTSTATUS rcNt = nemR0NtPerformIoControl(pGVM, pVCpu, pGVM->nemr0.s.IoCtlMessageSlotHandleAndGetNext.uFunction,
    42384249                                                        &pVCpu->nem.s.uIoCtlBuf.MsgSlotHandleAndGetNext,
    42394250                                                        pGVM->nemr0.s.IoCtlMessageSlotHandleAndGetNext.cbInput,
     
    44124423 * @callback_method_impl{FNPGMPHYSNEMCHECKPAGE}
    44134424 */
    4414 NEM_TMPL_STATIC DECLCALLBACK(int) nemHCWinUnsetForA20CheckerCallback(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys,
     4425NEM_TMPL_STATIC DECLCALLBACK(int) nemHCWinUnsetForA20CheckerCallback(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys,
    44154426                                                                     PPGMPHYSNEMPAGEINFO pInfo, void *pvUser)
    44164427{
     
    44564467 * @param   GCPhys          The page to unmap.
    44574468 */
    4458 NEM_TMPL_STATIC int nemHCWinUnmapPageForA20Gate(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys)
     4469NEM_TMPL_STATIC int nemHCWinUnmapPageForA20Gate(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhys)
    44594470{
    44604471    PGMPHYSNEMPAGEINFO Info;
     
    44644475
    44654476
    4466 void nemHCNativeNotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb)
     4477void nemHCNativeNotifyHandlerPhysicalRegister(PVMCC pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb)
    44674478{
    44684479    Log5(("nemHCNativeNotifyHandlerPhysicalRegister: %RGp LB %RGp enmKind=%d\n", GCPhys, cb, enmKind));
     
    44714482
    44724483
    4473 void nemHCNativeNotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb,
     4484void nemHCNativeNotifyHandlerPhysicalDeregister(PVMCC pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb,
    44744485                                                int fRestoreAsRAM, bool fRestoreAsRAM2)
    44754486{
     
    44804491
    44814492
    4482 void nemHCNativeNotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld,
     4493void nemHCNativeNotifyHandlerPhysicalModify(PVMCC pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld,
    44834494                                            RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fRestoreAsRAM)
    44844495{
     
    45074518 * @thread  EMT(pVCpu)
    45084519 */
    4509 NEM_TMPL_STATIC int nemHCNativeSetPhysPage(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhysSrc, RTGCPHYS GCPhysDst,
     4520NEM_TMPL_STATIC int nemHCNativeSetPhysPage(PVMCC pVM, PVMCPUCC pVCpu, RTGCPHYS GCPhysSrc, RTGCPHYS GCPhysDst,
    45104521                                           uint32_t fPageProt, uint8_t *pu2State, bool fBackingChanged)
    45114522{
     
    47274738
    47284739
    4729 NEM_TMPL_STATIC int nemHCJustUnmapPageFromHyperV(PVM pVM, RTGCPHYS GCPhysDst, uint8_t *pu2State)
     4740NEM_TMPL_STATIC int nemHCJustUnmapPageFromHyperV(PVMCC pVM, RTGCPHYS GCPhysDst, uint8_t *pu2State)
    47304741{
    47314742    if (*pu2State <= NEM_WIN_PAGE_STATE_UNMAPPED)
     
    47374748
    47384749#if defined(NEM_WIN_USE_HYPERCALLS_FOR_PAGES) || defined(IN_RING0)
    4739     PVMCPU pVCpu = VMMGetCpu(pVM);
     4750    PVMCPUCC pVCpu = VMMGetCpu(pVM);
    47404751    int rc = nemHCWinHypercallUnmapPage(pVM, pVCpu, GCPhysDst);
    47414752    AssertRC(rc);
     
    47654776
    47664777
    4767 int nemHCNativeNotifyPhysPageAllocated(PVM pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint32_t fPageProt,
     4778int nemHCNativeNotifyPhysPageAllocated(PVMCC pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint32_t fPageProt,
    47684779                                       PGMPAGETYPE enmType, uint8_t *pu2State)
    47694780{
     
    47744785    int rc;
    47754786#if defined(NEM_WIN_USE_HYPERCALLS_FOR_PAGES) || defined(IN_RING0)
    4776     PVMCPU pVCpu = VMMGetCpu(pVM);
     4787    PVMCPUCC pVCpu = VMMGetCpu(pVM);
    47774788    if (   pVM->nem.s.fA20Enabled
    47784789        || !NEM_WIN_IS_RELEVANT_TO_A20(GCPhys))
     
    48004811
    48014812
    4802 void nemHCNativeNotifyPhysPageProtChanged(PVM pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint32_t fPageProt,
     4813void nemHCNativeNotifyPhysPageProtChanged(PVMCC pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint32_t fPageProt,
    48034814                                          PGMPAGETYPE enmType, uint8_t *pu2State)
    48044815{
     
    48084819
    48094820#if defined(NEM_WIN_USE_HYPERCALLS_FOR_PAGES) || defined(IN_RING0)
    4810     PVMCPU pVCpu = VMMGetCpu(pVM);
     4821    PVMCPUCC pVCpu = VMMGetCpu(pVM);
    48114822    if (   pVM->nem.s.fA20Enabled
    48124823        || !NEM_WIN_IS_RELEVANT_TO_A20(GCPhys))
     
    48314842
    48324843
    4833 void nemHCNativeNotifyPhysPageChanged(PVM pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhysPrev, RTHCPHYS HCPhysNew,
     4844void nemHCNativeNotifyPhysPageChanged(PVMCC pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhysPrev, RTHCPHYS HCPhysNew,
    48344845                                     uint32_t fPageProt, PGMPAGETYPE enmType, uint8_t *pu2State)
    48354846{
     
    48394850
    48404851#if defined(NEM_WIN_USE_HYPERCALLS_FOR_PAGES) || defined(IN_RING0)
    4841     PVMCPU pVCpu = VMMGetCpu(pVM);
     4852    PVMCPUCC pVCpu = VMMGetCpu(pVM);
    48424853    if (   pVM->nem.s.fA20Enabled
    48434854        || !NEM_WIN_IS_RELEVANT_TO_A20(GCPhys))
  • trunk/src/VBox/VMM/VMMR0/CPUMR0.cpp

    r80064 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_CPUM
    2324#include <VBox/vmm/cpum.h>
    2425#include "CPUMInternal.h"
    25 #include <VBox/vmm/vm.h>
     26#include <VBox/vmm/vmcc.h>
    2627#include <VBox/vmm/gvm.h>
    2728#include <VBox/err.h>
     
    102103static void cpumR0UnmapLocalApics(void);
    103104#endif
    104 static int  cpumR0SaveHostDebugState(PVMCPU pVCpu);
     105static int  cpumR0SaveHostDebugState(PVMCPUCC pVCpu);
    105106
    106107
     
    145146static DECLCALLBACK(void) cpumR0CheckCpuid(RTCPUID idCpu, void *pvUser1, void *pvUser2)
    146147{
    147     PVM     pVM   = (PVM)pvUser1;
     148    PVMCC     pVM   = (PVMCC)pvUser1;
    148149
    149150    NOREF(idCpu); NOREF(pvUser2);
     
    183184 * @param   pVM         The cross context VM structure.
    184185 */
    185 VMMR0_INT_DECL(int) CPUMR0InitVM(PVM pVM)
     186VMMR0_INT_DECL(int) CPUMR0InitVM(PVMCC pVM)
    186187{
    187188    LogFlow(("CPUMR0Init: %p\n", pVM));
     
    297298
    298299                if (pVM->cpum.s.GuestFeatures.fArchCap)
    299                     for (VMCPUID i = 0; i < pVM->cCpus; i++)
    300                         pVM->aCpus[i].cpum.s.GuestMsrs.msr.ArchCaps = fArchVal;
     300                    VMCC_FOR_EACH_VMCPU_STMT(pVM, pVCpu->cpum.s.GuestMsrs.msr.ArchCaps = fArchVal);
    301301            }
    302302            else
     
    347347    if (u32DR7 & X86_DR7_ENABLED_MASK)
    348348    {
    349 #ifdef VBOX_BUGREF_9217
    350         PGVM pGVM = (PGVM)pVM;
    351         for (VMCPUID i = 0; i < pGVM->cCpusSafe; i++)
    352             pGVM->aCpus[i].cpum.s.fUseFlags |= CPUM_USE_DEBUG_REGS_HOST;
    353 #else
    354         for (VMCPUID i = 0; i < pVM->cCpus; i++)
    355             pVM->aCpus[i].cpum.s.fUseFlags |= CPUM_USE_DEBUG_REGS_HOST;
    356 #endif
     349        VMCC_FOR_EACH_VMCPU_STMT(pVM, pVCpu->cpum.s.fUseFlags |= CPUM_USE_DEBUG_REGS_HOST);
    357350        Log(("CPUMR0Init: host uses debug registers (dr7=%x)\n", u32DR7));
    358351    }
     
    374367 * @param   pVCpu       The cross context virtual CPU structure.
    375368 */
    376 VMMR0_INT_DECL(int) CPUMR0Trap07Handler(PVM pVM, PVMCPU pVCpu)
     369VMMR0_INT_DECL(int) CPUMR0Trap07Handler(PVMCC pVM, PVMCPUCC pVCpu)
    377370{
    378371    Assert(pVM->cpum.s.HostFeatures.fFxSaveRstor);
     
    436429 * @param   pVCpu   The cross context virtual CPU structure.
    437430 */
    438 VMMR0_INT_DECL(int) CPUMR0LoadGuestFPU(PVM pVM, PVMCPU pVCpu)
     431VMMR0_INT_DECL(int) CPUMR0LoadGuestFPU(PVMCC pVM, PVMCPUCC pVCpu)
    439432{
    440433    int rc;
     
    480473 * @param   pVCpu       The cross context virtual CPU structure.
    481474 */
    482 VMMR0_INT_DECL(bool) CPUMR0FpuStateMaybeSaveGuestAndRestoreHost(PVMCPU pVCpu)
     475VMMR0_INT_DECL(bool) CPUMR0FpuStateMaybeSaveGuestAndRestoreHost(PVMCPUCC pVCpu)
    483476{
    484477    bool fSavedGuest;
     
    523516 * @param   pVCpu       The cross context virtual CPU structure.
    524517 */
    525 static int cpumR0SaveHostDebugState(PVMCPU pVCpu)
     518static int cpumR0SaveHostDebugState(PVMCPUCC pVCpu)
    526519{
    527520    /*
     
    564557 * @thread  EMT(pVCpu)
    565558 */
    566 VMMR0_INT_DECL(bool) CPUMR0DebugStateMaybeSaveGuestAndRestoreHost(PVMCPU pVCpu, bool fDr6)
     559VMMR0_INT_DECL(bool) CPUMR0DebugStateMaybeSaveGuestAndRestoreHost(PVMCPUCC pVCpu, bool fDr6)
    567560{
    568561    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    623616 * @thread  EMT(pVCpu)
    624617 */
    625 VMMR0_INT_DECL(bool) CPUMR0DebugStateMaybeSaveGuest(PVMCPU pVCpu, bool fDr6)
     618VMMR0_INT_DECL(bool) CPUMR0DebugStateMaybeSaveGuest(PVMCPUCC pVCpu, bool fDr6)
    626619{
    627620    /*
     
    650643 * @thread  EMT(pVCpu)
    651644 */
    652 VMMR0_INT_DECL(void) CPUMR0LoadGuestDebugState(PVMCPU pVCpu, bool fDr6)
     645VMMR0_INT_DECL(void) CPUMR0LoadGuestDebugState(PVMCPUCC pVCpu, bool fDr6)
    653646{
    654647    /*
     
    681674 * @thread  EMT(pVCpu)
    682675 */
    683 VMMR0_INT_DECL(void) CPUMR0LoadHyperDebugState(PVMCPU pVCpu, bool fDr6)
     676VMMR0_INT_DECL(void) CPUMR0LoadHyperDebugState(PVMCPUCC pVCpu, bool fDr6)
    684677{
    685678    /*
     
    944937 * @param   iHostCpuSet The CPU set index of the current host CPU.
    945938 */
    946 VMMR0_INT_DECL(void) CPUMR0SetLApic(PVMCPU pVCpu, uint32_t iHostCpuSet)
     939VMMR0_INT_DECL(void) CPUMR0SetLApic(PVMCPUCC pVCpu, uint32_t iHostCpuSet)
    947940{
    948941    Assert(iHostCpuSet <= RT_ELEMENTS(g_aLApics));
  • trunk/src/VBox/VMM/VMMR0/EMR0.cpp

    r78431 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_EM
    2324#include <VBox/vmm/em.h>
    2425#include "EMInternal.h"
    25 #include <VBox/vmm/vm.h>
     26#include <VBox/vmm/vmcc.h>
    2627#include <VBox/vmm/gvm.h>
    2728#include <iprt/errcore.h>
     
    4142#ifdef VBOX_BUGREF_9217
    4243VMMR0_INT_DECL(int) EMR0InitVM(PGVM pGVM)
    43 # define pVM pGVM /* temp hack */
    4444#else
    45 VMMR0_INT_DECL(int) EMR0InitVM(PGVM pGVM, PVM pVM)
     45VMMR0_INT_DECL(int) EMR0InitVM(PGVM pGVM, PVMCC pVM)
    4646#endif
    4747{
     
    4949     * Override ring-0 exit optimizations settings.
    5050     */
    51     bool fEnabledR0                = pVM->aCpus[0].em.s.fExitOptimizationEnabled
    52                                   && pVM->aCpus[0].em.s.fExitOptimizationEnabledR0
     51#ifdef VBOX_BUGREF_9217
     52    PVMCPUCC pVCpu0 = &pGVM->aCpus[0];
     53#else
     54    PVMCPUCC pVCpu0 = VMCC_GET_CPU_0(pVM);
     55#endif
     56
     57    bool fEnabledR0                = pVCpu0->em.s.fExitOptimizationEnabled
     58                                  && pVCpu0->em.s.fExitOptimizationEnabledR0
    5359                                  && (RTThreadPreemptIsPossible() || RTThreadPreemptIsPendingTrusty());
    5460    bool fEnabledR0PreemptDisabled = fEnabledR0
    55                                   && pVM->aCpus[0].em.s.fExitOptimizationEnabledR0PreemptDisabled
     61                                  && pVCpu0->em.s.fExitOptimizationEnabledR0PreemptDisabled
    5662                                  && RTThreadPreemptIsPendingTrusty();
     63    for (VMCPUID idCpu = 0; idCpu < pGVM->cCpus; idCpu++)
     64    {
    5765#ifdef VBOX_BUGREF_9217
    58     for (VMCPUID i = 0; i < pGVM->cCpusSafe; i++)
     66        PVMCPUCC pVCpu = &pGVM->aCpus[idCpu];
    5967#else
    60     for (VMCPUID i = 0; i < pGVM->cCpus; i++)
     68        PVMCPUCC pVCpu = VMCC_GET_CPU(pVM, idCpu);
    6169#endif
    62     {
    63         pVM->aCpus[i].em.s.fExitOptimizationEnabledR0                = fEnabledR0;
    64         pVM->aCpus[i].em.s.fExitOptimizationEnabledR0PreemptDisabled = fEnabledR0PreemptDisabled;
     70        pVCpu->em.s.fExitOptimizationEnabledR0                = fEnabledR0;
     71        pVCpu->em.s.fExitOptimizationEnabledR0PreemptDisabled = fEnabledR0PreemptDisabled;
    6572    }
    6673
  • trunk/src/VBox/VMM/VMMR0/GIMR0.cpp

    r76553 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_GIM
    2324#include <VBox/vmm/gim.h>
    2425#include "GIMInternal.h"
    2526#include "GIMHvInternal.h"
    26 #include <VBox/vmm/vm.h>
     27#include <VBox/vmm/vmcc.h>
    2728
    2829#include <VBox/err.h>
     
    3536 * @param   pVM     The cross context VM structure.
    3637 */
    37 VMMR0_INT_DECL(int) GIMR0InitVM(PVM pVM)
     38VMMR0_INT_DECL(int) GIMR0InitVM(PVMCC pVM)
    3839{
    3940    if (!GIMIsEnabled(pVM))
     
    6162 * @param   pVM     The cross context VM structure.
    6263 */
    63 VMMR0_INT_DECL(int) GIMR0TermVM(PVM pVM)
     64VMMR0_INT_DECL(int) GIMR0TermVM(PVMCC pVM)
    6465{
    6566    if (!GIMIsEnabled(pVM))
     
    9798 * @thread EMT(pVCpu)
    9899 */
    99 VMMR0_INT_DECL(int) GIMR0UpdateParavirtTsc(PVM pVM, uint64_t u64Offset)
     100VMMR0_INT_DECL(int) GIMR0UpdateParavirtTsc(PVMCC pVM, uint64_t u64Offset)
    100101{
    101102    switch (pVM->gim.s.enmProviderId)
  • trunk/src/VBox/VMM/VMMR0/GIMR0Hv.cpp

    r76553 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_GIM
    2324#include <VBox/vmm/gim.h>
     
    2526#include "GIMInternal.h"
    2627#include "GIMHvInternal.h"
    27 #include <VBox/vmm/vm.h>
     28#include <VBox/vmm/vmcc.h>
    2829
    2930#include <VBox/err.h>
     
    9394 * @thread  EMT.
    9495 */
    95 VMM_INT_DECL(int) gimR0HvUpdateParavirtTsc(PVM pVM, uint64_t u64Offset)
     96VMM_INT_DECL(int) gimR0HvUpdateParavirtTsc(PVMCC pVM, uint64_t u64Offset)
    9697{
    9798    Assert(GIMIsEnabled(pVM));
     
    150151 * @param   pVM     The cross context VM structure.
    151152 */
    152 VMMR0_INT_DECL(int) gimR0HvInitVM(PVM pVM)
     153VMMR0_INT_DECL(int) gimR0HvInitVM(PVMCC pVM)
    153154{
    154155    AssertPtr(pVM);
     
    169170 * @param   pVM     The cross context VM structure.
    170171 */
    171 VMMR0_INT_DECL(int) gimR0HvTermVM(PVM pVM)
     172VMMR0_INT_DECL(int) gimR0HvTermVM(PVMCC pVM)
    172173{
    173174    AssertPtr(pVM);
  • trunk/src/VBox/VMM/VMMR0/GIMR0Kvm.cpp

    r76553 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_GIM
    2324#include <VBox/vmm/gim.h>
     
    2526#include "GIMInternal.h"
    2627#include "GIMKvmInternal.h"
    27 #include <VBox/vmm/vm.h>
     28#include <VBox/vmm/vmcc.h>
    2829
    2930#include <VBox/err.h>
     
    4142 * @remarks Can be called with preemption disabled!
    4243 */
    43 VMM_INT_DECL(int) gimR0KvmUpdateSystemTime(PVM pVM, PVMCPU pVCpu)
     44VMM_INT_DECL(int) gimR0KvmUpdateSystemTime(PVMCC pVM, PVMCPUCC pVCpu)
    4445{
    4546    /*
     
    6566     */
    6667    RTSpinlockAcquire(pKvm->hSpinlockR0);
    67     for (uint32_t i = 0; i < pVM->cCpus; i++)
     68    for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
    6869    {
    69         PGIMKVMCPU pKvmCpu = &pVM->aCpus[i].gim.s.u.KvmCpu;
     70        PGIMKVMCPU pKvmCpu = &VMCC_GET_CPU(pVM, idCpu)->gim.s.u.KvmCpu;
    7071        if (   !pKvmCpu->uTsc
    7172            && !pKvmCpu->uVirtNanoTS)
     
    8788 * @param   pVM     The cross context VM structure.
    8889 */
    89 VMMR0_INT_DECL(int) gimR0KvmInitVM(PVM pVM)
     90VMMR0_INT_DECL(int) gimR0KvmInitVM(PVMCC pVM)
    9091{
    9192    AssertPtr(pVM);
     
    106107 * @param   pVM     The cross context VM structure.
    107108 */
    108 VMMR0_INT_DECL(int) gimR0KvmTermVM(PVM pVM)
     109VMMR0_INT_DECL(int) gimR0KvmTermVM(PVMCC pVM)
    109110{
    110111    AssertPtr(pVM);
  • trunk/src/VBox/VMM/VMMR0/GMMR0.cpp

    r76553 r80274  
    150150*   Header Files                                                                                                                 *
    151151*********************************************************************************************************************************/
     152#define VBOX_BUGREF_9217_PART_I
    152153#define LOG_GROUP LOG_GROUP_GMM
    153154#include <VBox/rawpci.h>
    154 #include <VBox/vmm/vm.h>
    155155#include <VBox/vmm/gmm.h>
    156156#include "GMMR0Internal.h"
    157 #include <VBox/vmm/gvm.h>
     157#include <VBox/vmm/vmcc.h>
    158158#include <VBox/vmm/pgm.h>
    159159#include <VBox/log.h>
     
    12261226GMMR0DECL(void) GMMR0CleanupVM(PGVM pGVM)
    12271227{
     1228#ifdef VBOX_BUGREF_9217
     1229    LogFlow(("GMMR0CleanupVM: pGVM=%p:{.hSelf=%#x}\n", pGVM, pGVM->hSelf));
     1230#else
    12281231    LogFlow(("GMMR0CleanupVM: pGVM=%p:{.pVM=%p, .hSelf=%#x}\n", pGVM, pGVM->pVM, pGVM->hSelf));
     1232#endif
    12291233
    12301234    PGMM pGMM;
     
    15541558 * @thread  The creator thread / EMT(0).
    15551559 */
    1556 GMMR0DECL(int) GMMR0InitialReservation(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint64_t cBasePages, uint32_t cShadowPages,
     1560GMMR0DECL(int) GMMR0InitialReservation(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, uint64_t cBasePages, uint32_t cShadowPages,
    15571561                                       uint32_t cFixedPages, GMMOCPOLICY enmPolicy, GMMPRIORITY enmPriority)
    15581562{
     
    16241628 * @param   pReq            Pointer to the request packet.
    16251629 */
    1626 GMMR0DECL(int) GMMR0InitialReservationReq(PGVM pGVM, PVM pVM, VMCPUID idCpu, PGMMINITIALRESERVATIONREQ pReq)
     1630GMMR0DECL(int) GMMR0InitialReservationReq(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, PGMMINITIALRESERVATIONREQ pReq)
    16271631{
    16281632    /*
     
    16551659 * @thread  EMT(idCpu)
    16561660 */
    1657 GMMR0DECL(int) GMMR0UpdateReservation(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint64_t cBasePages,
     1661GMMR0DECL(int) GMMR0UpdateReservation(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, uint64_t cBasePages,
    16581662                                      uint32_t cShadowPages, uint32_t cFixedPages)
    16591663{
     
    17211725 * @param   pReq            Pointer to the request packet.
    17221726 */
    1723 GMMR0DECL(int) GMMR0UpdateReservationReq(PGVM pGVM, PVM pVM, VMCPUID idCpu, PGMMUPDATERESERVATIONREQ pReq)
     1727GMMR0DECL(int) GMMR0UpdateReservationReq(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, PGMMUPDATERESERVATIONREQ pReq)
    17241728{
    17251729    /*
     
    27382742 * @thread  EMT(idCpu)
    27392743 */
    2740 GMMR0DECL(int) GMMR0AllocateHandyPages(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint32_t cPagesToUpdate,
     2744GMMR0DECL(int) GMMR0AllocateHandyPages(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, uint32_t cPagesToUpdate,
    27412745                                       uint32_t cPagesToAlloc, PGMMPAGEDESC paPages)
    27422746{
     
    29362940 * @thread  EMT.
    29372941 */
    2938 GMMR0DECL(int) GMMR0AllocatePages(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint32_t cPages, PGMMPAGEDESC paPages, GMMACCOUNT enmAccount)
     2942GMMR0DECL(int) GMMR0AllocatePages(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, uint32_t cPages, PGMMPAGEDESC paPages, GMMACCOUNT enmAccount)
    29392943{
    29402944    LogFlow(("GMMR0AllocatePages: pGVM=%p pVM=%p cPages=%#x paPages=%p enmAccount=%d\n", pGVM, pVM, cPages, paPages, enmAccount));
     
    29963000 * @param   pReq        Pointer to the request packet.
    29973001 */
    2998 GMMR0DECL(int) GMMR0AllocatePagesReq(PGVM pGVM, PVM pVM, VMCPUID idCpu, PGMMALLOCATEPAGESREQ pReq)
     3002GMMR0DECL(int) GMMR0AllocatePagesReq(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, PGMMALLOCATEPAGESREQ pReq)
    29993003{
    30003004    /*
     
    30343038 * @param   pHCPhys     Where to return the host physical address of the page.
    30353039 */
    3036 GMMR0DECL(int)  GMMR0AllocateLargePage(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint32_t cbPage, uint32_t *pIdPage, RTHCPHYS *pHCPhys)
     3040GMMR0DECL(int)  GMMR0AllocateLargePage(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, uint32_t cbPage, uint32_t *pIdPage, RTHCPHYS *pHCPhys)
    30373041{
    30383042    LogFlow(("GMMR0AllocateLargePage: pGVM=%p pVM=%p cbPage=%x\n", pGVM, pVM, cbPage));
     
    31393143 * @param   idPage      The large page id.
    31403144 */
    3141 GMMR0DECL(int)  GMMR0FreeLargePage(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint32_t idPage)
     3145GMMR0DECL(int)  GMMR0FreeLargePage(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, uint32_t idPage)
    31423146{
    31433147    LogFlow(("GMMR0FreeLargePage: pGVM=%p pVM=%p idPage=%x\n", pGVM, pVM, idPage));
     
    32063210 * @param   pReq        Pointer to the request packet.
    32073211 */
    3208 GMMR0DECL(int) GMMR0FreeLargePageReq(PGVM pGVM, PVM pVM, VMCPUID idCpu, PGMMFREELARGEPAGEREQ pReq)
     3212GMMR0DECL(int) GMMR0FreeLargePageReq(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, PGMMFREELARGEPAGEREQ pReq)
    32093213{
    32103214    /*
     
    35713575 * @thread  EMT.
    35723576 */
    3573 GMMR0DECL(int) GMMR0FreePages(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint32_t cPages, PGMMFREEPAGEDESC paPages, GMMACCOUNT enmAccount)
     3577GMMR0DECL(int) GMMR0FreePages(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, uint32_t cPages, PGMMFREEPAGEDESC paPages, GMMACCOUNT enmAccount)
    35743578{
    35753579    LogFlow(("GMMR0FreePages: pGVM=%p pVM=%p cPages=%#x paPages=%p enmAccount=%d\n", pGVM, pVM, cPages, paPages, enmAccount));
     
    36193623 * @param   pReq        Pointer to the request packet.
    36203624 */
    3621 GMMR0DECL(int) GMMR0FreePagesReq(PGVM pGVM, PVM pVM, VMCPUID idCpu, PGMMFREEPAGESREQ pReq)
     3625GMMR0DECL(int) GMMR0FreePagesReq(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, PGMMFREEPAGESREQ pReq)
    36223626{
    36233627    /*
     
    36603664 * @thread  EMT(idCpu)
    36613665 */
    3662 GMMR0DECL(int) GMMR0BalloonedPages(PGVM pGVM, PVM pVM, VMCPUID idCpu, GMMBALLOONACTION enmAction, uint32_t cBalloonedPages)
     3666GMMR0DECL(int) GMMR0BalloonedPages(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, GMMBALLOONACTION enmAction, uint32_t cBalloonedPages)
    36633667{
    36643668    LogFlow(("GMMR0BalloonedPages: pGVM=%p pVM=%p enmAction=%d cBalloonedPages=%#x\n",
     
    37893793 * @param   pReq        Pointer to the request packet.
    37903794 */
    3791 GMMR0DECL(int) GMMR0BalloonedPagesReq(PGVM pGVM, PVM pVM, VMCPUID idCpu, PGMMBALLOONEDPAGESREQ pReq)
     3795GMMR0DECL(int) GMMR0BalloonedPagesReq(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, PGMMBALLOONEDPAGESREQ pReq)
    37923796{
    37933797    /*
     
    38463850 * @thread  EMT(idCpu)
    38473851 */
    3848 GMMR0DECL(int) GMMR0QueryMemoryStatsReq(PGVM pGVM, PVM pVM, VMCPUID idCpu, PGMMMEMSTATSREQ pReq)
     3852GMMR0DECL(int) GMMR0QueryMemoryStatsReq(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, PGMMMEMSTATSREQ pReq)
    38493853{
    38503854    /*
     
    41384142 * @thread  EMT ???
    41394143 */
    4140 GMMR0DECL(int) GMMR0MapUnmapChunk(PGVM pGVM, PVM pVM, uint32_t idChunkMap, uint32_t idChunkUnmap, PRTR3PTR ppvR3)
     4144GMMR0DECL(int) GMMR0MapUnmapChunk(PGVM pGVM, PVMCC pVM, uint32_t idChunkMap, uint32_t idChunkUnmap, PRTR3PTR ppvR3)
    41414145{
    41424146    LogFlow(("GMMR0MapUnmapChunk: pGVM=%p pVM=%p idChunkMap=%#x idChunkUnmap=%#x ppvR3=%p\n",
     
    42274231 * @param   pReq        Pointer to the request packet.
    42284232 */
    4229 GMMR0DECL(int)  GMMR0MapUnmapChunkReq(PGVM pGVM, PVM pVM, PGMMMAPUNMAPCHUNKREQ pReq)
     4233GMMR0DECL(int)  GMMR0MapUnmapChunkReq(PGVM pGVM, PVMCC pVM, PGMMMAPUNMAPCHUNKREQ pReq)
    42304234{
    42314235    /*
     
    42514255 * @param   pvR3        Pointer to the chunk size memory block to lock down.
    42524256 */
    4253 GMMR0DECL(int) GMMR0SeedChunk(PGVM pGVM, PVM pVM, VMCPUID idCpu, RTR3PTR pvR3)
     4257GMMR0DECL(int) GMMR0SeedChunk(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, RTR3PTR pvR3)
    42544258{
    42554259    /*
     
    45424546 * @thread  EMT(idCpu)
    45434547 */
    4544 GMMR0DECL(int) GMMR0RegisterSharedModule(PGVM pGVM, PVM pVM, VMCPUID idCpu, VBOXOSFAMILY enmGuestOS, char *pszModuleName,
     4548GMMR0DECL(int) GMMR0RegisterSharedModule(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, VBOXOSFAMILY enmGuestOS, char *pszModuleName,
    45454549                                         char *pszVersion, RTGCPTR GCPtrModBase, uint32_t cbModule,
    45464550                                         uint32_t cRegions, struct VMMDEVSHAREDREGIONDESC const *paRegions)
     
    46834687 * @param   pReq        Pointer to the request packet.
    46844688 */
    4685 GMMR0DECL(int) GMMR0RegisterSharedModuleReq(PGVM pGVM, PVM pVM, VMCPUID idCpu, PGMMREGISTERSHAREDMODULEREQ pReq)
     4689GMMR0DECL(int) GMMR0RegisterSharedModuleReq(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, PGMMREGISTERSHAREDMODULEREQ pReq)
    46864690{
    46874691    /*
     
    47124716 * @param   cbModule        The module size.
    47134717 */
    4714 GMMR0DECL(int) GMMR0UnregisterSharedModule(PGVM pGVM, PVM pVM, VMCPUID idCpu, char *pszModuleName, char *pszVersion,
     4718GMMR0DECL(int) GMMR0UnregisterSharedModule(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, char *pszModuleName, char *pszVersion,
    47154719                                           RTGCPTR GCPtrModBase, uint32_t cbModule)
    47164720{
     
    47794783 * @param   pReq        Pointer to the request packet.
    47804784 */
    4781 GMMR0DECL(int)  GMMR0UnregisterSharedModuleReq(PGVM pGVM, PVM pVM, VMCPUID idCpu, PGMMUNREGISTERSHAREDMODULEREQ pReq)
     4785GMMR0DECL(int)  GMMR0UnregisterSharedModuleReq(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, PGMMUNREGISTERSHAREDMODULEREQ pReq)
    47824786{
    47834787    /*
     
    50855089 * @param   idCpu       The VCPU id.
    50865090 */
    5087 GMMR0DECL(int) GMMR0ResetSharedModules(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     5091GMMR0DECL(int) GMMR0ResetSharedModules(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    50885092{
    50895093#ifdef VBOX_WITH_PAGE_SHARING
     
    51385142         pGblMod->szName, pGblMod->szVersion, pGblMod->Core.Key, pGblMod->cbModule));
    51395143
     5144# ifdef VBOX_BUGREF_9217
     5145    int rc = PGMR0SharedModuleCheck(pArgs->pGVM, pArgs->pGVM, pArgs->idCpu, pGblMod, pRecVM->aRegionsGCPtrs);
     5146#else
    51405147    int rc = PGMR0SharedModuleCheck(pArgs->pGVM->pVM, pArgs->pGVM, pArgs->idCpu, pGblMod, pRecVM->aRegionsGCPtrs);
     5148# endif
    51415149    if (RT_FAILURE(rc))
    51425150        return rc;
     
    51555163 * @thread  EMT(idCpu)
    51565164 */
    5157 GMMR0DECL(int) GMMR0CheckSharedModules(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     5165GMMR0DECL(int) GMMR0CheckSharedModules(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    51585166{
    51595167#ifdef VBOX_WITH_PAGE_SHARING
     
    52565264 * @param   pReq        Pointer to the request packet.
    52575265 */
    5258 GMMR0DECL(int) GMMR0FindDuplicatePageReq(PGVM pGVM, PVM pVM, PGMMFINDDUPLICATEPAGEREQ pReq)
     5266GMMR0DECL(int) GMMR0FindDuplicatePageReq(PGVM pGVM, PVMCC pVM, PGMMFINDDUPLICATEPAGEREQ pReq)
    52595267{
    52605268    /*
     
    53285336 * @param   pVM         The VM structure corresponding to @a pGVM.
    53295337 */
    5330 GMMR0DECL(int) GMMR0QueryStatistics(PGMMSTATS pStats, PSUPDRVSESSION pSession, PGVM pGVM, PVM pVM)
     5338GMMR0DECL(int) GMMR0QueryStatistics(PGMMSTATS pStats, PSUPDRVSESSION pSession, PGVM pGVM, PVMCC pVM)
    53315339{
    53325340    LogFlow(("GVMMR0QueryStatistics: pStats=%p pSession=%p pGVM=%p pVM=%p\n", pStats, pSession, pGVM, pVM));
     
    53945402 * @param   pReq        Pointer to the request packet.
    53955403 */
    5396 GMMR0DECL(int) GMMR0QueryStatisticsReq(PGVM pGVM, PVM pVM, PGMMQUERYSTATISTICSSREQ pReq)
     5404GMMR0DECL(int) GMMR0QueryStatisticsReq(PGVM pGVM, PVMCC pVM, PGMMQUERYSTATISTICSSREQ pReq)
    53975405{
    53985406    /*
     
    54175425 * @param   pVM         The VM structure corresponding to @a pGVM.
    54185426 */
    5419 GMMR0DECL(int) GMMR0ResetStatistics(PCGMMSTATS pStats, PSUPDRVSESSION pSession, PGVM pGVM, PVM pVM)
     5427GMMR0DECL(int) GMMR0ResetStatistics(PCGMMSTATS pStats, PSUPDRVSESSION pSession, PGVM pGVM, PVMCC pVM)
    54205428{
    54215429    NOREF(pStats); NOREF(pSession); NOREF(pVM); NOREF(pGVM);
     
    54335441 * @param   pReq        Pointer to the request packet.
    54345442 */
    5435 GMMR0DECL(int) GMMR0ResetStatisticsReq(PGVM pGVM, PVM pVM, PGMMRESETSTATISTICSSREQ pReq)
     5443GMMR0DECL(int) GMMR0ResetStatisticsReq(PGVM pGVM, PVMCC pVM, PGMMRESETSTATISTICSSREQ pReq)
    54365444{
    54375445    /*
  • trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp

    r80253 r80274  
    5454#include <VBox/vmm/gmm.h>
    5555#include "GVMMR0Internal.h"
    56 #include <VBox/vmm/gvm.h>
    57 #include <VBox/vmm/vm.h>
     56#include <VBox/vmm/vmcc.h>
    5857#include <VBox/vmm/vmcpuset.h>
    5958#include <VBox/vmm/vmm.h>
     
    161160    PGVM                pGVM;
    162161    /** The ring-0 mapping of the shared VM instance data. */
    163     PVM                 pVM;
     162    PVMCC                 pVM;
    164163    /** The virtual machine object. */
    165164    void               *pvObj;
     
    366365#endif
    367366static DECLCALLBACK(void) gvmmR0HandleObjDestructor(void *pvObj, void *pvGVMM, void *pvHandle);
    368 static int gvmmR0ByGVMandVM(PGVM pGVM, PVM pVM, PGVMM *ppGVMM, bool fTakeUsedLock);
    369 static int gvmmR0ByGVMandVMandEMT(PGVM pGVM, PVM pVM, VMCPUID idCpu, PGVMM *ppGVMM);
     367static int gvmmR0ByGVMandVM(PGVM pGVM, PVMCC pVM, PGVMM *ppGVMM, bool fTakeUsedLock);
     368static int gvmmR0ByGVMandVMandEMT(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, PGVMM *ppGVMM);
    370369
    371370#ifdef GVMM_SCHED_WITH_PPT
     
    794793     * Execute it.
    795794     */
    796     PVM pVM;
     795    PVMCC pVM;
    797796    pReq->pVMR0 = NULL;
    798797    pReq->pVMR3 = NIL_RTR3PTR;
     
    819818 * @thread  EMT.
    820819 */
    821 GVMMR0DECL(int) GVMMR0CreateVM(PSUPDRVSESSION pSession, uint32_t cCpus, PVM *ppVM)
     820GVMMR0DECL(int) GVMMR0CreateVM(PSUPDRVSESSION pSession, uint32_t cCpus, PVMCC *ppVM)
    822821{
    823822    LogFlow(("GVMMR0CreateVM: pSession=%p\n", pSession));
     
    959958                                    pGVM->aCpus[i].pVMR3 = pVMR3;
    960959                                    pGVM->apCpusR3[i] = RTR0MemObjAddressR3(pGVM->aCpus[i].gvmm.s.VMCpuMapObj);
     960                                    pGVM->aCpus[i].pVCpuR3 = pGVM->apCpusR3[i];
    961961                                    pGVM->apCpusR0[i] = &pGVM->aCpus[i];
    962962                                    AssertPtr((void *)pGVM->apCpusR3[i]);
     
    10521052                        if (RT_SUCCESS(rc))
    10531053                        {
    1054                             PVM pVM = (PVM)RTR0MemObjAddress(pGVM->gvmm.s.VMMemObj); AssertPtr(pVM);
     1054                            PVMCC pVM = (PVMCC)RTR0MemObjAddress(pGVM->gvmm.s.VMMemObj); AssertPtr(pVM);
    10551055                            memset(pVM, 0, cPages << PAGE_SHIFT);
    10561056                            pVM->enmVMState       = VMSTATE_CREATING;
     
    12191219    /* GVM: */
    12201220    pGVM->u32Magic         = GVM_MAGIC;
    1221     pGVM->hSelfSafe        = hSelf;
    1222     pGVM->cCpusSafe        = cCpus;
    1223     pGVM->pSessionSafe     = pSession;
     1221    pGVM->hSelf            = hSelf;
     1222    pGVM->cCpus            = cCpus;
     1223    pGVM->pSession         = pSession;
    12241224
    12251225    /* VM: */
    12261226    pGVM->enmVMState       = VMSTATE_CREATING;
    1227     pGVM->pVMR0            = pGVM;
    1228     pGVM->pSession         = pSession;
    1229     pGVM->hSelf            = hSelf;
    1230     pGVM->cCpus            = cCpus;
     1227    pGVM->pSessionUnsafe   = pSession;
     1228    pGVM->hSelfUnsafe      = hSelf;
     1229    pGVM->cCpusUnsafe      = cCpus;
    12311230    pGVM->uCpuExecutionCap = 100; /* default is no cap. */
    12321231    pGVM->uStructVersion   = 1;
     
    12501249        pGVM->aCpus[i].idCpu                 = i;
    12511250#ifdef VBOX_BUGREF_9217
    1252         pGVM->aCpus[i].idCpuSafe             = i;
     1251        pGVM->aCpus[i].idCpuUnsafe           = i;
    12531252#endif
    12541253        pGVM->aCpus[i].gvmm.s.HaltEventMulti = NIL_RTSEMEVENTMULTI;
     
    13531352 * @thread  EMT(0) if it's associated with the VM, otherwise any thread.
    13541353 */
    1355 GVMMR0DECL(int) GVMMR0DestroyVM(PGVM pGVM, PVM pVM)
     1354GVMMR0DECL(int) GVMMR0DestroyVM(PGVM pGVM, PVMCC pVM)
    13561355{
    13571356    LogFlow(("GVMMR0DestroyVM: pGVM=%p pVM=%p\n", pGVM, pVM));
     
    14751474
    14761475    AssertCompile(NIL_RTTHREADCTXHOOK == (RTTHREADCTXHOOK)0); /* Depends on zero initialized memory working for NIL at the moment. */
    1477 #ifdef VBOX_BUGREF_9217
    1478     for (VMCPUID idCpu = 0; idCpu < pGVM->cCpusSafe; idCpu++)
    1479 #else
    14801476    for (VMCPUID idCpu = 0; idCpu < pGVM->cCpus; idCpu++)
    1481 #endif
    14821477    {
    14831478        /** @todo Can we busy wait here for all thread-context hooks to be
     
    16831678 * @param   idCpu       VCPU id to register the current thread as.
    16841679 */
    1685 GVMMR0DECL(int) GVMMR0RegisterVCpu(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     1680GVMMR0DECL(int) GVMMR0RegisterVCpu(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    16861681{
    16871682    AssertReturn(idCpu != 0, VERR_INVALID_FUNCTION);
     
    17531748 * @param   idCpu       VCPU id to register the current thread as.
    17541749 */
    1755 GVMMR0DECL(int) GVMMR0DeregisterVCpu(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     1750GVMMR0DECL(int) GVMMR0DeregisterVCpu(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    17561751{
    17571752    AssertReturn(idCpu != 0, VERR_INVALID_FUNCTION);
     
    18561851 * @remark  This will not assert on an invalid pVM but try return silently.
    18571852 */
    1858 static int gvmmR0ByVM(PVM pVM, PGVM *ppGVM, PGVMM *ppGVMM, bool fTakeUsedLock)
     1853static int gvmmR0ByVM(PVMCC pVM, PGVM *ppGVM, PGVMM *ppGVMM, bool fTakeUsedLock)
    18591854{
    18601855    RTPROCESS ProcId = RTProcSelf();
     
    19451940 * @note    Do not use this on pVM structures from userland!
    19461941 */
    1947 GVMMR0DECL(PGVM) GVMMR0FastGetGVMByVM(PVM pVM)
     1942GVMMR0DECL(PGVM) GVMMR0FastGetGVMByVM(PVMCC pVM)
    19481943{
    19491944    AssertPtr(pVM);
     
    19961991 * @remark  This will not assert on an invalid pVM but try return silently.
    19971992 */
    1998 static int gvmmR0ByGVMandVM(PGVM pGVM, PVM pVM, PGVMM *ppGVMM, bool fTakeUsedLock)
     1993static int gvmmR0ByGVMandVM(PGVM pGVM, PVMCC pVM, PGVMM *ppGVMM, bool fTakeUsedLock)
    19991994{
    20001995    /*
     
    20392034                         * Some more VM data consistency checks.
    20402035                         */
     2036#ifdef VBOX_BUGREF_9217
    20412037                        if (RT_LIKELY(   pVM->cCpus == pGVM->cCpus
    20422038                                      && pVM->hSelf == hGVM
    20432039                                      && pVM->enmVMState >= VMSTATE_CREATING
    20442040                                      && pVM->enmVMState <= VMSTATE_TERMINATED
    2045                                       && pVM->pVMR0 == pVM))
     2041                                      && pVM->pSelf == pVM
     2042                                      ))
     2043#else
     2044                        if (RT_LIKELY(   pVM->cCpus == pGVM->cCpus
     2045                                      && pVM->hSelf == hGVM
     2046                                      && pVM->enmVMState >= VMSTATE_CREATING
     2047                                      && pVM->enmVMState <= VMSTATE_TERMINATED
     2048                                      && pVM->pVMR0 == pVM
     2049                                      ))
     2050#endif
    20462051                        {
    20472052                            *ppGVMM = pGVMM;
     
    20802085 * @remarks This will assert in all failure paths.
    20812086 */
    2082 static int gvmmR0ByGVMandVMandEMT(PGVM pGVM, PVM pVM, VMCPUID idCpu, PGVMM *ppGVMM)
     2087static int gvmmR0ByGVMandVMandEMT(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, PGVMM *ppGVMM)
    20832088{
    20842089    /*
     
    21272132    AssertReturn(pVM->cCpus == pGVM->cCpus, VERR_INCONSISTENT_VM_HANDLE);
    21282133    AssertReturn(pVM->hSelf == hGVM, VERR_INCONSISTENT_VM_HANDLE);
     2134#ifndef VBOX_BUGREF_9217
    21292135    AssertReturn(pVM->pVMR0 == pVM, VERR_INCONSISTENT_VM_HANDLE);
     2136#endif
    21302137    AssertReturn(   pVM->enmVMState >= VMSTATE_CREATING
    21312138                 && pVM->enmVMState <= VMSTATE_TERMINATED, VERR_INCONSISTENT_VM_HANDLE);
     
    21432150 * @param   pVM         The cross context VM structure.
    21442151 */
    2145 GVMMR0DECL(int) GVMMR0ValidateGVMandVM(PGVM pGVM, PVM pVM)
     2152GVMMR0DECL(int) GVMMR0ValidateGVMandVM(PGVM pGVM, PVMCC pVM)
    21462153{
    21472154    PGVMM pGVMM;
     
    21602167 * @thread  EMT(idCpu)
    21612168 */
    2162 GVMMR0DECL(int) GVMMR0ValidateGVMandVMandEMT(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     2169GVMMR0DECL(int) GVMMR0ValidateGVMandVMandEMT(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    21632170{
    21642171    PGVMM pGVMM;
     
    21782185 *                  NIL_RTNATIVETHREAD means the current thread
    21792186 */
    2180 GVMMR0DECL(PVM) GVMMR0GetVMByEMT(RTNATIVETHREAD hEMT)
     2187GVMMR0DECL(PVMCC) GVMMR0GetVMByEMT(RTNATIVETHREAD hEMT)
    21812188{
    21822189    /*
     
    24452452 * @thread  EMT(pGVCpu).
    24462453 */
    2447 GVMMR0DECL(int) GVMMR0SchedHalt(PGVM pGVM, PVM pVM, PGVMCPU pGVCpu, uint64_t u64ExpireGipTime)
     2454GVMMR0DECL(int) GVMMR0SchedHalt(PGVM pGVM, PVMCC pVM, PGVMCPU pGVCpu, uint64_t u64ExpireGipTime)
    24482455{
    24492456    LogFlow(("GVMMR0SchedHalt: pGVM=%p pVM=%p pGVCpu=%p(%d) u64ExpireGipTime=%#RX64\n",
     
    25562563 * @thread  EMT(idCpu).
    25572564 */
    2558 GVMMR0DECL(int) GVMMR0SchedHaltReq(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint64_t u64ExpireGipTime)
     2565GVMMR0DECL(int) GVMMR0SchedHaltReq(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, uint64_t u64ExpireGipTime)
    25592566{
    25602567    GVMM_CHECK_SMAP_SETUP();
     
    26282635 * @thread  Any but EMT(idCpu).
    26292636 */
    2630 GVMMR0DECL(int) GVMMR0SchedWakeUpEx(PGVM pGVM, PVM pVM, VMCPUID idCpu, bool fTakeUsedLock)
     2637GVMMR0DECL(int) GVMMR0SchedWakeUpEx(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, bool fTakeUsedLock)
    26312638{
    26322639    GVMM_CHECK_SMAP_SETUP();
     
    26882695 * @thread  Any but EMT(idCpu).
    26892696 */
    2690 GVMMR0DECL(int) GVMMR0SchedWakeUp(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     2697GVMMR0DECL(int) GVMMR0SchedWakeUp(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    26912698{
    26922699    return GVMMR0SchedWakeUpEx(pGVM, pVM, idCpu, true /* fTakeUsedLock */);
     
    27072714 * @deprecated  Don't use in new code if possible!  Use the GVM variant.
    27082715 */
    2709 GVMMR0DECL(int) GVMMR0SchedWakeUpNoGVMNoLock(PVM pVM, VMCPUID idCpu)
     2716GVMMR0DECL(int) GVMMR0SchedWakeUpNoGVMNoLock(PVMCC pVM, VMCPUID idCpu)
    27102717{
    27112718    GVMM_CHECK_SMAP_SETUP();
     
    27322739 * @param   pVCpu               The cross context virtual CPU structure.
    27332740 */
    2734 DECLINLINE(int) gvmmR0SchedPokeOne(PGVM pGVM, PVMCPU pVCpu)
     2741DECLINLINE(int) gvmmR0SchedPokeOne(PGVM pGVM, PVMCPUCC pVCpu)
    27352742{
    27362743    pGVM->gvmm.s.StatsSched.cPokeCalls++;
     
    27622769 * @param   fTakeUsedLock       Take the used lock or not
    27632770 */
    2764 GVMMR0DECL(int) GVMMR0SchedPokeEx(PGVM pGVM, PVM pVM, VMCPUID idCpu, bool fTakeUsedLock)
     2771GVMMR0DECL(int) GVMMR0SchedPokeEx(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, bool fTakeUsedLock)
    27652772{
    27662773    /*
     
    28032810 * @param   idCpu               The ID of the virtual CPU to poke.
    28042811 */
    2805 GVMMR0DECL(int) GVMMR0SchedPoke(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     2812GVMMR0DECL(int) GVMMR0SchedPoke(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    28062813{
    28072814    return GVMMR0SchedPokeEx(pGVM, pVM, idCpu, true /* fTakeUsedLock */);
     
    28222829 * @deprecated  Don't use in new code if possible!  Use the GVM variant.
    28232830 */
    2824 GVMMR0DECL(int) GVMMR0SchedPokeNoGVMNoLock(PVM pVM, VMCPUID idCpu)
     2831GVMMR0DECL(int) GVMMR0SchedPokeNoGVMNoLock(PVMCC pVM, VMCPUID idCpu)
    28252832{
    28262833    PGVM pGVM;
     
    28522859 * @param   pPokeSet            The set of CPUs to poke.
    28532860 */
    2854 GVMMR0DECL(int) GVMMR0SchedWakeUpAndPokeCpus(PGVM pGVM, PVM pVM, PCVMCPUSET pSleepSet, PCVMCPUSET pPokeSet)
     2861GVMMR0DECL(int) GVMMR0SchedWakeUpAndPokeCpus(PGVM pGVM, PVMCC pVM, PCVMCPUSET pSleepSet, PCVMCPUSET pPokeSet)
    28552862{
    28562863    AssertPtrReturn(pSleepSet, VERR_INVALID_POINTER);
     
    29112918 * @param   pReq            Pointer to the request packet.
    29122919 */
    2913 GVMMR0DECL(int) GVMMR0SchedWakeUpAndPokeCpusReq(PGVM pGVM, PVM pVM, PGVMMSCHEDWAKEUPANDPOKECPUSREQ pReq)
     2920GVMMR0DECL(int) GVMMR0SchedWakeUpAndPokeCpusReq(PGVM pGVM, PVMCC pVM, PGVMMSCHEDWAKEUPANDPOKECPUSREQ pReq)
    29142921{
    29152922    /*
     
    29392946 * @thread  EMT(idCpu).
    29402947 */
    2941 GVMMR0DECL(int) GVMMR0SchedPoll(PGVM pGVM, PVM pVM, VMCPUID idCpu, bool fYield)
     2948GVMMR0DECL(int) GVMMR0SchedPoll(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, bool fYield)
    29422949{
    29432950    /*
     
    30723079 * @param   uHz         The desired frequency.
    30733080 */
    3074 GVMMR0DECL(void) GVMMR0SchedUpdatePeriodicPreemptionTimer(PVM pVM, RTCPUID idHostCpu, uint32_t uHz)
     3081GVMMR0DECL(void) GVMMR0SchedUpdatePeriodicPreemptionTimer(PVMCC pVM, RTCPUID idHostCpu, uint32_t uHz)
    30753082{
    30763083    NOREF(pVM);
     
    31553162 * @param   pVM         The VM structure corresponding to @a pGVM.
    31563163 */
    3157 GVMMR0DECL(int) GVMMR0QueryStatistics(PGVMMSTATS pStats, PSUPDRVSESSION pSession, PGVM pGVM, PVM pVM)
     3164GVMMR0DECL(int) GVMMR0QueryStatistics(PGVMMSTATS pStats, PSUPDRVSESSION pSession, PGVM pGVM, PVMCC pVM)
    31583165{
    31593166    LogFlow(("GVMMR0QueryStatistics: pStats=%p pSession=%p pGVM=%p pVM=%p\n", pStats, pSession, pGVM, pVM));
     
    32703277 * @param   pSession        The current session.
    32713278 */
    3272 GVMMR0DECL(int) GVMMR0QueryStatisticsReq(PGVM pGVM, PVM pVM, PGVMMQUERYSTATISTICSSREQ pReq, PSUPDRVSESSION pSession)
     3279GVMMR0DECL(int) GVMMR0QueryStatisticsReq(PGVM pGVM, PVMCC pVM, PGVMMQUERYSTATISTICSSREQ pReq, PSUPDRVSESSION pSession)
    32733280{
    32743281    /*
     
    32933300 * @param   pVM         The VM structure corresponding to @a pGVM.
    32943301 */
    3295 GVMMR0DECL(int) GVMMR0ResetStatistics(PCGVMMSTATS pStats, PSUPDRVSESSION pSession, PGVM pGVM, PVM pVM)
     3302GVMMR0DECL(int) GVMMR0ResetStatistics(PCGVMMSTATS pStats, PSUPDRVSESSION pSession, PGVM pGVM, PVMCC pVM)
    32963303{
    32973304    LogFlow(("GVMMR0ResetStatistics: pStats=%p pSession=%p pGVM=%p pVM=%p\n", pStats, pSession, pGVM, pVM));
     
    33883395 * @param   pSession        The current session.
    33893396 */
    3390 GVMMR0DECL(int) GVMMR0ResetStatisticsReq(PGVM pGVM, PVM pVM, PGVMMRESETSTATISTICSSREQ pReq, PSUPDRVSESSION pSession)
     3397GVMMR0DECL(int) GVMMR0ResetStatisticsReq(PGVM pGVM, PVMCC pVM, PGVMMRESETSTATISTICSSREQ pReq, PSUPDRVSESSION pSession)
    33913398{
    33923399    /*
  • trunk/src/VBox/VMM/VMMR0/HMR0.cpp

    r80266 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_HM
    2324#define VMCPU_INCL_CPUM_GST_CTX
     
    2526#include <VBox/vmm/pgm.h>
    2627#include "HMInternal.h"
    27 #include <VBox/vmm/vm.h>
     28#include <VBox/vmm/vmcc.h>
    2829#include <VBox/vmm/hm_svm.h>
    2930#include <VBox/vmm/hmvmxinline.h>
     
    8788    /** @name Ring-0 method table for AMD-V and VT-x specific operations.
    8889     * @{ */
    89     DECLR0CALLBACKMEMBER(int,  pfnEnterSession, (PVMCPU pVCpu));
    90     DECLR0CALLBACKMEMBER(void, pfnThreadCtxCallback, (RTTHREADCTXEVENT enmEvent, PVMCPU pVCpu, bool fGlobalInit));
    91     DECLR0CALLBACKMEMBER(int,  pfnExportHostState, (PVMCPU pVCpu));
    92     DECLR0CALLBACKMEMBER(VBOXSTRICTRC, pfnRunGuestCode, (PVMCPU pVCpu));
    93     DECLR0CALLBACKMEMBER(int,  pfnEnableCpu, (PHMPHYSCPU pHostCpu, PVM pVM, void *pvCpuPage, RTHCPHYS HCPhysCpuPage,
     90    DECLR0CALLBACKMEMBER(int,  pfnEnterSession, (PVMCPUCC pVCpu));
     91    DECLR0CALLBACKMEMBER(void, pfnThreadCtxCallback, (RTTHREADCTXEVENT enmEvent, PVMCPUCC pVCpu, bool fGlobalInit));
     92    DECLR0CALLBACKMEMBER(int,  pfnExportHostState, (PVMCPUCC pVCpu));
     93    DECLR0CALLBACKMEMBER(VBOXSTRICTRC, pfnRunGuestCode, (PVMCPUCC pVCpu));
     94    DECLR0CALLBACKMEMBER(int,  pfnEnableCpu, (PHMPHYSCPU pHostCpu, PVMCC pVM, void *pvCpuPage, RTHCPHYS HCPhysCpuPage,
    9495                                              bool fEnabledByHost, PCSUPHWVIRTMSRS pHwvirtMsrs));
    9596    DECLR0CALLBACKMEMBER(int,  pfnDisableCpu, (void *pvCpuPage, RTHCPHYS HCPhysCpuPage));
    96     DECLR0CALLBACKMEMBER(int,  pfnInitVM, (PVM pVM));
    97     DECLR0CALLBACKMEMBER(int,  pfnTermVM, (PVM pVM));
    98     DECLR0CALLBACKMEMBER(int,  pfnSetupVM, (PVM pVM));
     97    DECLR0CALLBACKMEMBER(int,  pfnInitVM, (PVMCC pVM));
     98    DECLR0CALLBACKMEMBER(int,  pfnTermVM, (PVMCC pVM));
     99    DECLR0CALLBACKMEMBER(int,  pfnSetupVM, (PVMCC pVM));
    99100    /** @} */
    100101
     
    227228 * @{ */
    228229
    229 static DECLCALLBACK(int) hmR0DummyEnter(PVMCPU pVCpu)
     230static DECLCALLBACK(int) hmR0DummyEnter(PVMCPUCC pVCpu)
    230231{
    231232    RT_NOREF1(pVCpu);
     
    233234}
    234235
    235 static DECLCALLBACK(void) hmR0DummyThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPU pVCpu, bool fGlobalInit)
     236static DECLCALLBACK(void) hmR0DummyThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPUCC pVCpu, bool fGlobalInit)
    236237{
    237238    RT_NOREF3(enmEvent, pVCpu, fGlobalInit);
    238239}
    239240
    240 static DECLCALLBACK(int) hmR0DummyEnableCpu(PHMPHYSCPU pHostCpu, PVM pVM, void *pvCpuPage, RTHCPHYS HCPhysCpuPage,
     241static DECLCALLBACK(int) hmR0DummyEnableCpu(PHMPHYSCPU pHostCpu, PVMCC pVM, void *pvCpuPage, RTHCPHYS HCPhysCpuPage,
    241242                                            bool fEnabledBySystem, PCSUPHWVIRTMSRS pHwvirtMsrs)
    242243{
     
    251252}
    252253
    253 static DECLCALLBACK(int) hmR0DummyInitVM(PVM pVM)
     254static DECLCALLBACK(int) hmR0DummyInitVM(PVMCC pVM)
    254255{
    255256    RT_NOREF1(pVM);
     
    257258}
    258259
    259 static DECLCALLBACK(int) hmR0DummyTermVM(PVM pVM)
     260static DECLCALLBACK(int) hmR0DummyTermVM(PVMCC pVM)
    260261{
    261262    RT_NOREF1(pVM);
     
    263264}
    264265
    265 static DECLCALLBACK(int) hmR0DummySetupVM(PVM pVM)
     266static DECLCALLBACK(int) hmR0DummySetupVM(PVMCC pVM)
    266267{
    267268    RT_NOREF1(pVM);
     
    269270}
    270271
    271 static DECLCALLBACK(VBOXSTRICTRC) hmR0DummyRunGuestCode(PVMCPU pVCpu)
     272static DECLCALLBACK(VBOXSTRICTRC) hmR0DummyRunGuestCode(PVMCPUCC pVCpu)
    272273{
    273274    RT_NOREF(pVCpu);
     
    275276}
    276277
    277 static DECLCALLBACK(int) hmR0DummyExportHostState(PVMCPU pVCpu)
     278static DECLCALLBACK(int) hmR0DummyExportHostState(PVMCPUCC pVCpu)
    278279{
    279280    RT_NOREF1(pVCpu);
     
    788789 * @remarks Maybe called with interrupts disabled!
    789790 */
    790 static int hmR0EnableCpu(PVM pVM, RTCPUID idCpu)
     791static int hmR0EnableCpu(PVMCC pVM, RTCPUID idCpu)
    791792{
    792793    PHMPHYSCPU pHostCpu = &g_HmR0.aCpuInfo[idCpu];
     
    824825static DECLCALLBACK(void) hmR0EnableCpuCallback(RTCPUID idCpu, void *pvUser1, void *pvUser2)
    825826{
    826     PVM             pVM      = (PVM)pvUser1;     /* can be NULL! */
     827    PVMCC             pVM      = (PVMCC)pvUser1;     /* can be NULL! */
    827828    PHMR0FIRSTRC    pFirstRc = (PHMR0FIRSTRC)pvUser2;
    828829    AssertReturnVoid(g_HmR0.fGlobalInit);
     
    840841static DECLCALLBACK(int32_t) hmR0EnableAllCpuOnce(void *pvUser)
    841842{
    842     PVM pVM = (PVM)pvUser;
     843    PVMCC pVM = (PVMCC)pvUser;
    843844
    844845    /*
     
    956957 * @param   pVM                 The cross context VM structure.
    957958 */
    958 VMMR0_INT_DECL(int) HMR0EnableAllCpus(PVM pVM)
     959VMMR0_INT_DECL(int) HMR0EnableAllCpus(PVMCC pVM)
    959960{
    960961    /* Make sure we don't touch HM after we've disabled HM in preparation of a suspend. */
     
    10421043 * @param   enmEvent            The Mp event.
    10431044 * @param   idCpu               The identifier for the CPU the function is called on.
    1044  * @param   pvData              Opaque data (PVM pointer).
     1045 * @param   pvData              Opaque data (PVMCC pointer).
    10451046 */
    10461047static DECLCALLBACK(void) hmR0MpEventCallback(RTMPEVENT enmEvent, RTCPUID idCpu, void *pvData)
     
    11581159 *          vmR3InitRing3().
    11591160 */
    1160 VMMR0_INT_DECL(int) HMR0InitVM(PVM pVM)
     1161VMMR0_INT_DECL(int) HMR0InitVM(PVMCC pVM)
    11611162{
    11621163    AssertReturn(pVM, VERR_INVALID_PARAMETER);
     
    12351236     * Initialize some per-VCPU fields.
    12361237     */
    1237     for (VMCPUID i = 0; i < pVM->cCpus; i++)
    1238     {
    1239         PVMCPU pVCpu = &pVM->aCpus[i];
     1238    for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
     1239    {
     1240        PVMCPUCC pVCpu = VMCC_GET_CPU(pVM, idCpu);
    12401241        pVCpu->hm.s.idEnteredCpu   = NIL_RTCPUID;
    12411242        pVCpu->hm.s.idLastCpu      = NIL_RTCPUID;
     
    12671268 * @param   pVM         The cross context VM structure.
    12681269 */
    1269 VMMR0_INT_DECL(int) HMR0TermVM(PVM pVM)
     1270VMMR0_INT_DECL(int) HMR0TermVM(PVMCC pVM)
    12701271{
    12711272    Log(("HMR0TermVM: %p\n", pVM));
     
    12901291 * @param   pVM         The cross context VM structure.
    12911292 */
    1292 VMMR0_INT_DECL(int) HMR0SetupVM(PVM pVM)
     1293VMMR0_INT_DECL(int) HMR0SetupVM(PVMCC pVM)
    12931294{
    12941295    Log(("HMR0SetupVM: %p\n", pVM));
     
    12991300
    13001301    /* On first entry we'll sync everything. */
    1301     for (VMCPUID i = 0; i < pVM->cCpus; i++)
    1302     {
    1303         PVMCPU pVCpu = &pVM->aCpus[i];
    1304         pVCpu->hm.s.fCtxChanged |= HM_CHANGED_HOST_CONTEXT | HM_CHANGED_ALL_GUEST;
    1305     }
     1302    VMCC_FOR_EACH_VMCPU_STMT(pVM, pVCpu->hm.s.fCtxChanged |= HM_CHANGED_HOST_CONTEXT | HM_CHANGED_ALL_GUEST);
    13061303
    13071304    /*
     
    13511348 * @remarks No-long-jump zone!!!
    13521349 */
    1353 VMMR0_INT_DECL(int) hmR0EnterCpu(PVMCPU pVCpu)
     1350VMMR0_INT_DECL(int) hmR0EnterCpu(PVMCPUCC pVCpu)
    13541351{
    13551352    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    13841381 * @remarks This is called with preemption disabled.
    13851382 */
    1386 VMMR0_INT_DECL(int) HMR0Enter(PVMCPU pVCpu)
     1383VMMR0_INT_DECL(int) HMR0Enter(PVMCPUCC pVCpu)
    13871384{
    13881385    /* Make sure we can't enter a session after we've disabled HM in preparation of a suspend. */
     
    14371434 * @remarks No-long-jump zone!!!
    14381435 */
    1439 VMMR0_INT_DECL(int) HMR0LeaveCpu(PVMCPU pVCpu)
     1436VMMR0_INT_DECL(int) HMR0LeaveCpu(PVMCPUCC pVCpu)
    14401437{
    14411438    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    14721469VMMR0_INT_DECL(void) HMR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, void *pvUser)
    14731470{
    1474     PVMCPU pVCpu = (PVMCPU)pvUser;
     1471    PVMCPUCC pVCpu = (PVMCPUCC)pvUser;
    14751472    Assert(pVCpu);
    14761473    Assert(g_HmR0.pfnThreadCtxCallback);
     
    14911488 *          used!!!
    14921489 */
    1493 VMMR0_INT_DECL(int) HMR0RunGuestCode(PVM pVM, PVMCPU pVCpu)
     1490VMMR0_INT_DECL(int) HMR0RunGuestCode(PVMCC pVM, PVMCPUCC pVCpu)
    14941491{
    14951492    RT_NOREF(pVM);
     
    15271524 * @param   pVCpu   The cross context virtual CPU structure of the calling EMT.
    15281525 */
    1529 VMMR0_INT_DECL(void) HMR0NotifyCpumUnloadedGuestFpuState(PVMCPU pVCpu)
     1526VMMR0_INT_DECL(void) HMR0NotifyCpumUnloadedGuestFpuState(PVMCPUCC pVCpu)
    15301527{
    15311528    ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_GUEST_CR0);
     
    15381535 * @param   pVCpu   The cross context virtual CPU structure of the calling EMT.
    15391536 */
    1540 VMMR0_INT_DECL(void) HMR0NotifyCpumModifiedHostCr0(PVMCPU pVCpu)
     1537VMMR0_INT_DECL(void) HMR0NotifyCpumModifiedHostCr0(PVMCPUCC pVCpu)
    15411538{
    15421539    ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_HOST_CONTEXT);
     
    15611558 * @param   GCVirt      Page to invalidate.
    15621559 */
    1563 VMMR0_INT_DECL(int) HMR0InvalidatePage(PVMCPU pVCpu, RTGCPTR GCVirt)
    1564 {
    1565     PVM pVM = pVCpu->CTX_SUFF(pVM);
     1560VMMR0_INT_DECL(int) HMR0InvalidatePage(PVMCPUCC pVCpu, RTGCPTR GCVirt)
     1561{
     1562    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    15661563    if (pVM->hm.s.vmx.fSupported)
    15671564        return VMXR0InvalidatePage(pVCpu, GCVirt);
     
    15921589 * @param   fWhat       What to import, CPUMCTX_EXTRN_XXX.
    15931590 */
    1594 VMMR0_INT_DECL(int) HMR0ImportStateOnDemand(PVMCPU pVCpu, uint64_t fWhat)
     1591VMMR0_INT_DECL(int) HMR0ImportStateOnDemand(PVMCPUCC pVCpu, uint64_t fWhat)
    15951592{
    15961593    if (pVCpu->CTX_SUFF(pVM)->hm.s.vmx.fSupported)
     
    17301727 * @param   fFlags  The dumping flags (HM_DUMP_REG_FLAGS_XXX).
    17311728 */
    1732 VMMR0_INT_DECL(void) hmR0DumpRegs(PVMCPU pVCpu, uint32_t fFlags)
     1729VMMR0_INT_DECL(void) hmR0DumpRegs(PVMCPUCC pVCpu, uint32_t fFlags)
    17331730{
    17341731    /*
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r80268 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_HM
    2324#define VMCPU_INCL_CPUM_GST_CTX
     
    3435#include <VBox/vmm/apic.h>
    3536#include "HMInternal.h"
    36 #include <VBox/vmm/vm.h>
     37#include <VBox/vmm/vmcc.h>
    3738#include <VBox/err.h>
    3839#include "HMSVMR0.h"
     
    354355 * @param   pSvmTransient   Pointer to the SVM-transient structure.
    355356 */
    356 typedef int FNSVMEXITHANDLER(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient);
     357typedef int FNSVMEXITHANDLER(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient);
    357358
    358359
     
    360361*   Internal Functions                                                                                                           *
    361362*********************************************************************************************************************************/
    362 static void hmR0SvmPendingEventToTrpmTrap(PVMCPU pVCpu);
    363 static void hmR0SvmLeave(PVMCPU pVCpu, bool fImportState);
     363static void hmR0SvmPendingEventToTrpmTrap(PVMCPUCC pVCpu);
     364static void hmR0SvmLeave(PVMCPUCC pVCpu, bool fImportState);
    364365
    365366
     
    416417/** @} */
    417418
    418 static int hmR0SvmHandleExit(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient);
     419static int hmR0SvmHandleExit(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient);
    419420#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    420 static int hmR0SvmHandleExitNested(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient);
     421static int hmR0SvmHandleExitNested(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient);
    421422#endif
    422423
     
    457458 * @param   uVerbose    The verbosity level, currently unused.
    458459 */
    459 static void hmR0SvmLogState(PVMCPU pVCpu, PCSVMVMCB pVmcb, const char *pszPrefix, uint32_t fFlags, uint8_t uVerbose)
     460static void hmR0SvmLogState(PVMCPUCC pVCpu, PCSVMVMCB pVmcb, const char *pszPrefix, uint32_t fFlags, uint8_t uVerbose)
    460461{
    461462    RT_NOREF2(pVCpu, uVerbose);
     
    526527 *                          unused).
    527528 */
    528 VMMR0DECL(int) SVMR0EnableCpu(PHMPHYSCPU pHostCpu, PVM pVM, void *pvCpuPage, RTHCPHYS HCPhysCpuPage, bool fEnabledByHost,
     529VMMR0DECL(int) SVMR0EnableCpu(PHMPHYSCPU pHostCpu, PVMCC pVM, void *pvCpuPage, RTHCPHYS HCPhysCpuPage, bool fEnabledByHost,
    529530                              PCSUPHWVIRTMSRS pHwvirtMsrs)
    530531{
     
    661662 * @param   pVM     The cross context VM structure.
    662663 */
    663 DECLINLINE(void) hmR0SvmFreeStructs(PVM pVM)
    664 {
    665     for (uint32_t i = 0; i < pVM->cCpus; i++)
    666     {
    667         PVMCPU pVCpu = &pVM->aCpus[i];
     664DECLINLINE(void) hmR0SvmFreeStructs(PVMCC pVM)
     665{
     666    for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
     667    {
     668        PVMCPUCC pVCpu = VMCC_GET_CPU(pVM, idCpu);
    668669        AssertPtr(pVCpu);
    669670
     
    700701 * @param   pVM         The cross context VM structure.
    701702 */
    702 VMMR0DECL(int) SVMR0InitVM(PVM pVM)
     703VMMR0DECL(int) SVMR0InitVM(PVMCC pVM)
    703704{
    704705    int rc = VERR_INTERNAL_ERROR_5;
     
    719720     * Initialize the R0 memory objects up-front so we can properly cleanup on allocation failures.
    720721     */
    721     for (VMCPUID i = 0; i < pVM->cCpus; i++)
    722     {
    723         PVMCPU pVCpu = &pVM->aCpus[i];
     722    for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
     723    {
     724        PVMCPUCC pVCpu = VMCC_GET_CPU(pVM, idCpu);
    724725        pVCpu->hm.s.svm.hMemObjVmcbHost  = NIL_RTR0MEMOBJ;
    725726        pVCpu->hm.s.svm.hMemObjVmcb      = NIL_RTR0MEMOBJ;
     
    727728    }
    728729
    729     for (VMCPUID i = 0; i < pVM->cCpus; i++)
    730     {
    731         PVMCPU pVCpu = &pVM->aCpus[i];
     730    for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
     731    {
     732        PVMCPUCC pVCpu = VMCC_GET_CPU(pVM, idCpu);
    732733
    733734        /*
     
    785786 * @param   pVM         The cross context VM structure.
    786787 */
    787 VMMR0DECL(int) SVMR0TermVM(PVM pVM)
     788VMMR0DECL(int) SVMR0TermVM(PVMCC pVM)
    788789{
    789790    hmR0SvmFreeStructs(pVM);
     
    798799 * @param   pVCpu       The cross context virtual CPU structure.
    799800 */
    800 DECLINLINE(bool) hmR0SvmSupportsVmcbCleanBits(PVMCPU pVCpu)
    801 {
    802     PVM pVM = pVCpu->CTX_SUFF(pVM);
     801DECLINLINE(bool) hmR0SvmSupportsVmcbCleanBits(PVMCPUCC pVCpu)
     802{
     803    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    803804#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    804805    if (CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx))
     
    818819 * @param   pVCpu       The cross context virtual CPU structure.
    819820 */
    820 DECLINLINE(bool) hmR0SvmSupportsDecodeAssists(PVMCPU pVCpu)
    821 {
    822     PVM pVM = pVCpu->CTX_SUFF(pVM);
     821DECLINLINE(bool) hmR0SvmSupportsDecodeAssists(PVMCPUCC pVCpu)
     822{
     823    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    823824#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    824825    if (CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx))
     
    838839 * @param   pVCpu       The cross context virtual CPU structure.
    839840 */
    840 DECLINLINE(bool) hmR0SvmSupportsNextRipSave(PVMCPU pVCpu)
    841 {
    842     PVM pVM = pVCpu->CTX_SUFF(pVM);
     841DECLINLINE(bool) hmR0SvmSupportsNextRipSave(PVMCPUCC pVCpu)
     842{
     843    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    843844#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    844845    if (CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx))
     
    864865 *          caller needs to take care of this.
    865866 */
    866 static void hmR0SvmSetMsrPermission(PVMCPU pVCpu, uint8_t *pbMsrBitmap, uint32_t idMsr, SVMMSREXITREAD enmRead,
     867static void hmR0SvmSetMsrPermission(PVMCPUCC pVCpu, uint8_t *pbMsrBitmap, uint32_t idMsr, SVMMSREXITREAD enmRead,
    867868                                    SVMMSREXITWRITE enmWrite)
    868869{
     
    926927 * @param   pVM         The cross context VM structure.
    927928 */
    928 VMMR0DECL(int) SVMR0SetupVM(PVM pVM)
     929VMMR0DECL(int) SVMR0SetupVM(PVMCC pVM)
    929930{
    930931    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    947948#endif
    948949
    949     PVMCPU       pVCpu = &pVM->aCpus[0];
    950     PSVMVMCB     pVmcb = pVCpu->hm.s.svm.pVmcb;
    951     AssertMsgReturn(pVmcb, ("Invalid pVmcb for vcpu[0]\n"), VERR_SVM_INVALID_PVMCB);
    952     PSVMVMCBCTRL pVmcbCtrl = &pVmcb->ctrl;
     950    PVMCPUCC     pVCpu0 = VMCC_GET_CPU_0(pVM);
     951    PSVMVMCB     pVmcb0 = pVCpu0->hm.s.svm.pVmcb;
     952    AssertMsgReturn(RT_VALID_PTR(pVmcb0), ("Invalid pVmcb (%p) for vcpu[0]\n", pVmcb0), VERR_SVM_INVALID_PVMCB);
     953    PSVMVMCBCTRL pVmcbCtrl0 = &pVmcb0->ctrl;
    953954
    954955    /* Always trap #AC for reasons of security. */
    955     pVmcbCtrl->u32InterceptXcpt |= RT_BIT_32(X86_XCPT_AC);
     956    pVmcbCtrl0->u32InterceptXcpt |= RT_BIT_32(X86_XCPT_AC);
    956957
    957958    /* Always trap #DB for reasons of security. */
    958     pVmcbCtrl->u32InterceptXcpt |= RT_BIT_32(X86_XCPT_DB);
     959    pVmcbCtrl0->u32InterceptXcpt |= RT_BIT_32(X86_XCPT_DB);
    959960
    960961    /* Trap exceptions unconditionally (debug purposes). */
    961962#ifdef HMSVM_ALWAYS_TRAP_PF
    962     pVmcbCtrl->u32InterceptXcpt |=   RT_BIT(X86_XCPT_PF);
     963    pVmcbCtrl0->u32InterceptXcpt |= RT_BIT_32(X86_XCPT_PF);
    963964#endif
    964965#ifdef HMSVM_ALWAYS_TRAP_ALL_XCPTS
    965966    /* If you add any exceptions here, make sure to update hmR0SvmHandleExit(). */
    966     pVmcbCtrl->u32InterceptXcpt |= 0
    967                                  | RT_BIT(X86_XCPT_BP)
    968                                  | RT_BIT(X86_XCPT_DE)
    969                                  | RT_BIT(X86_XCPT_NM)
    970                                  | RT_BIT(X86_XCPT_UD)
    971                                  | RT_BIT(X86_XCPT_NP)
    972                                  | RT_BIT(X86_XCPT_SS)
    973                                  | RT_BIT(X86_XCPT_GP)
    974                                  | RT_BIT(X86_XCPT_PF)
    975                                  | RT_BIT(X86_XCPT_MF)
    976                                  ;
     967    pVmcbCtrl0->u32InterceptXcpt |= RT_BIT_32(X86_XCPT_BP)
     968                                  | RT_BIT_32(X86_XCPT_DE)
     969                                  | RT_BIT_32(X86_XCPT_NM)
     970                                  | RT_BIT_32(X86_XCPT_UD)
     971                                  | RT_BIT_32(X86_XCPT_NP)
     972                                  | RT_BIT_32(X86_XCPT_SS)
     973                                  | RT_BIT_32(X86_XCPT_GP)
     974                                  | RT_BIT_32(X86_XCPT_PF)
     975                                  | RT_BIT_32(X86_XCPT_MF)
     976                                  ;
    977977#endif
    978978
    979979    /* Apply the exceptions intercepts needed by the GIM provider. */
    980     if (pVCpu->hm.s.fGIMTrapXcptUD)
    981         pVmcbCtrl->u32InterceptXcpt |= RT_BIT(X86_XCPT_UD);
     980    if (pVCpu0->hm.s.fGIMTrapXcptUD)
     981        pVmcbCtrl0->u32InterceptXcpt |= RT_BIT(X86_XCPT_UD);
    982982
    983983    /* The mesa 3d driver hack needs #GP. */
    984     if (pVCpu->hm.s.fTrapXcptGpForLovelyMesaDrv)
    985         pVmcbCtrl->u32InterceptXcpt |= RT_BIT(X86_XCPT_GP);
     984    if (pVCpu0->hm.s.fTrapXcptGpForLovelyMesaDrv)
     985        pVmcbCtrl0->u32InterceptXcpt |= RT_BIT(X86_XCPT_GP);
    986986
    987987    /* Set up unconditional intercepts and conditions. */
    988     pVmcbCtrl->u64InterceptCtrl = HMSVM_MANDATORY_GUEST_CTRL_INTERCEPTS
    989                                 | SVM_CTRL_INTERCEPT_VMMCALL;
     988    pVmcbCtrl0->u64InterceptCtrl = HMSVM_MANDATORY_GUEST_CTRL_INTERCEPTS
     989                                 | SVM_CTRL_INTERCEPT_VMMCALL;
    990990
    991991#ifdef HMSVM_ALWAYS_TRAP_TASK_SWITCH
    992     pVmcbCtrl->u64InterceptCtrl |= SVM_CTRL_INTERCEPT_TASK_SWITCH;
     992    pVmcbCtrl0->u64InterceptCtrl |= SVM_CTRL_INTERCEPT_TASK_SWITCH;
    993993#endif
    994994
    995995#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    996996    /* Virtualized VMSAVE/VMLOAD. */
    997     pVmcbCtrl->LbrVirt.n.u1VirtVmsaveVmload = fUseVirtVmsaveVmload;
     997    pVmcbCtrl0->LbrVirt.n.u1VirtVmsaveVmload = fUseVirtVmsaveVmload;
    998998    if (!fUseVirtVmsaveVmload)
    999     {
    1000         pVmcbCtrl->u64InterceptCtrl |= SVM_CTRL_INTERCEPT_VMSAVE
    1001                                      | SVM_CTRL_INTERCEPT_VMLOAD;
    1002     }
     999        pVmcbCtrl0->u64InterceptCtrl |= SVM_CTRL_INTERCEPT_VMSAVE
     1000                                      | SVM_CTRL_INTERCEPT_VMLOAD;
    10031001
    10041002    /* Virtual GIF. */
    1005     pVmcbCtrl->IntCtrl.n.u1VGifEnable = fUseVGif;
     1003    pVmcbCtrl0->IntCtrl.n.u1VGifEnable = fUseVGif;
    10061004    if (!fUseVGif)
    1007     {
    1008         pVmcbCtrl->u64InterceptCtrl |= SVM_CTRL_INTERCEPT_CLGI
    1009                                      | SVM_CTRL_INTERCEPT_STGI;
    1010     }
     1005        pVmcbCtrl0->u64InterceptCtrl |= SVM_CTRL_INTERCEPT_CLGI
     1006                                      | SVM_CTRL_INTERCEPT_STGI;
    10111007#endif
    10121008
    10131009    /* CR4 writes must always be intercepted for tracking PGM mode changes. */
    1014     pVmcbCtrl->u16InterceptWrCRx = RT_BIT(4);
     1010    pVmcbCtrl0->u16InterceptWrCRx = RT_BIT(4);
    10151011
    10161012    /* Intercept all DRx reads and writes by default. Changed later on. */
    1017     pVmcbCtrl->u16InterceptRdDRx = 0xffff;
    1018     pVmcbCtrl->u16InterceptWrDRx = 0xffff;
     1013    pVmcbCtrl0->u16InterceptRdDRx = 0xffff;
     1014    pVmcbCtrl0->u16InterceptWrDRx = 0xffff;
    10191015
    10201016    /* Virtualize masking of INTR interrupts. (reads/writes from/to CR8 go to the V_TPR register) */
    1021     pVmcbCtrl->IntCtrl.n.u1VIntrMasking = 1;
     1017    pVmcbCtrl0->IntCtrl.n.u1VIntrMasking = 1;
    10221018
    10231019    /* Ignore the priority in the virtual TPR. This is necessary for delivering PIC style (ExtInt) interrupts
    10241020       and we currently deliver both PIC and APIC interrupts alike, see hmR0SvmEvaluatePendingEvent() */
    1025     pVmcbCtrl->IntCtrl.n.u1IgnoreTPR = 1;
     1021    pVmcbCtrl0->IntCtrl.n.u1IgnoreTPR = 1;
    10261022
    10271023    /* Set the IO permission bitmap physical addresses. */
    1028     pVmcbCtrl->u64IOPMPhysAddr = g_HCPhysIOBitmap;
     1024    pVmcbCtrl0->u64IOPMPhysAddr = g_HCPhysIOBitmap;
    10291025
    10301026    /* LBR virtualization. */
    1031     pVmcbCtrl->LbrVirt.n.u1LbrVirt = fUseLbrVirt;
     1027    pVmcbCtrl0->LbrVirt.n.u1LbrVirt = fUseLbrVirt;
    10321028
    10331029    /* The host ASID MBZ, for the guest start with 1. */
    1034     pVmcbCtrl->TLBCtrl.n.u32ASID = 1;
     1030    pVmcbCtrl0->TLBCtrl.n.u32ASID = 1;
    10351031
    10361032    /* Setup Nested Paging. This doesn't change throughout the execution time of the VM. */
    1037     pVmcbCtrl->NestedPagingCtrl.n.u1NestedPaging = pVM->hm.s.fNestedPaging;
     1033    pVmcbCtrl0->NestedPagingCtrl.n.u1NestedPaging = pVM->hm.s.fNestedPaging;
    10381034
    10391035    /* Without Nested Paging, we need additionally intercepts. */
     
    10411037    {
    10421038        /* CR3 reads/writes must be intercepted; our shadow values differ from the guest values. */
    1043         pVmcbCtrl->u16InterceptRdCRx |= RT_BIT(3);
    1044         pVmcbCtrl->u16InterceptWrCRx |= RT_BIT(3);
     1039        pVmcbCtrl0->u16InterceptRdCRx |= RT_BIT(3);
     1040        pVmcbCtrl0->u16InterceptWrCRx |= RT_BIT(3);
    10451041
    10461042        /* Intercept INVLPG and task switches (may change CR3, EFLAGS, LDT). */
    1047         pVmcbCtrl->u64InterceptCtrl |= SVM_CTRL_INTERCEPT_INVLPG
    1048                                      | SVM_CTRL_INTERCEPT_TASK_SWITCH;
     1043        pVmcbCtrl0->u64InterceptCtrl |= SVM_CTRL_INTERCEPT_INVLPG
     1044                                      | SVM_CTRL_INTERCEPT_TASK_SWITCH;
    10491045
    10501046        /* Page faults must be intercepted to implement shadow paging. */
    1051         pVmcbCtrl->u32InterceptXcpt |= RT_BIT(X86_XCPT_PF);
     1047        pVmcbCtrl0->u32InterceptXcpt |= RT_BIT(X86_XCPT_PF);
    10521048    }
    10531049
     
    10561052    {
    10571053        Assert(pVM->hm.s.svm.cPauseFilter > 0);
    1058         pVmcbCtrl->u16PauseFilterCount = pVM->hm.s.svm.cPauseFilter;
     1054        pVmcbCtrl0->u16PauseFilterCount = pVM->hm.s.svm.cPauseFilter;
    10591055        if (fPauseFilterThreshold)
    1060             pVmcbCtrl->u16PauseFilterThreshold = pVM->hm.s.svm.cPauseFilterThresholdTicks;
    1061         pVmcbCtrl->u64InterceptCtrl |= SVM_CTRL_INTERCEPT_PAUSE;
     1056            pVmcbCtrl0->u16PauseFilterThreshold = pVM->hm.s.svm.cPauseFilterThresholdTicks;
     1057        pVmcbCtrl0->u64InterceptCtrl |= SVM_CTRL_INTERCEPT_PAUSE;
    10621058    }
    10631059
     
    10671063     * Don't intercept guest read/write accesses to these MSRs.
    10681064     */
    1069     uint8_t *pbMsrBitmap = (uint8_t *)pVCpu->hm.s.svm.pvMsrBitmap;
    1070     hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_LSTAR,          SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1071     hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_CSTAR,          SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1072     hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K6_STAR,           SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1073     hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_SF_MASK,        SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1074     hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_FS_BASE,        SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1075     hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_GS_BASE,        SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1076     hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_KERNEL_GS_BASE, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1077     hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_IA32_SYSENTER_CS,  SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1078     hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_IA32_SYSENTER_ESP, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1079     hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_IA32_SYSENTER_EIP, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1080     pVmcbCtrl->u64MSRPMPhysAddr = pVCpu->hm.s.svm.HCPhysMsrBitmap;
     1065    uint8_t *pbMsrBitmap0 = (uint8_t *)pVCpu0->hm.s.svm.pvMsrBitmap;
     1066    hmR0SvmSetMsrPermission(pVCpu0, pbMsrBitmap0, MSR_K8_LSTAR,          SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1067    hmR0SvmSetMsrPermission(pVCpu0, pbMsrBitmap0, MSR_K8_CSTAR,          SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1068    hmR0SvmSetMsrPermission(pVCpu0, pbMsrBitmap0, MSR_K6_STAR,           SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1069    hmR0SvmSetMsrPermission(pVCpu0, pbMsrBitmap0, MSR_K8_SF_MASK,        SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1070    hmR0SvmSetMsrPermission(pVCpu0, pbMsrBitmap0, MSR_K8_FS_BASE,        SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1071    hmR0SvmSetMsrPermission(pVCpu0, pbMsrBitmap0, MSR_K8_GS_BASE,        SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1072    hmR0SvmSetMsrPermission(pVCpu0, pbMsrBitmap0, MSR_K8_KERNEL_GS_BASE, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1073    hmR0SvmSetMsrPermission(pVCpu0, pbMsrBitmap0, MSR_IA32_SYSENTER_CS,  SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1074    hmR0SvmSetMsrPermission(pVCpu0, pbMsrBitmap0, MSR_IA32_SYSENTER_ESP, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1075    hmR0SvmSetMsrPermission(pVCpu0, pbMsrBitmap0, MSR_IA32_SYSENTER_EIP, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1076    pVmcbCtrl0->u64MSRPMPhysAddr = pVCpu0->hm.s.svm.HCPhysMsrBitmap;
    10811077
    10821078    /* Initially all VMCB clean bits MBZ indicating that everything should be loaded from the VMCB in memory. */
    1083     Assert(pVmcbCtrl->u32VmcbCleanBits == 0);
    1084 
    1085     for (VMCPUID i = 1; i < pVM->cCpus; i++)
    1086     {
    1087         PVMCPU       pVCpuCur = &pVM->aCpus[i];
    1088         PSVMVMCB     pVmcbCur = pVM->aCpus[i].hm.s.svm.pVmcb;
    1089         AssertMsgReturn(pVmcbCur, ("Invalid pVmcb for vcpu[%u]\n", i), VERR_SVM_INVALID_PVMCB);
     1079    Assert(pVmcbCtrl0->u32VmcbCleanBits == 0);
     1080
     1081    for (VMCPUID idCpu = 1; idCpu < pVM->cCpus; idCpu++)
     1082    {
     1083        PVMCPUCC     pVCpuCur = VMCC_GET_CPU(pVM, idCpu);
     1084        PSVMVMCB     pVmcbCur = pVCpuCur->hm.s.svm.pVmcb;
     1085        AssertMsgReturn(RT_VALID_PTR(pVmcbCur), ("Invalid pVmcb (%p) for vcpu[%u]\n", pVmcbCur, idCpu), VERR_SVM_INVALID_PVMCB);
    10901086        PSVMVMCBCTRL pVmcbCtrlCur = &pVmcbCur->ctrl;
    10911087
    10921088        /* Copy the VMCB control area. */
    1093         memcpy(pVmcbCtrlCur, pVmcbCtrl, sizeof(*pVmcbCtrlCur));
     1089        memcpy(pVmcbCtrlCur, pVmcbCtrl0, sizeof(*pVmcbCtrlCur));
    10941090
    10951091        /* Copy the MSR bitmap and setup the VCPU-specific host physical address. */
    10961092        uint8_t *pbMsrBitmapCur = (uint8_t *)pVCpuCur->hm.s.svm.pvMsrBitmap;
    1097         memcpy(pbMsrBitmapCur, pbMsrBitmap, SVM_MSRPM_PAGES << X86_PAGE_4K_SHIFT);
     1093        memcpy(pbMsrBitmapCur, pbMsrBitmap0, SVM_MSRPM_PAGES << X86_PAGE_4K_SHIFT);
    10981094        pVmcbCtrlCur->u64MSRPMPhysAddr = pVCpuCur->hm.s.svm.HCPhysMsrBitmap;
    10991095
     
    11021098
    11031099        /* Verify our assumption that GIM providers trap #UD uniformly across VCPUs initially. */
    1104         Assert(pVCpuCur->hm.s.fGIMTrapXcptUD == pVCpu->hm.s.fGIMTrapXcptUD);
     1100        Assert(pVCpuCur->hm.s.fGIMTrapXcptUD == pVCpu0->hm.s.fGIMTrapXcptUD);
    11051101    }
    11061102
     
    11211117 * @param   pVCpu           The cross context virtual CPU structure.
    11221118 */
    1123 DECLINLINE(PSVMVMCB) hmR0SvmGetCurrentVmcb(PVMCPU pVCpu)
     1119DECLINLINE(PSVMVMCB) hmR0SvmGetCurrentVmcb(PVMCPUCC pVCpu)
    11241120{
    11251121#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
     
    11371133 * @param   pVCpu           The cross context virtual CPU structure.
    11381134 */
    1139 DECLINLINE(PSVMNESTEDVMCBCACHE) hmR0SvmGetNestedVmcbCache(PVMCPU pVCpu)
     1135DECLINLINE(PSVMNESTEDVMCBCACHE) hmR0SvmGetNestedVmcbCache(PVMCPUCC pVCpu)
    11401136{
    11411137#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
     
    11561152 * @param   GCVirt      Guest virtual address of the page to invalidate.
    11571153 */
    1158 VMMR0DECL(int) SVMR0InvalidatePage(PVMCPU pVCpu, RTGCPTR GCVirt)
     1154VMMR0DECL(int) SVMR0InvalidatePage(PVMCPUCC pVCpu, RTGCPTR GCVirt)
    11591155{
    11601156    Assert(pVCpu->CTX_SUFF(pVM)->hm.s.svm.fSupported);
     
    11841180 * @param   pVmcb       Pointer to the VM control block.
    11851181 */
    1186 static void hmR0SvmFlushTaggedTlb(PHMPHYSCPU pHostCpu, PVMCPU pVCpu, PSVMVMCB pVmcb)
     1182static void hmR0SvmFlushTaggedTlb(PHMPHYSCPU pHostCpu, PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    11871183{
    11881184    /*
     
    12251221     * This Host CPU requirement takes precedence.
    12261222     */
    1227     PVM pVM = pVCpu->CTX_SUFF(pVM);
     1223    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    12281224    if (pVM->hm.s.svm.fAlwaysFlushTLB)
    12291225    {
     
    13401336 *          are not intercepting it.
    13411337 */
    1342 DECLINLINE(void) hmR0SvmClearXcptIntercept(PVMCPU pVCpu, PSVMVMCB pVmcb, uint8_t uXcpt)
     1338DECLINLINE(void) hmR0SvmClearXcptIntercept(PVMCPUCC pVCpu, PSVMVMCB pVmcb, uint8_t uXcpt)
    13431339{
    13441340    Assert(uXcpt != X86_XCPT_DB);
     
    14001396 *          are not intercepting it.
    14011397 */
    1402 static bool hmR0SvmClearCtrlIntercept(PVMCPU pVCpu, PSVMVMCB pVmcb, uint64_t fCtrlIntercept)
     1398static bool hmR0SvmClearCtrlIntercept(PVMCPUCC pVCpu, PSVMVMCB pVmcb, uint64_t fCtrlIntercept)
    14031399{
    14041400    if (pVmcb->ctrl.u64InterceptCtrl & fCtrlIntercept)
     
    14351431 * @remarks No-long-jump zone!!!
    14361432 */
    1437 static void hmR0SvmExportGuestCR0(PVMCPU pVCpu, PSVMVMCB pVmcb)
     1433static void hmR0SvmExportGuestCR0(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    14381434{
    14391435    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    15181514 * @remarks No-long-jump zone!!!
    15191515 */
    1520 static void hmR0SvmExportGuestCR3(PVMCPU pVCpu, PSVMVMCB pVmcb)
     1516static void hmR0SvmExportGuestCR3(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    15211517{
    15221518    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
    15231519
    1524     PVM      pVM  = pVCpu->CTX_SUFF(pVM);
     1520    PVMCC      pVM  = pVCpu->CTX_SUFF(pVM);
    15251521    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    15261522    if (pVM->hm.s.fNestedPaging)
     
    15461542 * @remarks No-long-jump zone!!!
    15471543 */
    1548 static int hmR0SvmExportGuestCR4(PVMCPU pVCpu, PSVMVMCB pVmcb)
     1544static int hmR0SvmExportGuestCR4(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    15491545{
    15501546    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    16231619 * @remarks No-long-jump zone!!!
    16241620 */
    1625 static int hmR0SvmExportGuestControlRegs(PVMCPU pVCpu, PSVMVMCB pVmcb)
     1621static int hmR0SvmExportGuestControlRegs(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    16261622{
    16271623    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    16641660 * @remarks No-long-jump zone!!!
    16651661 */
    1666 static void hmR0SvmExportGuestSegmentRegs(PVMCPU pVCpu, PSVMVMCB pVmcb)
     1662static void hmR0SvmExportGuestSegmentRegs(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    16671663{
    16681664    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    17331729 * @remarks No-long-jump zone!!!
    17341730 */
    1735 static void hmR0SvmExportGuestMsrs(PVMCPU pVCpu, PSVMVMCB pVmcb)
     1731static void hmR0SvmExportGuestMsrs(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    17361732{
    17371733    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    18131809 * @remarks Requires EFLAGS to be up-to-date in the VMCB!
    18141810 */
    1815 static void hmR0SvmExportSharedDebugState(PVMCPU pVCpu, PSVMVMCB pVmcb)
     1811static void hmR0SvmExportSharedDebugState(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    18161812{
    18171813    PCCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
     
    19381934 * @remarks No-long-jump zone!!!
    19391935 */
    1940 static void hmR0SvmExportGuestHwvirtStateNested(PVMCPU pVCpu, PSVMVMCB pVmcbNstGst)
     1936static void hmR0SvmExportGuestHwvirtStateNested(PVMCPUCC pVCpu, PSVMVMCB pVmcbNstGst)
    19411937{
    19421938    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    19521948         * and may continue execution in SVM R0 without a nested-guest #VMEXIT in between.
    19531949         */
    1954         PVM            pVM = pVCpu->CTX_SUFF(pVM);
     1950        PVMCC            pVM = pVCpu->CTX_SUFF(pVM);
    19551951        PSVMVMCBCTRL   pVmcbNstGstCtrl = &pVmcbNstGst->ctrl;
    19561952        uint16_t const uGuestPauseFilterCount     = pVM->hm.s.svm.cPauseFilter;
     
    19811977 * @param   pVmcb       Pointer to the VM control block.
    19821978 */
    1983 static int hmR0SvmExportGuestApicTpr(PVMCPU pVCpu, PSVMVMCB pVmcb)
     1979static int hmR0SvmExportGuestApicTpr(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    19841980{
    19851981    if (ASMAtomicUoReadU64(&pVCpu->hm.s.fCtxChanged) & HM_CHANGED_GUEST_APIC_TPR)
    19861982    {
    1987         PVM pVM = pVCpu->CTX_SUFF(pVM);
     1983        PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    19881984        if (   PDMHasApic(pVM)
    19891985            && APICIsEnabled(pVCpu))
     
    20482044 * @remarks No-long-jump zone!!!
    20492045 */
    2050 static void hmR0SvmExportGuestXcptIntercepts(PVMCPU pVCpu, PSVMVMCB pVmcb)
     2046static void hmR0SvmExportGuestXcptIntercepts(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    20512047{
    20522048    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    20852081 * @param   pVmcbNstGst     Pointer to the nested-guest VM control block.
    20862082 */
    2087 static void hmR0SvmMergeVmcbCtrlsNested(PVMCPU pVCpu)
    2088 {
    2089     PVM          pVM             = pVCpu->CTX_SUFF(pVM);
     2083static void hmR0SvmMergeVmcbCtrlsNested(PVMCPUCC pVCpu)
     2084{
     2085    PVMCC          pVM             = pVCpu->CTX_SUFF(pVM);
    20902086    PCSVMVMCB    pVmcb           = pVCpu->hm.s.svm.pVmcb;
    20912087    PSVMVMCB     pVmcbNstGst     = pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pVmcb);
     
    21662162 * @remarks No-long-jump zone!!!
    21672163 */
    2168 static int hmR0SvmSelectVMRunHandler(PVMCPU pVCpu)
     2164static int hmR0SvmSelectVMRunHandler(PVMCPUCC pVCpu)
    21692165{
    21702166    if (CPUMIsGuestInLongMode(pVCpu))
     
    21962192 * @param   pVCpu       The cross context virtual CPU structure.
    21972193 */
    2198 VMMR0DECL(int) SVMR0Enter(PVMCPU pVCpu)
     2194VMMR0DECL(int) SVMR0Enter(PVMCPUCC pVCpu)
    21992195{
    22002196    AssertPtr(pVCpu);
     
    22192215 * @thread  EMT(pVCpu)
    22202216 */
    2221 VMMR0DECL(void) SVMR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPU pVCpu, bool fGlobalInit)
     2217VMMR0DECL(void) SVMR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPUCC pVCpu, bool fGlobalInit)
    22222218{
    22232219    NOREF(fGlobalInit);
     
    22892285 * @remarks No-long-jump zone!!!
    22902286 */
    2291 VMMR0DECL(int) SVMR0ExportHostState(PVMCPU pVCpu)
     2287VMMR0DECL(int) SVMR0ExportHostState(PVMCPUCC pVCpu)
    22922288{
    22932289    NOREF(pVCpu);
     
    23112307 * @remarks No-long-jump zone!!!
    23122308 */
    2313 static int hmR0SvmExportGuestState(PVMCPU pVCpu)
     2309static int hmR0SvmExportGuestState(PVMCPUCC pVCpu)
    23142310{
    23152311    STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatExportGuestState, x);
     
    23992395 * @remarks No-long-jmp zone!!!
    24002396 */
    2401 DECLINLINE(void) hmR0SvmMergeMsrpmNested(PHMPHYSCPU pHostCpu, PVMCPU pVCpu)
     2397DECLINLINE(void) hmR0SvmMergeMsrpmNested(PHMPHYSCPU pHostCpu, PVMCPUCC pVCpu)
    24022398{
    24032399    uint64_t const *pu64GstMsrpm    = (uint64_t const *)pVCpu->hm.s.svm.pvMsrBitmap;
     
    24212417 * @sa      HMNotifySvmNstGstVmexit.
    24222418 */
    2423 static bool hmR0SvmCacheVmcbNested(PVMCPU pVCpu)
     2419static bool hmR0SvmCacheVmcbNested(PVMCPUCC pVCpu)
    24242420{
    24252421    /*
     
    24652461 * @param   pVCpu           The cross context virtual CPU structure.
    24662462 */
    2467 static void hmR0SvmSetupVmcbNested(PVMCPU pVCpu)
     2463static void hmR0SvmSetupVmcbNested(PVMCPUCC pVCpu)
    24682464{
    24692465    PSVMVMCB     pVmcbNstGst     = pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pVmcb);
     
    25482544 * @remarks No-long-jump zone!!!
    25492545 */
    2550 static int hmR0SvmExportGuestStateNested(PVMCPU pVCpu)
     2546static int hmR0SvmExportGuestStateNested(PVMCPUCC pVCpu)
    25512547{
    25522548    STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatExportGuestState, x);
     
    26262622 * @remarks No-long-jump zone!!!
    26272623 */
    2628 static void hmR0SvmExportSharedState(PVMCPU pVCpu, PSVMVMCB pVmcb)
     2624static void hmR0SvmExportSharedState(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    26292625{
    26302626    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    26562652 * @param   fWhat   What to import, CPUMCTX_EXTRN_XXX.
    26572653 */
    2658 static void hmR0SvmImportGuestState(PVMCPU pVCpu, uint64_t fWhat)
     2654static void hmR0SvmImportGuestState(PVMCPUCC pVCpu, uint64_t fWhat)
    26592655{
    26602656    STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatImportGuestState, x);
     
    29252921 * @param   fWhat   What to import, CPUMCTX_EXTRN_XXX.
    29262922 */
    2927 VMMR0DECL(int) SVMR0ImportStateOnDemand(PVMCPU pVCpu, uint64_t fWhat)
     2923VMMR0DECL(int) SVMR0ImportStateOnDemand(PVMCPUCC pVCpu, uint64_t fWhat)
    29282924{
    29292925    hmR0SvmImportGuestState(pVCpu, fWhat);
     
    29422938 * @remarks No-long-jmp zone!!!
    29432939 */
    2944 static void hmR0SvmLeave(PVMCPU pVCpu, bool fImportState)
     2940static void hmR0SvmLeave(PVMCPUCC pVCpu, bool fImportState)
    29452941{
    29462942    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    29972993 * @param   pVCpu       The cross context virtual CPU structure.
    29982994 */
    2999 static int hmR0SvmLeaveSession(PVMCPU pVCpu)
     2995static int hmR0SvmLeaveSession(PVMCPUCC pVCpu)
    30002996{
    30012997    HM_DISABLE_PREEMPT(pVCpu);
     
    30363032 * @remarks No-long-jmp zone!!!
    30373033 */
    3038 static int hmR0SvmLongJmpToRing3(PVMCPU pVCpu)
     3034static int hmR0SvmLongJmpToRing3(PVMCPUCC pVCpu)
    30393035{
    30403036    return hmR0SvmLeaveSession(pVCpu);
     
    30513047 * @param   pvUser          The user argument, NULL (currently unused).
    30523048 */
    3053 static DECLCALLBACK(int) hmR0SvmCallRing3Callback(PVMCPU pVCpu, VMMCALLRING3 enmOperation, void *pvUser)
     3049static DECLCALLBACK(int) hmR0SvmCallRing3Callback(PVMCPUCC pVCpu, VMMCALLRING3 enmOperation, void *pvUser)
    30543050{
    30553051    RT_NOREF_PV(pvUser);
     
    31143110 *                      VINF_VMM_UNKNOWN_RING3_CALL.
    31153111 */
    3116 static int hmR0SvmExitToRing3(PVMCPU pVCpu, int rcExit)
     3112static int hmR0SvmExitToRing3(PVMCPUCC pVCpu, int rcExit)
    31173113{
    31183114    Assert(pVCpu);
     
    31893185 * @remarks No-long-jump zone!!!
    31903186 */
    3191 static void hmR0SvmUpdateTscOffsetting(PVMCPU pVCpu, PSVMVMCB pVmcb)
     3187static void hmR0SvmUpdateTscOffsetting(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    31923188{
    31933189    /*
     
    32403236 *          the guest i.e. 'StatInjectPendingReflect' is incremented always.
    32413237 */
    3242 DECLINLINE(void) hmR0SvmSetPendingEvent(PVMCPU pVCpu, PSVMEVENT pEvent, RTGCUINTPTR GCPtrFaultAddress)
     3238DECLINLINE(void) hmR0SvmSetPendingEvent(PVMCPUCC pVCpu, PSVMEVENT pEvent, RTGCUINTPTR GCPtrFaultAddress)
    32433239{
    32443240    Assert(!pVCpu->hm.s.Event.fPending);
     
    32593255 * @param   pVCpu       The cross context virtual CPU structure.
    32603256 */
    3261 DECLINLINE(void) hmR0SvmSetPendingXcptUD(PVMCPU pVCpu)
     3257DECLINLINE(void) hmR0SvmSetPendingXcptUD(PVMCPUCC pVCpu)
    32623258{
    32633259    SVMEVENT Event;
     
    32753271 * @param   pVCpu       The cross context virtual CPU structure.
    32763272 */
    3277 DECLINLINE(void) hmR0SvmSetPendingXcptDB(PVMCPU pVCpu)
     3273DECLINLINE(void) hmR0SvmSetPendingXcptDB(PVMCPUCC pVCpu)
    32783274{
    32793275    SVMEVENT Event;
     
    32953291 * @remarks This updates the guest CR2 with @a uFaultAddress!
    32963292 */
    3297 DECLINLINE(void) hmR0SvmSetPendingXcptPF(PVMCPU pVCpu, uint32_t u32ErrCode, RTGCUINTPTR uFaultAddress)
     3293DECLINLINE(void) hmR0SvmSetPendingXcptPF(PVMCPUCC pVCpu, uint32_t u32ErrCode, RTGCUINTPTR uFaultAddress)
    32983294{
    32993295    SVMEVENT Event;
     
    33233319 * @param   pVCpu       The cross context virtual CPU structure.
    33243320 */
    3325 DECLINLINE(void) hmR0SvmSetPendingXcptMF(PVMCPU pVCpu)
     3321DECLINLINE(void) hmR0SvmSetPendingXcptMF(PVMCPUCC pVCpu)
    33263322{
    33273323    SVMEVENT Event;
     
    33393335 * @param   pVCpu       The cross context virtual CPU structure.
    33403336 */
    3341 DECLINLINE(void) hmR0SvmSetPendingXcptDF(PVMCPU pVCpu)
     3337DECLINLINE(void) hmR0SvmSetPendingXcptDF(PVMCPUCC pVCpu)
    33423338{
    33433339    SVMEVENT Event;
     
    33633359 * @remarks Requires CR0!
    33643360 */
    3365 DECLINLINE(void) hmR0SvmInjectEventVmcb(PVMCPU pVCpu, PSVMVMCB pVmcb, PSVMEVENT pEvent)
     3361DECLINLINE(void) hmR0SvmInjectEventVmcb(PVMCPUCC pVCpu, PSVMVMCB pVmcb, PSVMEVENT pEvent)
    33663362{
    33673363    Assert(!pVmcb->ctrl.EventInject.n.u1Valid);
     
    33823378 * @param   pVCpu           The cross context virtual CPU structure.
    33833379 */
    3384 static void hmR0SvmTrpmTrapToPendingEvent(PVMCPU pVCpu)
     3380static void hmR0SvmTrpmTrapToPendingEvent(PVMCPUCC pVCpu)
    33853381{
    33863382    Assert(TRPMHasTrap(pVCpu));
     
    34553451 * @param   pVCpu           The cross context virtual CPU structure.
    34563452 */
    3457 static void hmR0SvmPendingEventToTrpmTrap(PVMCPU pVCpu)
     3453static void hmR0SvmPendingEventToTrpmTrap(PVMCPUCC pVCpu)
    34583454{
    34593455    Assert(pVCpu->hm.s.Event.fPending);
     
    34963492 * @remarks Has side-effects with VMCPU_FF_INHIBIT_INTERRUPTS force-flag.
    34973493 */
    3498 static bool hmR0SvmIsIntrShadowActive(PVMCPU pVCpu)
     3494static bool hmR0SvmIsIntrShadowActive(PVMCPUCC pVCpu)
    34993495{
    35003496    /*
     
    35273523 * @param   pVmcb   Pointer to the VM control block.
    35283524 */
    3529 static void hmR0SvmSetIntWindowExiting(PVMCPU pVCpu, PSVMVMCB pVmcb)
     3525static void hmR0SvmSetIntWindowExiting(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    35303526{
    35313527    /*
     
    35783574 * @param   pVmcb   Pointer to the VM control block.
    35793575 */
    3580 static void hmR0SvmClearIntWindowExiting(PVMCPU pVCpu, PSVMVMCB pVmcb)
     3576static void hmR0SvmClearIntWindowExiting(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    35813577{
    35823578    PSVMVMCBCTRL pVmcbCtrl = &pVmcb->ctrl;
     
    35993595 * @param   pVCpu       The cross context virtual CPU structure.
    36003596 */
    3601 static VBOXSTRICTRC hmR0SvmEvaluatePendingEventNested(PVMCPU pVCpu)
     3597static VBOXSTRICTRC hmR0SvmEvaluatePendingEventNested(PVMCPUCC pVCpu)
    36023598{
    36033599    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
     
    37253721 * @param   pVCpu       The cross context virtual CPU structure.
    37263722 */
    3727 static void hmR0SvmEvaluatePendingEvent(PVMCPU pVCpu)
     3723static void hmR0SvmEvaluatePendingEvent(PVMCPUCC pVCpu)
    37283724{
    37293725    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
     
    38273823 *          prematurely.
    38283824 */
    3829 static void hmR0SvmInjectPendingEvent(PVMCPU pVCpu, PSVMVMCB pVmcb)
     3825static void hmR0SvmInjectPendingEvent(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    38303826{
    38313827    Assert(!TRPMHasTrap(pVCpu));
     
    39283924 *                          guest-state).
    39293925 */
    3930 static void hmR0SvmReportWorldSwitchError(PVMCPU pVCpu, int rcVMRun)
     3926static void hmR0SvmReportWorldSwitchError(PVMCPUCC pVCpu, int rcVMRun)
    39313927{
    39323928    HMSVM_ASSERT_PREEMPT_SAFE(pVCpu);
     
    40864082 * @param   pVCpu       The cross context virtual CPU structure.
    40874083 */
    4088 static int hmR0SvmCheckForceFlags(PVMCPU pVCpu)
     4084static int hmR0SvmCheckForceFlags(PVMCPUCC pVCpu)
    40894085{
    40904086    Assert(VMMRZCallRing3IsEnabled(pVCpu));
     
    40994095        APICUpdatePendingInterrupts(pVCpu);
    41004096
    4101     PVM pVM = pVCpu->CTX_SUFF(pVM);
     4097    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    41024098    if (   VM_FF_IS_ANY_SET(pVM, !pVCpu->hm.s.fSingleInstruction
    41034099                            ? VM_FF_HP_R0_PRE_HM_MASK : VM_FF_HP_R0_PRE_HM_STEP_MASK)
     
    41724168 * @sa      hmR0SvmPreRunGuest.
    41734169 */
    4174 static int hmR0SvmPreRunGuestNested(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     4170static int hmR0SvmPreRunGuestNested(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    41754171{
    41764172    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
     
    42084204     * NB: If we could continue a task switch exit we wouldn't need to do this.
    42094205     */
    4210     PVM pVM = pVCpu->CTX_SUFF(pVM);
     4206    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    42114207    if (RT_UNLIKELY(   !pVM->hm.s.svm.u32Features
    42124208                    &&  pVCpu->hm.s.Event.fPending
     
    42944290 * @param   pSvmTransient   Pointer to the SVM transient structure.
    42954291 */
    4296 static int hmR0SvmPreRunGuest(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     4292static int hmR0SvmPreRunGuest(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    42974293{
    42984294    HMSVM_ASSERT_PREEMPT_SAFE(pVCpu);
     
    43144310     * NB: If we could continue a task switch exit we wouldn't need to do this.
    43154311     */
    4316     PVM pVM = pVCpu->CTX_SUFF(pVM);
     4312    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    43174313    if (RT_UNLIKELY(pVCpu->hm.s.Event.fPending && (((pVCpu->hm.s.Event.u64IntInfo >> 8) & 7) == SVM_EVENT_NMI)))
    43184314        if (RT_UNLIKELY(!pVM->hm.s.svm.u32Features))
     
    44004396 * @remarks No-long-jump zone!!!
    44014397 */
    4402 static void hmR0SvmPreRunGuestCommitted(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     4398static void hmR0SvmPreRunGuestCommitted(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    44034399{
    44044400    Assert(!VMMRZCallRing3IsEnabled(pVCpu));
     
    44094405    VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC);            /* Indicate the start of guest execution. */
    44104406
    4411     PVM      pVM   = pVCpu->CTX_SUFF(pVM);
     4407    PVMCC      pVM   = pVCpu->CTX_SUFF(pVM);
    44124408    PSVMVMCB pVmcb = pSvmTransient->pVmcb;
    44134409
     
    45244520 * @remarks No-long-jump zone!!!
    45254521 */
    4526 DECLINLINE(int) hmR0SvmRunGuest(PVMCPU pVCpu, RTHCPHYS HCPhysVmcb)
     4522DECLINLINE(int) hmR0SvmRunGuest(PVMCPUCC pVCpu, RTHCPHYS HCPhysVmcb)
    45274523{
    45284524    /* Mark that HM is the keeper of all guest-CPU registers now that we're going to execute guest code. */
     
    45374533     * Refer MSDN "Configuring Programs for 64-bit/x64 Software Conventions / Register Usage".
    45384534     */
    4539     PVM pVM = pVCpu->CTX_SUFF(pVM);
     4535    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    45404536#ifdef VBOX_WITH_KERNEL_USING_XMM
    45414537    return hmR0SVMRunWrapXMM(pVCpu->hm.s.svm.HCPhysVmcbHost, HCPhysVmcb, pCtx, pVM, pVCpu, pVCpu->hm.s.svm.pfnVMRun);
     
    45584554 *          unconditionally when it is safe to do so.
    45594555 */
    4560 static void hmR0SvmPostRunGuest(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient, int rcVMRun)
     4556static void hmR0SvmPostRunGuest(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient, int rcVMRun)
    45614557{
    45624558    Assert(!VMMRZCallRing3IsEnabled(pVCpu));
     
    46834679 * @param   pcLoops     Pointer to the number of executed loops.
    46844680 */
    4685 static int hmR0SvmRunGuestCodeNormal(PVMCPU pVCpu, uint32_t *pcLoops)
     4681static int hmR0SvmRunGuestCodeNormal(PVMCPUCC pVCpu, uint32_t *pcLoops)
    46864682{
    46874683    uint32_t const cMaxResumeLoops = pVCpu->CTX_SUFF(pVM)->hm.s.cMaxResumeLoops;
     
    47584754 * @param   pcLoops     Pointer to the number of executed loops.
    47594755 */
    4760 static int hmR0SvmRunGuestCodeStep(PVMCPU pVCpu, uint32_t *pcLoops)
     4756static int hmR0SvmRunGuestCodeStep(PVMCPUCC pVCpu, uint32_t *pcLoops)
    47614757{
    47624758    uint32_t const cMaxResumeLoops = pVCpu->CTX_SUFF(pVM)->hm.s.cMaxResumeLoops;
     
    48654861 *                      execution loop pass the remainder value, else pass 0.
    48664862 */
    4867 static int hmR0SvmRunGuestCodeNested(PVMCPU pVCpu, uint32_t *pcLoops)
     4863static int hmR0SvmRunGuestCodeNested(PVMCPUCC pVCpu, uint32_t *pcLoops)
    48684864{
    48694865    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
     
    49574953 * @param   pVCpu       The cross context virtual CPU structure.
    49584954 */
    4959 VMMR0DECL(VBOXSTRICTRC) SVMR0RunGuestCode(PVMCPU pVCpu)
     4955VMMR0DECL(VBOXSTRICTRC) SVMR0RunGuestCode(PVMCPUCC pVCpu)
    49604956{
    49614957    Assert(VMMRZCallRing3IsEnabled(pVCpu));
     
    50365032 * @param   pSvmTransient   Pointer to the SVM transient structure.
    50375033 */
    5038 static int hmR0SvmHandleExitNested(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     5034static int hmR0SvmHandleExitNested(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    50395035{
    50405036    HMSVM_ASSERT_IN_NESTED_GUEST(&pVCpu->cpum.GstCtx);
     
    51625158        case SVM_EXIT_XCPT_PF:
    51635159        {
    5164             PVM pVM = pVCpu->CTX_SUFF(pVM);
     5160            PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    51655161            if (pVM->hm.s.fNestedPaging)
    51665162            {
     
    54955491 * @param   pSvmTransient   Pointer to the SVM transient structure.
    54965492 */
    5497 static int hmR0SvmHandleExit(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     5493static int hmR0SvmHandleExit(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    54985494{
    54995495    Assert(pSvmTransient->u64ExitCode != SVM_EXIT_INVALID);
     
    57575753 * @remarks No-long-jump zone!!!
    57585754 */
    5759 static int hmR0SvmCheckExitDueToEventDelivery(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     5755static int hmR0SvmCheckExitDueToEventDelivery(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    57605756{
    57615757    int rc = VINF_SUCCESS;
     
    59065902 * @param   cb          RIP increment value in bytes.
    59075903 */
    5908 DECLINLINE(void) hmR0SvmAdvanceRip(PVMCPU pVCpu, uint32_t cb)
     5904DECLINLINE(void) hmR0SvmAdvanceRip(PVMCPUCC pVCpu, uint32_t cb)
    59095905{
    59105906    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
     
    59305926 * signals (SVM_EXIT_INTR, SVM_EXIT_NMI, SVM_EXIT_FERR_FREEZE, SVM_EXIT_INIT).
    59315927 */
    5932 HMSVM_EXIT_DECL hmR0SvmExitIntr(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     5928HMSVM_EXIT_DECL hmR0SvmExitIntr(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    59335929{
    59345930    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    59555951 * \#VMEXIT handler for WBINVD (SVM_EXIT_WBINVD). Conditional \#VMEXIT.
    59565952 */
    5957 HMSVM_EXIT_DECL hmR0SvmExitWbinvd(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     5953HMSVM_EXIT_DECL hmR0SvmExitWbinvd(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    59585954{
    59595955    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    59875983 * \#VMEXIT handler for INVD (SVM_EXIT_INVD). Unconditional \#VMEXIT.
    59885984 */
    5989 HMSVM_EXIT_DECL hmR0SvmExitInvd(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     5985HMSVM_EXIT_DECL hmR0SvmExitInvd(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    59905986{
    59915987    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    60196015 * \#VMEXIT handler for INVD (SVM_EXIT_CPUID). Conditional \#VMEXIT.
    60206016 */
    6021 HMSVM_EXIT_DECL hmR0SvmExitCpuid(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6017HMSVM_EXIT_DECL hmR0SvmExitCpuid(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    60226018{
    60236019    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    60736069 * \#VMEXIT handler for RDTSC (SVM_EXIT_RDTSC). Conditional \#VMEXIT.
    60746070 */
    6075 HMSVM_EXIT_DECL hmR0SvmExitRdtsc(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6071HMSVM_EXIT_DECL hmR0SvmExitRdtsc(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    60766072{
    60776073    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    61076103 * \#VMEXIT handler for RDTSCP (SVM_EXIT_RDTSCP). Conditional \#VMEXIT.
    61086104 */
    6109 HMSVM_EXIT_DECL hmR0SvmExitRdtscp(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6105HMSVM_EXIT_DECL hmR0SvmExitRdtscp(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    61106106{
    61116107    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    61416137 * \#VMEXIT handler for RDPMC (SVM_EXIT_RDPMC). Conditional \#VMEXIT.
    61426138 */
    6143 HMSVM_EXIT_DECL hmR0SvmExitRdpmc(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6139HMSVM_EXIT_DECL hmR0SvmExitRdpmc(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    61446140{
    61456141    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    61736169 * \#VMEXIT handler for INVLPG (SVM_EXIT_INVLPG). Conditional \#VMEXIT.
    61746170 */
    6175 HMSVM_EXIT_DECL hmR0SvmExitInvlpg(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6171HMSVM_EXIT_DECL hmR0SvmExitInvlpg(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    61766172{
    61776173    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    62096205 * \#VMEXIT handler for HLT (SVM_EXIT_HLT). Conditional \#VMEXIT.
    62106206 */
    6211 HMSVM_EXIT_DECL hmR0SvmExitHlt(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6207HMSVM_EXIT_DECL hmR0SvmExitHlt(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    62126208{
    62136209    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    62466242 * \#VMEXIT handler for MONITOR (SVM_EXIT_MONITOR). Conditional \#VMEXIT.
    62476243 */
    6248 HMSVM_EXIT_DECL hmR0SvmExitMonitor(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6244HMSVM_EXIT_DECL hmR0SvmExitMonitor(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    62496245{
    62506246    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    62836279 * \#VMEXIT handler for MWAIT (SVM_EXIT_MWAIT). Conditional \#VMEXIT.
    62846280 */
    6285 HMSVM_EXIT_DECL hmR0SvmExitMwait(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6281HMSVM_EXIT_DECL hmR0SvmExitMwait(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    62866282{
    62876283    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    63196315 * \#VMEXIT.
    63206316 */
    6321 HMSVM_EXIT_DECL hmR0SvmExitShutdown(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6317HMSVM_EXIT_DECL hmR0SvmExitShutdown(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    63226318{
    63236319    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    63306326 * \#VMEXIT handler for unexpected exits. Conditional \#VMEXIT.
    63316327 */
    6332 HMSVM_EXIT_DECL hmR0SvmExitUnexpected(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6328HMSVM_EXIT_DECL hmR0SvmExitUnexpected(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    63336329{
    63346330    PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
     
    63456341 * \#VMEXIT handler for CRx reads (SVM_EXIT_READ_CR*). Conditional \#VMEXIT.
    63466342 */
    6347 HMSVM_EXIT_DECL hmR0SvmExitReadCRx(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6343HMSVM_EXIT_DECL hmR0SvmExitReadCRx(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    63486344{
    63496345    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    64036399 * \#VMEXIT handler for CRx writes (SVM_EXIT_WRITE_CR*). Conditional \#VMEXIT.
    64046400 */
    6405 HMSVM_EXIT_DECL hmR0SvmExitWriteCRx(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6401HMSVM_EXIT_DECL hmR0SvmExitWriteCRx(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    64066402{
    64076403    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    65016497 * @param   pVmcb       Pointer to the VM control block.
    65026498 */
    6503 static VBOXSTRICTRC hmR0SvmExitReadMsr(PVMCPU pVCpu, PSVMVMCB pVmcb)
     6499static VBOXSTRICTRC hmR0SvmExitReadMsr(PVMCPUCC pVCpu, PSVMVMCB pVmcb)
    65046500{
    65056501    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitRdmsr);
     
    65456541 * @param   pSvmTransient   Pointer to the SVM-transient structure.
    65466542 */
    6547 static VBOXSTRICTRC hmR0SvmExitWriteMsr(PVMCPU pVCpu, PSVMVMCB pVmcb, PSVMTRANSIENT pSvmTransient)
     6543static VBOXSTRICTRC hmR0SvmExitWriteMsr(PVMCPUCC pVCpu, PSVMVMCB pVmcb, PSVMTRANSIENT pSvmTransient)
    65486544{
    65496545    PCPUMCTX pCtx  = &pVCpu->cpum.GstCtx;
     
    66536649 * \#VMEXIT.
    66546650 */
    6655 HMSVM_EXIT_DECL hmR0SvmExitMsr(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6651HMSVM_EXIT_DECL hmR0SvmExitMsr(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    66566652{
    66576653    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    66696665 * \#VMEXIT handler for DRx read (SVM_EXIT_READ_DRx). Conditional \#VMEXIT.
    66706666 */
    6671 HMSVM_EXIT_DECL hmR0SvmExitReadDRx(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6667HMSVM_EXIT_DECL hmR0SvmExitReadDRx(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    66726668{
    66736669    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    67406736 * \#VMEXIT handler for DRx write (SVM_EXIT_WRITE_DRx). Conditional \#VMEXIT.
    67416737 */
    6742 HMSVM_EXIT_DECL hmR0SvmExitWriteDRx(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6738HMSVM_EXIT_DECL hmR0SvmExitWriteDRx(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    67436739{
    67446740    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    67546750 * \#VMEXIT handler for XCRx write (SVM_EXIT_XSETBV). Conditional \#VMEXIT.
    67556751 */
    6756 HMSVM_EXIT_DECL hmR0SvmExitXsetbv(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6752HMSVM_EXIT_DECL hmR0SvmExitXsetbv(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    67576753{
    67586754    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    67816777 * \#VMEXIT handler for I/O instructions (SVM_EXIT_IOIO). Conditional \#VMEXIT.
    67826778 */
    6783 HMSVM_EXIT_DECL hmR0SvmExitIOInstr(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6779HMSVM_EXIT_DECL hmR0SvmExitIOInstr(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    67846780{
    67856781    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    67906786    static uint32_t const s_aIOOpAnd[8] = { 0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0 };  /* AND masks for saving
    67916787                                                                                           the result (in AL/AX/EAX). */
    6792     PVM      pVM   = pVCpu->CTX_SUFF(pVM);
     6788    PVMCC      pVM   = pVCpu->CTX_SUFF(pVM);
    67936789    PCPUMCTX pCtx  = &pVCpu->cpum.GstCtx;
    67946790    PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
     
    70207016 * \#VMEXIT handler for Nested Page-faults (SVM_EXIT_NPF). Conditional \#VMEXIT.
    70217017 */
    7022 HMSVM_EXIT_DECL hmR0SvmExitNestedPF(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7018HMSVM_EXIT_DECL hmR0SvmExitNestedPF(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    70237019{
    70247020    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    70267022    HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(pVCpu, pSvmTransient);
    70277023
    7028     PVM      pVM  = pVCpu->CTX_SUFF(pVM);
     7024    PVMCC      pVM  = pVCpu->CTX_SUFF(pVM);
    70297025    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    70307026    Assert(pVM->hm.s.fNestedPaging);
     
    71717167 * \#VMEXIT.
    71727168 */
    7173 HMSVM_EXIT_DECL hmR0SvmExitVIntr(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7169HMSVM_EXIT_DECL hmR0SvmExitVIntr(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    71747170{
    71757171    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    71907186 * \#VMEXIT.
    71917187 */
    7192 HMSVM_EXIT_DECL hmR0SvmExitTaskSwitch(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7188HMSVM_EXIT_DECL hmR0SvmExitTaskSwitch(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    71937189{
    71947190    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    72217217 * \#VMEXIT handler for VMMCALL (SVM_EXIT_VMMCALL). Conditional \#VMEXIT.
    72227218 */
    7223 HMSVM_EXIT_DECL hmR0SvmExitVmmCall(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7219HMSVM_EXIT_DECL hmR0SvmExitVmmCall(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    72247220{
    72257221    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    72267222    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    72277223
    7228     PVM pVM = pVCpu->CTX_SUFF(pVM);
     7224    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    72297225    if (pVM->hm.s.fTprPatchingAllowed)
    72307226    {
     
    72787274 * \#VMEXIT handler for VMMCALL (SVM_EXIT_VMMCALL). Conditional \#VMEXIT.
    72797275 */
    7280 HMSVM_EXIT_DECL hmR0SvmExitPause(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7276HMSVM_EXIT_DECL hmR0SvmExitPause(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    72817277{
    72827278    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    73117307 * \#VMEXIT.
    73127308 */
    7313 HMSVM_EXIT_DECL hmR0SvmExitFerrFreeze(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7309HMSVM_EXIT_DECL hmR0SvmExitFerrFreeze(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    73147310{
    73157311    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    73257321 * \#VMEXIT handler for IRET (SVM_EXIT_IRET). Conditional \#VMEXIT.
    73267322 */
    7327 HMSVM_EXIT_DECL hmR0SvmExitIret(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7323HMSVM_EXIT_DECL hmR0SvmExitIret(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    73287324{
    73297325    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    73467342 * Conditional \#VMEXIT.
    73477343 */
    7348 HMSVM_EXIT_DECL hmR0SvmExitXcptPF(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7344HMSVM_EXIT_DECL hmR0SvmExitXcptPF(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    73497345{
    73507346    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    73537349
    73547350    /* See AMD spec. 15.12.15 "#PF (Page Fault)". */
    7355     PVM             pVM           = pVCpu->CTX_SUFF(pVM);
     7351    PVMCC             pVM           = pVCpu->CTX_SUFF(pVM);
    73567352    PCPUMCTX        pCtx          = &pVCpu->cpum.GstCtx;
    73577353    PSVMVMCB        pVmcb         = hmR0SvmGetCurrentVmcb(pVCpu);
     
    74877483 * Conditional \#VMEXIT.
    74887484 */
    7489 HMSVM_EXIT_DECL hmR0SvmExitXcptUD(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7485HMSVM_EXIT_DECL hmR0SvmExitXcptUD(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    74907486{
    74917487    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    75347530 * Conditional \#VMEXIT.
    75357531 */
    7536 HMSVM_EXIT_DECL hmR0SvmExitXcptMF(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7532HMSVM_EXIT_DECL hmR0SvmExitXcptMF(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    75377533{
    75387534    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    75507546    if (!(pCtx->cr0 & X86_CR0_NE))
    75517547    {
    7552         PVM       pVM  = pVCpu->CTX_SUFF(pVM);
     7548        PVMCC       pVM  = pVCpu->CTX_SUFF(pVM);
    75537549        PDISSTATE pDis = &pVCpu->hm.s.DisState;
    75547550        unsigned  cbInstr;
     
    75757571 * \#VMEXIT.
    75767572 */
    7577 HMSVM_EXIT_DECL hmR0SvmExitXcptDB(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7573HMSVM_EXIT_DECL hmR0SvmExitXcptDB(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    75787574{
    75797575    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    75957591     * handler expects. See AMD spec. 15.12.2 "#DB (Debug)".
    75967592     */
    7597     PVM      pVM   = pVCpu->CTX_SUFF(pVM);
     7593    PVMCC      pVM   = pVCpu->CTX_SUFF(pVM);
    75987594    PSVMVMCB pVmcb = pVCpu->hm.s.svm.pVmcb;
    75997595    PCPUMCTX pCtx  = &pVCpu->cpum.GstCtx;
     
    76337629 * Conditional \#VMEXIT.
    76347630 */
    7635 HMSVM_EXIT_DECL hmR0SvmExitXcptAC(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7631HMSVM_EXIT_DECL hmR0SvmExitXcptAC(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    76367632{
    76377633    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    76547650 * Conditional \#VMEXIT.
    76557651 */
    7656 HMSVM_EXIT_DECL hmR0SvmExitXcptBP(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7652HMSVM_EXIT_DECL hmR0SvmExitXcptBP(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    76577653{
    76587654    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    76837679 * @sa hmR0VmxHandleMesaDrvGp
    76847680 */
    7685 static int hmR0SvmHandleMesaDrvGp(PVMCPU pVCpu, PCPUMCTX pCtx, PCSVMVMCB pVmcb)
     7681static int hmR0SvmHandleMesaDrvGp(PVMCPUCC pVCpu, PCPUMCTX pCtx, PCSVMVMCB pVmcb)
    76867682{
    76877683    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_CS  | CPUMCTX_EXTRN_RIP | CPUMCTX_EXTRN_RFLAGS | CPUMCTX_EXTRN_GPRS_MASK);
     
    77067702 * @sa      hmR0VmxIsMesaDrvGp
    77077703 */
    7708 DECLINLINE(bool) hmR0SvmIsMesaDrvGp(PVMCPU pVCpu, PCPUMCTX pCtx, PCSVMVMCB pVmcb)
     7704DECLINLINE(bool) hmR0SvmIsMesaDrvGp(PVMCPUCC pVCpu, PCPUMCTX pCtx, PCSVMVMCB pVmcb)
    77097705{
    77107706    /* Check magic and port. */
     
    77547750 * Conditional \#VMEXIT.
    77557751 */
    7756 HMSVM_EXIT_DECL hmR0SvmExitXcptGP(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7752HMSVM_EXIT_DECL hmR0SvmExitXcptGP(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    77577753{
    77587754    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    77857781 * \#VMEXIT handler for generic exceptions. Conditional \#VMEXIT.
    77867782 */
    7787 HMSVM_EXIT_DECL hmR0SvmExitXcptGeneric(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7783HMSVM_EXIT_DECL hmR0SvmExitXcptGeneric(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    77887784{
    77897785    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    78537849 * \#VMEXIT handler for CLGI (SVM_EXIT_CLGI). Conditional \#VMEXIT.
    78547850 */
    7855 HMSVM_EXIT_DECL hmR0SvmExitClgi(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7851HMSVM_EXIT_DECL hmR0SvmExitClgi(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    78567852{
    78577853    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    78917887 * \#VMEXIT handler for STGI (SVM_EXIT_STGI). Conditional \#VMEXIT.
    78927888 */
    7893 HMSVM_EXIT_DECL hmR0SvmExitStgi(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7889HMSVM_EXIT_DECL hmR0SvmExitStgi(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    78947890{
    78957891    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    79337929 * \#VMEXIT handler for VMLOAD (SVM_EXIT_VMLOAD). Conditional \#VMEXIT.
    79347930 */
    7935 HMSVM_EXIT_DECL hmR0SvmExitVmload(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7931HMSVM_EXIT_DECL hmR0SvmExitVmload(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    79367932{
    79377933    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    79787974 * \#VMEXIT handler for VMSAVE (SVM_EXIT_VMSAVE). Conditional \#VMEXIT.
    79797975 */
    7980 HMSVM_EXIT_DECL hmR0SvmExitVmsave(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7976HMSVM_EXIT_DECL hmR0SvmExitVmsave(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    79817977{
    79827978    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    80128008 * \#VMEXIT handler for INVLPGA (SVM_EXIT_INVLPGA). Conditional \#VMEXIT.
    80138009 */
    8014 HMSVM_EXIT_DECL hmR0SvmExitInvlpga(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     8010HMSVM_EXIT_DECL hmR0SvmExitInvlpga(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    80158011{
    80168012    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    80448040 * \#VMEXIT handler for STGI (SVM_EXIT_VMRUN). Conditional \#VMEXIT.
    80458041 */
    8046 HMSVM_EXIT_DECL hmR0SvmExitVmrun(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     8042HMSVM_EXIT_DECL hmR0SvmExitVmrun(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    80478043{
    80488044    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    80898085 * Unconditional \#VMEXIT.
    80908086 */
    8091 HMSVM_EXIT_DECL hmR0SvmNestedExitXcptDB(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     8087HMSVM_EXIT_DECL hmR0SvmNestedExitXcptDB(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    80928088{
    80938089    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     
    81098105 * Conditional \#VMEXIT.
    81108106 */
    8111 HMSVM_EXIT_DECL hmR0SvmNestedExitXcptBP(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     8107HMSVM_EXIT_DECL hmR0SvmNestedExitXcptBP(PVMCPUCC pVCpu, PSVMTRANSIENT pSvmTransient)
    81128108{
    81138109    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.h

    r80052 r80274  
    3939VMMR0DECL(int)          SVMR0GlobalInit(void);
    4040VMMR0DECL(void)         SVMR0GlobalTerm(void);
    41 VMMR0DECL(int)          SVMR0Enter(PVMCPU pVCpu);
    42 VMMR0DECL(void)         SVMR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPU pVCpu, bool fGlobalInit);
    43 VMMR0DECL(int)          SVMR0EnableCpu(PHMPHYSCPU pHostCpu, PVM pVM, void *pvPageCpu, RTHCPHYS HCPhysCpuPage,
     41VMMR0DECL(int)          SVMR0Enter(PVMCPUCC pVCpu);
     42VMMR0DECL(void)         SVMR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPUCC pVCpu, bool fGlobalInit);
     43VMMR0DECL(int)          SVMR0EnableCpu(PHMPHYSCPU pHostCpu, PVMCC pVM, void *pvPageCpu, RTHCPHYS HCPhysCpuPage,
    4444                                       bool fEnabledBySystem, PCSUPHWVIRTMSRS pHwvirtMsrs);
    4545VMMR0DECL(int)          SVMR0DisableCpu(void *pvPageCpu, RTHCPHYS pPageCpuPhys);
    46 VMMR0DECL(int)          SVMR0InitVM(PVM pVM);
    47 VMMR0DECL(int)          SVMR0TermVM(PVM pVM);
    48 VMMR0DECL(int)          SVMR0SetupVM(PVM pVM);
    49 VMMR0DECL(VBOXSTRICTRC) SVMR0RunGuestCode(PVMCPU pVCpu);
    50 VMMR0DECL(int)          SVMR0ExportHostState(PVMCPU pVCpu);
    51 VMMR0DECL(int)          SVMR0ImportStateOnDemand(PVMCPU pVCpu, uint64_t fWhat);
    52 VMMR0DECL(int)          SVMR0InvalidatePage(PVMCPU pVCpu, RTGCPTR GCVirt);
     46VMMR0DECL(int)          SVMR0InitVM(PVMCC pVM);
     47VMMR0DECL(int)          SVMR0TermVM(PVMCC pVM);
     48VMMR0DECL(int)          SVMR0SetupVM(PVMCC pVM);
     49VMMR0DECL(VBOXSTRICTRC) SVMR0RunGuestCode(PVMCPUCC pVCpu);
     50VMMR0DECL(int)          SVMR0ExportHostState(PVMCPUCC pVCpu);
     51VMMR0DECL(int)          SVMR0ImportStateOnDemand(PVMCPUCC pVCpu, uint64_t fWhat);
     52VMMR0DECL(int)          SVMR0InvalidatePage(PVMCPUCC pVCpu, RTGCPTR GCVirt);
    5353
    5454/**
     
    6262 * @param   pVCpu           The cross context virtual CPU structure. (Not used.)
    6363 */
    64 DECLASM(int) SVMR0VMRun(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu);
     64DECLASM(int) SVMR0VMRun(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVMCC pVM, PVMCPUCC pVCpu);
    6565
    6666
     
    7575 * @param   pVCpu           The cross context virtual CPU structure. (Not used.)
    7676 */
    77 DECLASM(int) SVMR0VMRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu);
     77DECLASM(int) SVMR0VMRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVMCC pVM, PVMCPUCC pVCpu);
    7878
    7979/**
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r80273 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_HM
    2324#define VMCPU_INCL_CPUM_GST_CTX
     
    4041#endif
    4142#include "HMInternal.h"
    42 #include <VBox/vmm/vm.h>
     43#include <VBox/vmm/vmcc.h>
    4344#include <VBox/vmm/hmvmxinline.h>
    4445#include "HMVMXR0.h"
     
    292293 */
    293294#ifndef HMVMX_USE_FUNCTION_TABLE
    294 typedef VBOXSTRICTRC               FNVMXEXITHANDLER(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient);
     295typedef VBOXSTRICTRC               FNVMXEXITHANDLER(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient);
    295296#else
    296 typedef DECLCALLBACK(VBOXSTRICTRC) FNVMXEXITHANDLER(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient);
     297typedef DECLCALLBACK(VBOXSTRICTRC) FNVMXEXITHANDLER(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient);
    297298/** Pointer to VM-exit handler. */
    298299typedef FNVMXEXITHANDLER          *PFNVMXEXITHANDLER;
     
    313314 */
    314315#ifndef HMVMX_USE_FUNCTION_TABLE
    315 typedef int                        FNVMXEXITHANDLERNSRC(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient);
     316typedef int                        FNVMXEXITHANDLERNSRC(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient);
    316317#else
    317318typedef FNVMXEXITHANDLER           FNVMXEXITHANDLERNSRC;
     
    323324*********************************************************************************************************************************/
    324325#ifndef HMVMX_USE_FUNCTION_TABLE
    325 DECLINLINE(VBOXSTRICTRC)           hmR0VmxHandleExit(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient);
     326DECLINLINE(VBOXSTRICTRC)           hmR0VmxHandleExit(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient);
    326327# define HMVMX_EXIT_DECL           DECLINLINE(VBOXSTRICTRC)
    327328# define HMVMX_EXIT_NSRC_DECL      DECLINLINE(int)
     
    331332#endif
    332333#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
    333 DECLINLINE(VBOXSTRICTRC)           hmR0VmxHandleExitNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient);
     334DECLINLINE(VBOXSTRICTRC)           hmR0VmxHandleExitNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient);
    334335#endif
    335336
    336 static int hmR0VmxImportGuestState(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo, uint64_t fWhat);
     337static int hmR0VmxImportGuestState(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo, uint64_t fWhat);
    337338
    338339/** @name VM-exit handler prototypes.
     
    844845 * @param   pVCpu   The cross context virtual CPU structure.
    845846 */
    846 DECL_FORCE_INLINE(uint64_t) hmR0VmxGetFixedCr0Mask(PCVMCPU pVCpu)
     847DECL_FORCE_INLINE(uint64_t) hmR0VmxGetFixedCr0Mask(PCVMCPUCC pVCpu)
    847848{
    848849    /*
     
    853854     *        enmGuestMode to be in-sync with the current mode. See @bugref{6398}
    854855     *        and @bugref{6944}. */
    855     PVM pVM = pVCpu->CTX_SUFF(pVM);
     856    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    856857    return (  X86_CR0_PE
    857858            | X86_CR0_NE
     
    873874 * @param   pVCpu   The cross context virtual CPU structure.
    874875 */
    875 DECL_FORCE_INLINE(uint64_t) hmR0VmxGetFixedCr4Mask(PCVMCPU pVCpu)
     876DECL_FORCE_INLINE(uint64_t) hmR0VmxGetFixedCr4Mask(PCVMCPUCC pVCpu)
    876877{
    877878    /*
     
    881882     * these  bits and handle it depending on whether we expose them to the guest.
    882883     */
    883     PVM pVM = pVCpu->CTX_SUFF(pVM);
     884    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    884885    bool const fXSaveRstor = pVM->cpum.ro.HostFeatures.fXSaveRstor;
    885886    bool const fPcid       = pVM->cpum.ro.HostFeatures.fPcid;
     
    936937 *          controls if the guest hypervisor has set any one of them.
    937938 */
    938 static void hmR0VmxRemoveProcCtlsVmcs(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, uint32_t uProcCtls)
     939static void hmR0VmxRemoveProcCtlsVmcs(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, uint32_t uProcCtls)
    939940{
    940941    PVMXVMCSINFO pVmcsInfo = pVmxTransient->pVmcsInfo;
     
    10221023 * @param   uXcptMask       The exception(s) to remove.
    10231024 */
    1024 static int hmR0VmxRemoveXcptInterceptMask(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, uint32_t uXcptMask)
     1025static int hmR0VmxRemoveXcptInterceptMask(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, uint32_t uXcptMask)
    10251026{
    10261027    PVMXVMCSINFO pVmcsInfo = pVmxTransient->pVmcsInfo;
     
    10841085 * @param   uXcpt           The exception to remove.
    10851086 */
    1086 static int hmR0VmxRemoveXcptIntercept(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, uint8_t uXcpt)
     1087static int hmR0VmxRemoveXcptIntercept(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, uint8_t uXcpt)
    10871088{
    10881089    return hmR0VmxRemoveXcptInterceptMask(pVCpu, pVmxTransient, RT_BIT(uXcpt));
     
    12341235 *                                  true) or guest VMCS (pass false).
    12351236 */
    1236 static int hmR0VmxSwitchToGstOrNstGstVmcs(PVMCPU pVCpu, bool fSwitchToNstGstVmcs)
     1237static int hmR0VmxSwitchToGstOrNstGstVmcs(PVMCPUCC pVCpu, bool fSwitchToNstGstVmcs)
    12371238{
    12381239    /* Ensure we have synced everything from the guest-CPU context to the VMCS before switching. */
     
    13071308 * @param   rc      The error code.
    13081309 */
    1309 static void hmR0VmxUpdateErrorRecord(PVMCPU pVCpu, int rc)
     1310static void hmR0VmxUpdateErrorRecord(PVMCPUCC pVCpu, int rc)
    13101311{
    13111312    if (   rc == VERR_VMX_INVALID_VMCS_FIELD
     
    15501551 * @param   pvCpuPage       Pointer to the VMXON region.
    15511552 */
    1552 static int hmR0VmxEnterRootMode(PVM pVM, RTHCPHYS HCPhysCpuPage, void *pvCpuPage)
     1553static int hmR0VmxEnterRootMode(PVMCC pVM, RTHCPHYS HCPhysCpuPage, void *pvCpuPage)
    15531554{
    15541555    Assert(HCPhysCpuPage && HCPhysCpuPage != NIL_RTHCPHYS);
     
    16981699 * @param   pVmcsInfo   The VMCS info. object.
    16991700 */
    1700 static void hmR0VmxFreeVmcsInfo(PVM pVM, PVMXVMCSINFO pVmcsInfo)
     1701static void hmR0VmxFreeVmcsInfo(PVMCC pVM, PVMXVMCSINFO pVmcsInfo)
    17011702{
    17021703    hmR0VmxPageFree(&pVmcsInfo->hMemObjVmcs, &pVmcsInfo->pvVmcs, &pVmcsInfo->HCPhysVmcs);
     
    17261727 * @param   fIsNstGstVmcs   Whether this is a nested-guest VMCS.
    17271728 */
    1728 static int hmR0VmxAllocVmcsInfo(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo, bool fIsNstGstVmcs)
    1729 {
    1730     PVM pVM = pVCpu->CTX_SUFF(pVM);
     1729static int hmR0VmxAllocVmcsInfo(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo, bool fIsNstGstVmcs)
     1730{
     1731    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    17311732
    17321733    /* Allocate the guest VM control structure (VMCS). */
     
    18281829 * @param   pVM     The cross context VM structure.
    18291830 */
    1830 static void hmR0VmxStructsFree(PVM pVM)
     1831static void hmR0VmxStructsFree(PVMCC pVM)
    18311832{
    18321833#ifdef VBOX_WITH_CRASHDUMP_MAGIC
     
    18471848    for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
    18481849    {
    1849         PVMCPU pVCpu = &pVM->aCpus[idCpu];
     1850        PVMCPUCC pVCpu = VMCC_GET_CPU(pVM, idCpu);
    18501851        PVMXVMCSINFO pVmcsInfo = &pVCpu->hm.s.vmx.VmcsInfo;
    18511852        hmR0VmxFreeVmcsInfo(pVM, pVmcsInfo);
     
    18671868 * @param   pVM     The cross context VM structure.
    18681869 */
    1869 static int hmR0VmxStructsAlloc(PVM pVM)
     1870static int hmR0VmxStructsAlloc(PVMCC pVM)
    18701871{
    18711872    /*
     
    18801881    else
    18811882    {
    1882          pVM->aCpus[0].hm.s.u32HMError = VMX_UFC_INVALID_VMCS_SIZE;
    1883          return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
     1883        VMCC_GET_CPU_0(pVM)->hm.s.u32HMError = VMX_UFC_INVALID_VMCS_SIZE;
     1884        return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
    18841885    }
    18851886
     
    18991900    for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
    19001901    {
    1901         PVMCPU pVCpu = &pVM->aCpus[idCpu];
     1902        PVMCPUCC pVCpu = VMCC_GET_CPU(pVM, idCpu);
    19021903        hmR0VmxInitVmcsInfo(&pVCpu->hm.s.vmx.VmcsInfo);
    19031904        hmR0VmxInitVmcsInfo(&pVCpu->hm.s.vmx.VmcsInfoNstGst);
     
    19681969    {
    19691970        /* Allocate the guest VMCS structures. */
    1970         PVMCPU pVCpu = &pVM->aCpus[idCpu];
     1971        PVMCPUCC pVCpu = VMCC_GET_CPU(pVM, idCpu);
    19711972        rc = hmR0VmxAllocVmcsInfo(pVCpu, &pVCpu->hm.s.vmx.VmcsInfo, false /* fIsNstGstVmcs */);
    19721973        if (RT_SUCCESS(rc))
     
    20332034 * @remarks Can be called with interrupts disabled.
    20342035 */
    2035 static void hmR0VmxSetMsrPermission(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo, bool fIsNstGstVmcs, uint32_t idMsr, uint32_t fMsrpm)
     2036static void hmR0VmxSetMsrPermission(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo, bool fIsNstGstVmcs, uint32_t idMsr, uint32_t fMsrpm)
    20362037{
    20372038    uint8_t *pbMsrBitmap = (uint8_t *)pVmcsInfo->pvMsrBitmap;
     
    21212122 * @param   cMsrs       The number of MSRs.
    21222123 */
    2123 static int hmR0VmxSetAutoLoadStoreMsrCount(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo, uint32_t cMsrs)
     2124static int hmR0VmxSetAutoLoadStoreMsrCount(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo, uint32_t cMsrs)
    21242125{
    21252126    /* Shouldn't ever happen but there -is- a number. We're well within the recommended 512. */
     
    21612162 *                          necessary.
    21622163 */
    2163 static int hmR0VmxAddAutoLoadStoreMsr(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, uint32_t idMsr, uint64_t uGuestMsrValue,
     2164static int hmR0VmxAddAutoLoadStoreMsr(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, uint32_t idMsr, uint64_t uGuestMsrValue,
    21642165                                      bool fSetReadWrite, bool fUpdateHostMsr)
    21652166{
     
    22512252 * @param   idMsr           The MSR.
    22522253 */
    2253 static int hmR0VmxRemoveAutoLoadStoreMsr(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, uint32_t idMsr)
     2254static int hmR0VmxRemoveAutoLoadStoreMsr(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, uint32_t idMsr)
    22542255{
    22552256    PVMXVMCSINFO pVmcsInfo     = pVmxTransient->pVmcsInfo;
     
    23452346 * @remarks No-long-jump zone!!!
    23462347 */
    2347 static void hmR0VmxUpdateAutoLoadHostMsrs(PCVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo)
     2348static void hmR0VmxUpdateAutoLoadHostMsrs(PCVMCPUCC pVCpu, PCVMXVMCSINFO pVmcsInfo)
    23482349{
    23492350    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    23762377 * @remarks No-long-jump zone!!!
    23772378 */
    2378 static void hmR0VmxLazySaveHostMsrs(PVMCPU pVCpu)
     2379static void hmR0VmxLazySaveHostMsrs(PVMCPUCC pVCpu)
    23792380{
    23802381    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    24062407 * @param   idMsr   The MSR to check.
    24072408 */
    2408 static bool hmR0VmxIsLazyGuestMsr(PCVMCPU pVCpu, uint32_t idMsr)
     2409static bool hmR0VmxIsLazyGuestMsr(PCVMCPUCC pVCpu, uint32_t idMsr)
    24092410{
    24102411    if (pVCpu->CTX_SUFF(pVM)->hm.s.fAllow64BitGuests)
     
    24352436 * @remarks No-long-jump zone!!!
    24362437 */
    2437 static void hmR0VmxLazyLoadGuestMsrs(PVMCPU pVCpu)
     2438static void hmR0VmxLazyLoadGuestMsrs(PVMCPUCC pVCpu)
    24382439{
    24392440    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    24892490 *          context by hmR0VmxImportGuestState()!!!
    24902491 */
    2491 static void hmR0VmxLazyRestoreHostMsrs(PVMCPU pVCpu)
     2492static void hmR0VmxLazyRestoreHostMsrs(PVMCPUCC pVCpu)
    24922493{
    24932494    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    25222523 * @param   fIsNstGstVmcs   Whether this is a nested-guest VMCS.
    25232524 */
    2524 static int hmR0VmxCheckVmcsCtls(PVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo, bool fIsNstGstVmcs)
     2525static int hmR0VmxCheckVmcsCtls(PVMCPUCC pVCpu, PCVMXVMCSINFO pVmcsInfo, bool fIsNstGstVmcs)
    25252526{
    25262527    const char * const pcszVmcs = fIsNstGstVmcs ? "Nested-guest VMCS" : "VMCS";
     
    25922593 * @param   pVmcsInfo   The VMCS info. object.
    25932594 */
    2594 static void hmR0VmxCheckHostEferMsr(PCVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo)
     2595static void hmR0VmxCheckHostEferMsr(PCVMCPUCC pVCpu, PCVMXVMCSINFO pVmcsInfo)
    25952596{
    25962597    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    26202621 * @param   fIsNstGstVmcs   Whether this is a nested-guest VMCS.
    26212622 */
    2622 static void hmR0VmxCheckAutoLoadStoreMsrs(PVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo, bool fIsNstGstVmcs)
     2623static void hmR0VmxCheckAutoLoadStoreMsrs(PVMCPUCC pVCpu, PCVMXVMCSINFO pVmcsInfo, bool fIsNstGstVmcs)
    26232624{
    26242625    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    27352736 * @remarks Can be called with interrupts disabled.
    27362737 */
    2737 static void hmR0VmxFlushEpt(PVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo, VMXTLBFLUSHEPT enmTlbFlush)
     2738static void hmR0VmxFlushEpt(PVMCPUCC pVCpu, PCVMXVMCSINFO pVmcsInfo, VMXTLBFLUSHEPT enmTlbFlush)
    27382739{
    27392740    uint64_t au64Descriptor[2];
     
    27692770 * @remarks Can be called with interrupts disabled.
    27702771 */
    2771 static void hmR0VmxFlushVpid(PVMCPU pVCpu, VMXTLBFLUSHVPID enmTlbFlush, RTGCPTR GCPtr)
     2772static void hmR0VmxFlushVpid(PVMCPUCC pVCpu, VMXTLBFLUSHVPID enmTlbFlush, RTGCPTR GCPtr)
    27722773{
    27732774    Assert(pVCpu->CTX_SUFF(pVM)->hm.s.vmx.fVpid);
     
    28072808 * @param   GCVirt  Guest virtual address of the page to invalidate.
    28082809 */
    2809 VMMR0DECL(int) VMXR0InvalidatePage(PVMCPU pVCpu, RTGCPTR GCVirt)
     2810VMMR0DECL(int) VMXR0InvalidatePage(PVMCPUCC pVCpu, RTGCPTR GCVirt)
    28102811{
    28112812    AssertPtr(pVCpu);
     
    28212822         * as this function maybe called in a loop with individual addresses.
    28222823         */
    2823         PVM pVM = pVCpu->CTX_SUFF(pVM);
     2824        PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    28242825        if (pVM->hm.s.vmx.fVpid)
    28252826        {
     
    28502851 * @remarks Called with interrupts disabled.
    28512852 */
    2852 static void hmR0VmxFlushTaggedTlbNone(PHMPHYSCPU pHostCpu, PVMCPU pVCpu)
     2853static void hmR0VmxFlushTaggedTlbNone(PHMPHYSCPU pHostCpu, PVMCPUCC pVCpu)
    28532854{
    28542855    AssertPtr(pVCpu);
     
    28782879 * @remarks  Called with interrupts disabled.
    28792880 */
    2880 static void hmR0VmxFlushTaggedTlbBoth(PHMPHYSCPU pHostCpu, PVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo)
     2881static void hmR0VmxFlushTaggedTlbBoth(PHMPHYSCPU pHostCpu, PVMCPUCC pVCpu, PCVMXVMCSINFO pVmcsInfo)
    28812882{
    28822883#ifdef VBOX_WITH_STATISTICS
     
    28962897    Assert(pHostCpu->idCpu != NIL_RTCPUID);
    28972898
    2898     PVM pVM = pVCpu->CTX_SUFF(pVM);
     2899    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    28992900    AssertMsg(pVM->hm.s.fNestedPaging && pVM->hm.s.vmx.fVpid,
    29002901              ("hmR0VmxFlushTaggedTlbBoth cannot be invoked unless NestedPaging & VPID are enabled."
     
    29912992 * @remarks Called with interrupts disabled.
    29922993 */
    2993 static void hmR0VmxFlushTaggedTlbEpt(PHMPHYSCPU pHostCpu, PVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo)
     2994static void hmR0VmxFlushTaggedTlbEpt(PHMPHYSCPU pHostCpu, PVMCPUCC pVCpu, PCVMXVMCSINFO pVmcsInfo)
    29942995{
    29952996    AssertPtr(pVCpu);
     
    30443045 * @remarks Called with interrupts disabled.
    30453046 */
    3046 static void hmR0VmxFlushTaggedTlbVpid(PHMPHYSCPU pHostCpu, PVMCPU pVCpu)
     3047static void hmR0VmxFlushTaggedTlbVpid(PHMPHYSCPU pHostCpu, PVMCPUCC pVCpu)
    30473048{
    30483049    AssertPtr(pVCpu);
     
    30863087    }
    30873088
    3088     PVM pVM = pVCpu->CTX_SUFF(pVM);
     3089    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    30893090    pVCpu->hm.s.idLastCpu = pHostCpu->idCpu;
    30903091    if (pVCpu->hm.s.fForceTLBFlush)
     
    31403141 * @remarks Called with interrupts disabled.
    31413142 */
    3142 static void hmR0VmxFlushTaggedTlb(PHMPHYSCPU pHostCpu, PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo)
     3143static void hmR0VmxFlushTaggedTlb(PHMPHYSCPU pHostCpu, PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
    31433144{
    31443145#ifdef HMVMX_ALWAYS_FLUSH_TLB
    31453146    VMCPU_FF_SET(pVCpu, VMCPU_FF_TLB_FLUSH);
    31463147#endif
    3147     PVM pVM = pVCpu->CTX_SUFF(pVM);
     3148    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    31483149    switch (pVM->hm.s.vmx.enmTlbFlushType)
    31493150    {
     
    31673168 * @param   pVM     The cross context VM structure.
    31683169 */
    3169 static int hmR0VmxSetupTaggedTlb(PVM pVM)
     3170static int hmR0VmxSetupTaggedTlb(PVMCC pVM)
    31703171{
    31713172    /*
     
    31863187                /* Shouldn't happen. EPT is supported but no suitable flush-types supported. */
    31873188                pVM->hm.s.vmx.enmTlbFlushEpt = VMXTLBFLUSHEPT_NOT_SUPPORTED;
    3188                 pVM->aCpus[0].hm.s.u32HMError = VMX_UFC_EPT_FLUSH_TYPE_UNSUPPORTED;
     3189                VMCC_GET_CPU_0(pVM)->hm.s.u32HMError = VMX_UFC_EPT_FLUSH_TYPE_UNSUPPORTED;
    31893190                return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
    31903191            }
     
    31943195            {
    31953196                pVM->hm.s.vmx.enmTlbFlushEpt = VMXTLBFLUSHEPT_NOT_SUPPORTED;
    3196                 pVM->aCpus[0].hm.s.u32HMError = VMX_UFC_EPT_MEM_TYPE_NOT_WB;
     3197                VMCC_GET_CPU_0(pVM)->hm.s.u32HMError = VMX_UFC_EPT_MEM_TYPE_NOT_WB;
    31973198                return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
    31983199            }
     
    32023203            {
    32033204                pVM->hm.s.vmx.enmTlbFlushEpt = VMXTLBFLUSHEPT_NOT_SUPPORTED;
    3204                 pVM->aCpus[0].hm.s.u32HMError = VMX_UFC_EPT_PAGE_WALK_LENGTH_UNSUPPORTED;
     3205                VMCC_GET_CPU_0(pVM)->hm.s.u32HMError = VMX_UFC_EPT_PAGE_WALK_LENGTH_UNSUPPORTED;
    32053206                return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
    32063207            }
     
    32103211            /* Shouldn't happen. EPT is supported but INVEPT instruction is not supported. */
    32113212            pVM->hm.s.vmx.enmTlbFlushEpt = VMXTLBFLUSHEPT_NOT_SUPPORTED;
    3212             pVM->aCpus[0].hm.s.u32HMError = VMX_UFC_EPT_INVEPT_UNAVAILABLE;
     3213            VMCC_GET_CPU_0(pVM)->hm.s.u32HMError = VMX_UFC_EPT_INVEPT_UNAVAILABLE;
    32133214            return VERR_HM_UNSUPPORTED_CPU_FEATURE_COMBO;
    32143215        }
     
    32713272 * @param   pVM     The cross context VM structure.
    32723273 */
    3273 static int hmR0VmxSetupShadowVmcsFieldsArrays(PVM pVM)
     3274static int hmR0VmxSetupShadowVmcsFieldsArrays(PVMCC pVM)
    32743275{
    32753276    /*
     
    33373338 * @param   pVM     The cross context VM structure.
    33383339 */
    3339 static void hmR0VmxSetupVmreadVmwriteBitmaps(PVM pVM)
     3340static void hmR0VmxSetupVmreadVmwriteBitmaps(PVMCC pVM)
    33403341{
    33413342    /*
     
    34203421 * @param   pVCpu   The cross context virtual CPU structure.
    34213422 */
    3422 DECLINLINE(void) hmR0VmxSetupVmcsApicAccessAddr(PVMCPU pVCpu)
     3423DECLINLINE(void) hmR0VmxSetupVmcsApicAccessAddr(PVMCPUCC pVCpu)
    34233424{
    34243425    RTHCPHYS const HCPhysApicAccess = pVCpu->CTX_SUFF(pVM)->hm.s.vmx.HCPhysApicAccess;
     
    34363437 * @param   pVCpu   The cross context virtual CPU structure.
    34373438 */
    3438 DECLINLINE(void) hmR0VmxSetupVmcsVmreadBitmapAddr(PVMCPU pVCpu)
     3439DECLINLINE(void) hmR0VmxSetupVmcsVmreadBitmapAddr(PVMCPUCC pVCpu)
    34393440{
    34403441    RTHCPHYS const HCPhysVmreadBitmap = pVCpu->CTX_SUFF(pVM)->hm.s.vmx.HCPhysVmreadBitmap;
     
    34513452 * @param   pVCpu   The cross context virtual CPU structure.
    34523453 */
    3453 DECLINLINE(void) hmR0VmxSetupVmcsVmwriteBitmapAddr(PVMCPU pVCpu)
     3454DECLINLINE(void) hmR0VmxSetupVmcsVmwriteBitmapAddr(PVMCPUCC pVCpu)
    34543455{
    34553456    RTHCPHYS const HCPhysVmwriteBitmap = pVCpu->CTX_SUFF(pVM)->hm.s.vmx.HCPhysVmwriteBitmap;
     
    34963497 * @param   pVmcsInfo       The VMCS info. object.
    34973498 */
    3498 static void hmR0VmxSetupVmcsMsrPermissions(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo)
     3499static void hmR0VmxSetupVmcsMsrPermissions(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
    34993500{
    35003501    Assert(pVmcsInfo->u32ProcCtls & VMX_PROC_CTLS_USE_MSR_BITMAPS);
     
    35043505     * VM-exits; they are loaded/stored automatically using fields in the VMCS.
    35053506     */
    3506     PVM pVM = pVCpu->CTX_SUFF(pVM);
     3507    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    35073508    hmR0VmxSetMsrPermission(pVCpu, pVmcsInfo, false, MSR_IA32_SYSENTER_CS,  VMXMSRPM_ALLOW_RD_WR);
    35083509    hmR0VmxSetMsrPermission(pVCpu, pVmcsInfo, false, MSR_IA32_SYSENTER_ESP, VMXMSRPM_ALLOW_RD_WR);
     
    35573558 * @param   pVmcsInfo   The VMCS info. object.
    35583559 */
    3559 static int hmR0VmxSetupVmcsPinCtls(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo)
    3560 {
    3561     PVM pVM = pVCpu->CTX_SUFF(pVM);
     3560static int hmR0VmxSetupVmcsPinCtls(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
     3561{
     3562    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    35623563    uint32_t       fVal = pVM->hm.s.vmx.Msrs.PinCtls.n.allowed0;      /* Bits set here must always be set. */
    35633564    uint32_t const fZap = pVM->hm.s.vmx.Msrs.PinCtls.n.allowed1;      /* Bits cleared here must always be cleared. */
     
    36103611 * @param   pVmcsInfo   The VMCS info. object.
    36113612 */
    3612 static int hmR0VmxSetupVmcsProcCtls2(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo)
    3613 {
    3614     PVM pVM = pVCpu->CTX_SUFF(pVM);
     3613static int hmR0VmxSetupVmcsProcCtls2(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
     3614{
     3615    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    36153616    uint32_t       fVal = pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed0;    /* Bits set here must be set in the VMCS. */
    36163617    uint32_t const fZap = pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1;    /* Bits cleared here must be cleared in the VMCS. */
     
    37023703 * @param   pVmcsInfo   The VMCS info. object.
    37033704 */
    3704 static int hmR0VmxSetupVmcsProcCtls(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo)
    3705 {
    3706     PVM pVM = pVCpu->CTX_SUFF(pVM);
     3705static int hmR0VmxSetupVmcsProcCtls(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
     3706{
     3707    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    37073708
    37083709    uint32_t       fVal = pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed0;     /* Bits set here must be set in the VMCS. */
     
    38093810 * @param   pVmcsInfo   The VMCS info. object.
    38103811 */
    3811 static int hmR0VmxSetupVmcsMiscCtls(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo)
     3812static int hmR0VmxSetupVmcsMiscCtls(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
    38123813{
    38133814#ifdef VBOX_WITH_NESTED_HWVIRT_VMX
     
    38523853 * @param   pVmcsInfo   The VMCS info. object.
    38533854 */
    3854 static void hmR0VmxSetupVmcsXcptBitmap(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo)
     3855static void hmR0VmxSetupVmcsXcptBitmap(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
    38553856{
    38563857    /*
     
    38843885 * @param   pVmcsInfo   The VMCS info. object.
    38853886 */
    3886 static int hmR0VmxSetupVmcsCtlsNested(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo)
     3887static int hmR0VmxSetupVmcsCtlsNested(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
    38873888{
    38883889    Assert(pVmcsInfo->u64VmcsLinkPtr == NIL_RTHCPHYS);
     
    39133914 * @param   fIsNstGstVmcs   Whether this is a nested-guest VMCS.
    39143915 */
    3915 static int hmR0VmxSetupVmcs(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo, bool fIsNstGstVmcs)
     3916static int hmR0VmxSetupVmcs(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo, bool fIsNstGstVmcs)
    39163917{
    39173918    Assert(pVmcsInfo->pvVmcs);
     
    39193920
    39203921    /* Set the CPU specified revision identifier at the beginning of the VMCS structure. */
    3921     PVM pVM = pVCpu->CTX_SUFF(pVM);
     3922    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    39223923    *(uint32_t *)pVmcsInfo->pvVmcs = RT_BF_GET(pVM->hm.s.vmx.Msrs.u64Basic, VMX_BF_BASIC_VMCS_ID);
    39233924    const char * const pszVmcs     = fIsNstGstVmcs ? "nested-guest VMCS" : "guest VMCS";
     
    40574058 * @param   pHwvirtMsrs     Pointer to the hardware-virtualization MSRs.
    40584059 */
    4059 VMMR0DECL(int) VMXR0EnableCpu(PHMPHYSCPU pHostCpu, PVM pVM, void *pvCpuPage, RTHCPHYS HCPhysCpuPage, bool fEnabledByHost,
     4060VMMR0DECL(int) VMXR0EnableCpu(PHMPHYSCPU pHostCpu, PVMCC pVM, void *pvCpuPage, RTHCPHYS HCPhysCpuPage, bool fEnabledByHost,
    40604061                              PCSUPHWVIRTMSRS pHwvirtMsrs)
    40614062{
     
    41174118 * @param   pVM             The cross context VM structure.
    41184119 */
    4119 VMMR0DECL(int) VMXR0InitVM(PVM pVM)
     4120VMMR0DECL(int) VMXR0InitVM(PVMCC pVM)
    41204121{
    41214122    AssertPtr(pVM);
     
    41394140 * @param   pVM     The cross context VM structure.
    41404141 */
    4141 VMMR0DECL(int) VMXR0TermVM(PVM pVM)
     4142VMMR0DECL(int) VMXR0TermVM(PVMCC pVM)
    41424143{
    41434144    AssertPtr(pVM);
     
    41634164 * @param   pVM     The cross context VM structure.
    41644165 */
    4165 VMMR0DECL(int) VMXR0SetupVM(PVM pVM)
     4166VMMR0DECL(int) VMXR0SetupVM(PVMCC pVM)
    41664167{
    41674168    AssertPtr(pVM);
     
    42224223    for (VMCPUID idCpu = 0; idCpu < pVM->cCpus; idCpu++)
    42234224    {
    4224         PVMCPU pVCpu = &pVM->aCpus[idCpu];
     4225        PVMCPUCC pVCpu = VMCC_GET_CPU(pVM, idCpu);
    42254226        Log4Func(("pVCpu=%p idCpu=%RU32\n", pVCpu, pVCpu->idCpu));
    42264227
     
    42724273 * @param   pVCpu   The cross context virtual CPU structure.
    42734274 */
    4274 static int hmR0VmxExportHostSegmentRegs(PVMCPU pVCpu)
     4275static int hmR0VmxExportHostSegmentRegs(PVMCPUCC pVCpu)
    42754276{
    42764277/**
     
    44144415     * [2] See Intel spec. 7.2.3 "TSS Descriptor in 64-bit mode".
    44154416     */
    4416     PVM pVM = pVCpu->CTX_SUFF(pVM);
     4417    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    44174418    Assert(pDesc->System.u4Type == 11);
    44184419    if (   pDesc->System.u16LimitLow != 0x67
     
    44764477 * @remarks No-long-jump zone!!!
    44774478 */
    4478 static void hmR0VmxExportHostMsrs(PVMCPU pVCpu)
     4479static void hmR0VmxExportHostMsrs(PVMCPUCC pVCpu)
    44794480{
    44804481    AssertPtr(pVCpu);
     
    44994500     * done as part of auto-load/store MSR area in the VMCS, see hmR0VmxExportGuestMsrs().
    45004501     */
    4501     PVM pVM = pVCpu->CTX_SUFF(pVM);
     4502    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    45024503    if (pVM->hm.s.vmx.fSupportsVmcsEfer)
    45034504    {
     
    45234524 * @remarks No-long-jump zone!!!
    45244525 */
    4525 static bool hmR0VmxShouldSwapEferMsr(PCVMCPU pVCpu)
     4526static bool hmR0VmxShouldSwapEferMsr(PCVMCPUCC pVCpu)
    45264527{
    45274528#ifdef HMVMX_ALWAYS_SWAP_EFER
     
    45304531#else
    45314532    PCCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    4532     PVM pVM = pVCpu->CTX_SUFF(pVM);
     4533    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    45334534    uint64_t const u64HostEfer  = pVM->hm.s.vmx.u64HostMsrEfer;
    45344535    uint64_t const u64GuestEfer = pCtx->msrEFER;
     
    45804581 * @remarks No-long-jump zone!!!
    45814582 */
    4582 static int hmR0VmxExportGuestEntryExitCtls(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     4583static int hmR0VmxExportGuestEntryExitCtls(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    45834584{
    45844585    if (ASMAtomicUoReadU64(&pVCpu->hm.s.fCtxChanged) & HM_CHANGED_VMX_ENTRY_EXIT_CTLS)
    45854586    {
    4586         PVM          pVM = pVCpu->CTX_SUFF(pVM);
     4587        PVMCC          pVM = pVCpu->CTX_SUFF(pVM);
    45874588        PVMXVMCSINFO pVmcsInfo = pVmxTransient->pVmcsInfo;
    45884589
     
    47644765 * @remarks No-long-jump zone!!!
    47654766 */
    4766 static int hmR0VmxExportGuestApicTpr(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     4767static int hmR0VmxExportGuestApicTpr(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    47674768{
    47684769    if (ASMAtomicUoReadU64(&pVCpu->hm.s.fCtxChanged) & HM_CHANGED_GUEST_APIC_TPR)
     
    48254826 * @remarks No-long-jump zone!!!
    48264827 */
    4827 static uint32_t hmR0VmxGetGuestIntrState(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     4828static uint32_t hmR0VmxGetGuestIntrState(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    48284829{
    48294830    /*
     
    48824883 * @remarks No-long-jump zone!!!
    48834884 */
    4884 static int hmR0VmxExportGuestXcptIntercepts(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     4885static int hmR0VmxExportGuestXcptIntercepts(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    48854886{
    48864887    if (ASMAtomicUoReadU64(&pVCpu->hm.s.fCtxChanged) & HM_CHANGED_VMX_XCPT_INTERCEPTS)
     
    49084909 * @remarks No-long-jump zone!!!
    49094910 */
    4910 static int hmR0VmxExportGuestRip(PVMCPU pVCpu)
     4911static int hmR0VmxExportGuestRip(PVMCPUCC pVCpu)
    49114912{
    49124913    if (ASMAtomicUoReadU64(&pVCpu->hm.s.fCtxChanged) & HM_CHANGED_GUEST_RIP)
     
    49324933 * @remarks No-long-jump zone!!!
    49334934 */
    4934 static int hmR0VmxExportGuestRsp(PVMCPU pVCpu)
     4935static int hmR0VmxExportGuestRsp(PVMCPUCC pVCpu)
    49354936{
    49364937    if (ASMAtomicUoReadU64(&pVCpu->hm.s.fCtxChanged) & HM_CHANGED_GUEST_RSP)
     
    49574958 * @remarks No-long-jump zone!!!
    49584959 */
    4959 static int hmR0VmxExportGuestRflags(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     4960static int hmR0VmxExportGuestRflags(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    49604961{
    49614962    if (ASMAtomicUoReadU64(&pVCpu->hm.s.fCtxChanged) & HM_CHANGED_GUEST_RFLAGS)
     
    50235024 * @remarks No-long-jump zone!!!
    50245025 */
    5025 static int hmR0VmxCopyNstGstToShadowVmcs(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo)
    5026 {
    5027     PVM pVM = pVCpu->CTX_SUFF(pVM);
     5026static int hmR0VmxCopyNstGstToShadowVmcs(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
     5027{
     5028    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    50285029    PCVMXVVMCS pVmcsNstGst = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs);
    50295030
     
    50925093 * @remarks Called with interrupts disabled.
    50935094 */
    5094 static int hmR0VmxCopyShadowToNstGstVmcs(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo)
     5095static int hmR0VmxCopyShadowToNstGstVmcs(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
    50955096{
    50965097    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
    5097     PVM pVM = pVCpu->CTX_SUFF(pVM);
     5098    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    50985099    PVMXVVMCS pVmcsNstGst = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs);
    50995100
     
    51895190 * @remarks No-long-jump zone!!!
    51905191 */
    5191 static int hmR0VmxExportGuestHwvirtState(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     5192static int hmR0VmxExportGuestHwvirtState(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    51925193{
    51935194    if (ASMAtomicUoReadU64(&pVCpu->hm.s.fCtxChanged) & HM_CHANGED_GUEST_HWVIRT)
     
    52535254 * @remarks No-long-jump zone!!!
    52545255 */
    5255 static int hmR0VmxExportGuestCR0(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     5256static int hmR0VmxExportGuestCR0(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    52565257{
    52575258    if (ASMAtomicUoReadU64(&pVCpu->hm.s.fCtxChanged) & HM_CHANGED_GUEST_CR0)
    52585259    {
    5259         PVM          pVM       = pVCpu->CTX_SUFF(pVM);
     5260        PVMCC          pVM       = pVCpu->CTX_SUFF(pVM);
    52605261        PVMXVMCSINFO pVmcsInfo = pVmxTransient->pVmcsInfo;
    52615262
     
    54375438 * @remarks No-long-jump zone!!!
    54385439 */
    5439 static VBOXSTRICTRC hmR0VmxExportGuestCR3AndCR4(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     5440static VBOXSTRICTRC hmR0VmxExportGuestCR3AndCR4(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    54405441{
    54415442    int rc  = VINF_SUCCESS;
    5442     PVM pVM = pVCpu->CTX_SUFF(pVM);
     5443    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    54435444
    54445445    /*
     
    56745675 * @remarks No-long-jump zone!!!
    56755676 */
    5676 static int hmR0VmxExportSharedDebugState(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     5677static int hmR0VmxExportSharedDebugState(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    56775678{
    56785679    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    57095710    {
    57105711        /* If the CPU supports the monitor trap flag, use it for single stepping in DBGF and avoid intercepting #DB. */
    5711         PVM pVM = pVCpu->CTX_SUFF(pVM);
     5712        PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    57125713        if (pVM->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_MONITOR_TRAP_FLAG)
    57135714        {
     
    58395840 *          segments.
    58405841 */
    5841 static void hmR0VmxValidateSegmentRegs(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo)
     5842static void hmR0VmxValidateSegmentRegs(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
    58425843{
    58435844    /*
     
    58485849     * unusable bit and doesn't change the guest-context value.
    58495850     */
    5850     PVM       pVM  = pVCpu->CTX_SUFF(pVM);
     5851    PVMCC       pVM  = pVCpu->CTX_SUFF(pVM);
    58515852    PCCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    58525853    hmR0VmxImportGuestState(pVCpu, pVmcsInfo, CPUMCTX_EXTRN_CR0);
     
    60186019 * @remarks No-long-jump zone!!!
    60196020 */
    6020 static int hmR0VmxExportGuestSegReg(PVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo, uint8_t iSegReg, PCCPUMSELREG pSelReg)
     6021static int hmR0VmxExportGuestSegReg(PVMCPUCC pVCpu, PCVMXVMCSINFO pVmcsInfo, uint8_t iSegReg, PCCPUMSELREG pSelReg)
    60216022{
    60226023    Assert(iSegReg < X86_SREG_COUNT);
     
    60756076 * @remarks No-long-jump zone!!!
    60766077 */
    6077 static int hmR0VmxExportGuestSegRegsXdtr(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     6078static int hmR0VmxExportGuestSegRegsXdtr(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    60786079{
    60796080    int          rc        = VERR_INTERNAL_ERROR_5;
    6080     PVM          pVM       = pVCpu->CTX_SUFF(pVM);
     6081    PVMCC          pVM       = pVCpu->CTX_SUFF(pVM);
    60816082    PCCPUMCTX    pCtx      = &pVCpu->cpum.GstCtx;
    60826083    PVMXVMCSINFO pVmcsInfo = pVmxTransient->pVmcsInfo;
     
    63376338 * @remarks No-long-jump zone!!!
    63386339 */
    6339 static int hmR0VmxExportGuestMsrs(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     6340static int hmR0VmxExportGuestMsrs(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    63406341{
    63416342    AssertPtr(pVCpu);
    63426343    AssertPtr(pVmxTransient);
    63436344
    6344     PVM       pVM  = pVCpu->CTX_SUFF(pVM);
     6345    PVMCC       pVM  = pVCpu->CTX_SUFF(pVM);
    63456346    PCCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    63466347
     
    64576458 * @remarks No-long-jump zone!!!
    64586459 */
    6459 static int hmR0VmxSelectVMRunHandler(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     6460static int hmR0VmxSelectVMRunHandler(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    64606461{
    64616462    PCCPUMCTX    pCtx      = &pVCpu->cpum.GstCtx;
     
    64916492 * @remarks No-long-jump zone!!!
    64926493 */
    6493 DECLINLINE(int) hmR0VmxRunGuest(PVMCPU pVCpu, PCVMXTRANSIENT pVmxTransient)
     6494DECLINLINE(int) hmR0VmxRunGuest(PVMCPUCC pVCpu, PCVMXTRANSIENT pVmxTransient)
    64946495{
    64956496    /* Mark that HM is the keeper of all guest-CPU registers now that we're going to execute guest code. */
     
    65086509    PCVMXVMCSINFO pVmcsInfo = pVmxTransient->pVmcsInfo;
    65096510    bool const fResumeVM = RT_BOOL(pVmcsInfo->fVmcsState & VMX_V_VMCS_LAUNCH_STATE_LAUNCHED);
    6510     PVM pVM = pVCpu->CTX_SUFF(pVM);
     6511    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    65116512#ifdef VBOX_WITH_KERNEL_USING_XMM
    65126513    int rc = hmR0VMXStartVMWrapXMM(fResumeVM, pCtx, NULL /*pvUnused*/, pVM, pVCpu, pVmcsInfo->pfnStartVM);
     
    65276528 *                          exitReason updated).
    65286529 */
    6529 static void hmR0VmxReportWorldSwitchError(PVMCPU pVCpu, int rcVMRun, PVMXTRANSIENT pVmxTransient)
     6530static void hmR0VmxReportWorldSwitchError(PVMCPUCC pVCpu, int rcVMRun, PVMXTRANSIENT pVmxTransient)
    65306531{
    65316532    Assert(pVCpu);
     
    66346635                    else
    66356636                    {
    6636                         PVM pVM = pVCpu->CTX_SUFF(pVM);
     6637                        PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    66376638                        switch (uVmcsField)
    66386639                        {
     
    67306731 * @remarks No-long-jump zone!!!
    67316732 */
    6732 static void hmR0VmxUpdateTscOffsettingAndPreemptTimer(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     6733static void hmR0VmxUpdateTscOffsettingAndPreemptTimer(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    67336734{
    67346735    bool         fOffsettedTsc;
    67356736    bool         fParavirtTsc;
    67366737    uint64_t     uTscOffset;
    6737     PVM          pVM = pVCpu->CTX_SUFF(pVM);
     6738    PVMCC          pVM = pVCpu->CTX_SUFF(pVM);
    67386739    PVMXVMCSINFO pVmcsInfo = hmGetVmxActiveVmcsInfo(pVCpu);
    67396740
     
    68556856 *                              page-fault.
    68566857 */
    6857 DECLINLINE(void) hmR0VmxSetPendingEvent(PVMCPU pVCpu, uint32_t u32IntInfo, uint32_t cbInstr, uint32_t u32ErrCode,
     6858DECLINLINE(void) hmR0VmxSetPendingEvent(PVMCPUCC pVCpu, uint32_t u32IntInfo, uint32_t cbInstr, uint32_t u32ErrCode,
    68586859                                        RTGCUINTPTR GCPtrFaultAddress)
    68596860{
     
    68736874 * @param   u8Interrupt     The external interrupt vector.
    68746875 */
    6875 DECLINLINE(void) hmR0VmxSetPendingExtInt(PVMCPU pVCpu, uint8_t u8Interrupt)
     6876DECLINLINE(void) hmR0VmxSetPendingExtInt(PVMCPUCC pVCpu, uint8_t u8Interrupt)
    68766877{
    68776878    uint32_t const u32IntInfo = RT_BF_MAKE(VMX_BF_EXIT_INT_INFO_VECTOR,          u8Interrupt)
     
    68886889 * @param   pVCpu   The cross context virtual CPU structure.
    68896890 */
    6890 DECLINLINE(void) hmR0VmxSetPendingXcptNmi(PVMCPU pVCpu)
     6891DECLINLINE(void) hmR0VmxSetPendingXcptNmi(PVMCPUCC pVCpu)
    68916892{
    68926893    uint32_t const u32IntInfo = RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_VECTOR,         X86_XCPT_NMI)
     
    69036904 * @param   pVCpu   The cross context virtual CPU structure.
    69046905 */
    6905 DECLINLINE(void) hmR0VmxSetPendingXcptDF(PVMCPU pVCpu)
     6906DECLINLINE(void) hmR0VmxSetPendingXcptDF(PVMCPUCC pVCpu)
    69066907{
    69076908    uint32_t const u32IntInfo = RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_VECTOR,         X86_XCPT_DF)
     
    69186919 * @param   pVCpu   The cross context virtual CPU structure.
    69196920 */
    6920 DECLINLINE(void) hmR0VmxSetPendingXcptUD(PVMCPU pVCpu)
     6921DECLINLINE(void) hmR0VmxSetPendingXcptUD(PVMCPUCC pVCpu)
    69216922{
    69226923    uint32_t const u32IntInfo = RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_VECTOR,         X86_XCPT_UD)
     
    69336934 * @param   pVCpu   The cross context virtual CPU structure.
    69346935 */
    6935 DECLINLINE(void) hmR0VmxSetPendingXcptDB(PVMCPU pVCpu)
     6936DECLINLINE(void) hmR0VmxSetPendingXcptDB(PVMCPUCC pVCpu)
    69366937{
    69376938    uint32_t const u32IntInfo = RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_VECTOR,         X86_XCPT_DB)
     
    69506951 * @param   u32ErrCode  The error code for the general-protection exception.
    69516952 */
    6952 DECLINLINE(void) hmR0VmxSetPendingXcptGP(PVMCPU pVCpu, uint32_t u32ErrCode)
     6953DECLINLINE(void) hmR0VmxSetPendingXcptGP(PVMCPUCC pVCpu, uint32_t u32ErrCode)
    69536954{
    69546955    uint32_t const u32IntInfo = RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_VECTOR,         X86_XCPT_GP)
     
    69666967 * @param   u32ErrCode  The error code for the stack exception.
    69676968 */
    6968 DECLINLINE(void) hmR0VmxSetPendingXcptSS(PVMCPU pVCpu, uint32_t u32ErrCode)
     6969DECLINLINE(void) hmR0VmxSetPendingXcptSS(PVMCPUCC pVCpu, uint32_t u32ErrCode)
    69696970{
    69706971    uint32_t const u32IntInfo = RT_BF_MAKE(VMX_BF_ENTRY_INT_INFO_VECTOR,         X86_XCPT_SS)
     
    69846985 * @param   idxSel      The VMCS field for the corresponding segment register.
    69856986 */
    6986 static void hmR0VmxFixUnusableSegRegAttr(PVMCPU pVCpu, PCPUMSELREG pSelReg, uint32_t idxSel)
     6987static void hmR0VmxFixUnusableSegRegAttr(PVMCPUCC pVCpu, PCPUMSELREG pSelReg, uint32_t idxSel)
    69876988{
    69886989    Assert(pSelReg->Attr.u & X86DESCATTR_UNUSABLE);
     
    70387039 * @remarks Called with interrupts and/or preemption disabled.
    70397040 */
    7040 static void hmR0VmxImportGuestSegReg(PVMCPU pVCpu, uint8_t iSegReg)
     7041static void hmR0VmxImportGuestSegReg(PVMCPUCC pVCpu, uint8_t iSegReg)
    70417042{
    70427043    Assert(iSegReg < X86_SREG_COUNT);
     
    70747075 * @remarks Called with interrupts and/or preemption disabled.
    70757076 */
    7076 static void hmR0VmxImportGuestLdtr(PVMCPU pVCpu)
     7077static void hmR0VmxImportGuestLdtr(PVMCPUCC pVCpu)
    70777078{
    70787079    uint16_t u16Sel;
     
    71027103 * @remarks Called with interrupts and/or preemption disabled.
    71037104 */
    7104 static void hmR0VmxImportGuestTr(PVMCPU pVCpu)
     7105static void hmR0VmxImportGuestTr(PVMCPUCC pVCpu)
    71057106{
    71067107    uint16_t u16Sel;
     
    71327133 *          instead!!!
    71337134 */
    7134 static void hmR0VmxImportGuestRip(PVMCPU pVCpu)
     7135static void hmR0VmxImportGuestRip(PVMCPUCC pVCpu)
    71357136{
    71367137    uint64_t u64Val;
     
    71587159 *          instead!!!
    71597160 */
    7160 static void hmR0VmxImportGuestRFlags(PVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo)
     7161static void hmR0VmxImportGuestRFlags(PVMCPUCC pVCpu, PCVMXVMCSINFO pVmcsInfo)
    71617162{
    71627163    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
     
    71907191 *          instead!!!
    71917192 */
    7192 static void hmR0VmxImportGuestIntrState(PVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo)
     7193static void hmR0VmxImportGuestIntrState(PVMCPUCC pVCpu, PCVMXVMCSINFO pVmcsInfo)
    71937194{
    71947195    uint32_t u32Val;
     
    72297230 * @param   fWhat       What to import, CPUMCTX_EXTRN_XXX.
    72307231 */
    7231 static int hmR0VmxImportGuestState(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo, uint64_t fWhat)
     7232static int hmR0VmxImportGuestState(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo, uint64_t fWhat)
    72327233{
    72337234    int      rc   = VINF_SUCCESS;
    7234     PVM      pVM  = pVCpu->CTX_SUFF(pVM);
     7235    PVMCC      pVM  = pVCpu->CTX_SUFF(pVM);
    72357236    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    72367237    uint32_t u32Val;
     
    75727573 * @param   fWhat   What to import, CPUMCTX_EXTRN_XXX.
    75737574 */
    7574 VMMR0DECL(int) VMXR0ImportStateOnDemand(PVMCPU pVCpu, uint64_t fWhat)
     7575VMMR0DECL(int) VMXR0ImportStateOnDemand(PVMCPUCC pVCpu, uint64_t fWhat)
    75757576{
    75767577    AssertPtr(pVCpu);
     
    76037604 *          is no longer in VMX non-root mode.
    76047605 */
    7605 static VBOXSTRICTRC hmR0VmxCheckForceFlags(PVMCPU pVCpu, bool fStepping)
     7606static VBOXSTRICTRC hmR0VmxCheckForceFlags(PVMCPUCC pVCpu, bool fStepping)
    76067607{
    76077608    Assert(VMMRZCallRing3IsEnabled(pVCpu));
     
    76167617     * Anything pending?  Should be more likely than not if we're doing a good job.
    76177618     */
    7618     PVM pVM = pVCpu->CTX_SUFF(pVM);
     7619    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    76197620    if (  !fStepping
    76207621        ?    !VM_FF_IS_ANY_SET(pVM, VM_FF_HP_R0_PRE_HM_MASK)
     
    76967697 * @param   pVCpu   The cross context virtual CPU structure.
    76977698 */
    7698 static void hmR0VmxTrpmTrapToPendingEvent(PVMCPU pVCpu)
     7699static void hmR0VmxTrpmTrapToPendingEvent(PVMCPUCC pVCpu)
    76997700{
    77007701    Assert(TRPMHasTrap(pVCpu));
     
    77287729 * @param   pVCpu   The cross context virtual CPU structure.
    77297730 */
    7730 static void hmR0VmxPendingEventToTrpmTrap(PVMCPU pVCpu)
     7731static void hmR0VmxPendingEventToTrpmTrap(PVMCPUCC pVCpu)
    77317732{
    77327733    Assert(pVCpu->hm.s.Event.fPending);
     
    77647765 * @param   pVmcsInfo   The VMCS info. object.
    77657766 */
    7766 static void hmR0VmxSetIntWindowExitVmcs(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo)
     7767static void hmR0VmxSetIntWindowExitVmcs(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
    77677768{
    77687769    if (pVCpu->CTX_SUFF(pVM)->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_INT_WINDOW_EXIT)
     
    78017802 * @param   pVmcsInfo   The VMCS info. object.
    78027803 */
    7803 static void hmR0VmxSetNmiWindowExitVmcs(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo)
     7804static void hmR0VmxSetNmiWindowExitVmcs(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo)
    78047805{
    78057806    if (pVCpu->CTX_SUFF(pVM)->hm.s.vmx.Msrs.ProcCtls.n.allowed1 & VMX_PROC_CTLS_NMI_WINDOW_EXIT)
     
    78437844 * @remarks No-long-jmp zone!!!
    78447845 */
    7845 static int hmR0VmxLeave(PVMCPU pVCpu, bool fImportState)
     7846static int hmR0VmxLeave(PVMCPUCC pVCpu, bool fImportState)
    78467847{
    78477848    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    79627963 * @remarks No-long-jmp zone!!!
    79637964 */
    7964 static int hmR0VmxLeaveSession(PVMCPU pVCpu)
     7965static int hmR0VmxLeaveSession(PVMCPUCC pVCpu)
    79657966{
    79667967    HM_DISABLE_PREEMPT(pVCpu);
     
    80068007 * @remarks No-long-jmp zone!!!
    80078008 */
    8008 DECLINLINE(int) hmR0VmxLongJmpToRing3(PVMCPU pVCpu)
     8009DECLINLINE(int) hmR0VmxLongJmpToRing3(PVMCPUCC pVCpu)
    80098010{
    80108011    return hmR0VmxLeaveSession(pVCpu);
     
    80258026 *                  VINF_VMM_UNKNOWN_RING3_CALL.
    80268027 */
    8027 static int hmR0VmxExitToRing3(PVMCPU pVCpu, VBOXSTRICTRC rcExit)
     8028static int hmR0VmxExitToRing3(PVMCPUCC pVCpu, VBOXSTRICTRC rcExit)
    80288029{
    80298030    HMVMX_ASSERT_PREEMPT_SAFE(pVCpu);
     
    81488149 * @param   pvUser          User argument, currently unused, NULL.
    81498150 */
    8150 static DECLCALLBACK(int) hmR0VmxCallRing3Callback(PVMCPU pVCpu, VMMCALLRING3 enmOperation, void *pvUser)
     8151static DECLCALLBACK(int) hmR0VmxCallRing3Callback(PVMCPUCC pVCpu, VMMCALLRING3 enmOperation, void *pvUser)
    81518152{
    81528153    RT_NOREF(pvUser);
     
    82208221 * @param   uValue  The value to push to the guest stack.
    82218222 */
    8222 static VBOXSTRICTRC hmR0VmxRealModeGuestStackPush(PVMCPU pVCpu, uint16_t uValue)
     8223static VBOXSTRICTRC hmR0VmxRealModeGuestStackPush(PVMCPUCC pVCpu, uint16_t uValue)
    82238224{
    82248225    /*
     
    82558256 *                          VM-entry).
    82568257 */
    8257 static VBOXSTRICTRC hmR0VmxInjectEventVmcs(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, PCHMEVENT pEvent, bool fStepping,
     8258static VBOXSTRICTRC hmR0VmxInjectEventVmcs(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, PCHMEVENT pEvent, bool fStepping,
    82588259                                           uint32_t *pfIntrState)
    82598260{
     
    83268327        else
    83278328        {
    8328             PVM pVM = pVCpu->CTX_SUFF(pVM);
     8329            PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    83298330            Assert(PDMVmmDevHeapIsEnabled(pVM));
    83308331            Assert(pVM->hm.s.vmx.pRealModeTSS);
     
    84908491 * @param   pfIntrState     Where to store the VT-x guest-interruptibility state.
    84918492 */
    8492 static VBOXSTRICTRC hmR0VmxEvaluatePendingEvent(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, uint32_t *pfIntrState)
     8493static VBOXSTRICTRC hmR0VmxEvaluatePendingEvent(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, uint32_t *pfIntrState)
    84938494{
    84948495    Assert(pfIntrState);
     
    86398640 *                          directly.
    86408641 */
    8641 static VBOXSTRICTRC hmR0VmxInjectPendingEvent(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, uint32_t fIntrState, bool fStepping)
     8642static VBOXSTRICTRC hmR0VmxInjectPendingEvent(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, uint32_t fIntrState, bool fStepping)
    86428643{
    86438644    HMVMX_ASSERT_PREEMPT_SAFE(pVCpu);
     
    87258726 * @param   pVCpu   The cross context virtual CPU structure.
    87268727 */
    8727 VMMR0DECL(int) VMXR0Enter(PVMCPU pVCpu)
     8728VMMR0DECL(int) VMXR0Enter(PVMCPUCC pVCpu)
    87288729{
    87298730    AssertPtr(pVCpu);
     
    87818782 * @thread  EMT(pVCpu)
    87828783 */
    8783 VMMR0DECL(void) VMXR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPU pVCpu, bool fGlobalInit)
     8784VMMR0DECL(void) VMXR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPUCC pVCpu, bool fGlobalInit)
    87848785{
    87858786    AssertPtr(pVCpu);
     
    88698870 * @remarks No-long-jump zone!!!
    88708871 */
    8871 static int hmR0VmxExportHostState(PVMCPU pVCpu)
     8872static int hmR0VmxExportHostState(PVMCPUCC pVCpu)
    88728873{
    88738874    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    88978898 * @remarks No-long-jump zone!!!
    88988899 */
    8899 VMMR0DECL(int) VMXR0ExportHostState(PVMCPU pVCpu)
     8900VMMR0DECL(int) VMXR0ExportHostState(PVMCPUCC pVCpu)
    89008901{
    89018902    AssertPtr(pVCpu);
     
    89328933 * @remarks No-long-jump zone!!!
    89338934 */
    8934 static VBOXSTRICTRC hmR0VmxExportGuestState(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     8935static VBOXSTRICTRC hmR0VmxExportGuestState(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    89358936{
    89368937    AssertPtr(pVCpu);
     
    90279028 * @remarks No-long-jump zone!!!
    90289029 */
    9029 static void hmR0VmxExportSharedState(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     9030static void hmR0VmxExportSharedState(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    90309031{
    90319032    Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));
     
    90709071 * @remarks No-long-jump zone!!!
    90719072 */
    9072 static VBOXSTRICTRC hmR0VmxExportGuestStateOptimal(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     9073static VBOXSTRICTRC hmR0VmxExportGuestStateOptimal(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    90739074{
    90749075    HMVMX_ASSERT_PREEMPT_SAFE(pVCpu);
     
    91389139 *          are valid, i.e. hmR0VmxCheckVmcsCtls() succeeded.
    91399140 */
    9140 static uint32_t hmR0VmxCheckGuestState(PVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo)
     9141static uint32_t hmR0VmxCheckGuestState(PVMCPUCC pVCpu, PCVMXVMCSINFO pVmcsInfo)
    91419142{
    91429143#define HMVMX_ERROR_BREAK(err)              { uError = (err); break; }
     
    91469147
    91479148    int        rc;
    9148     PVM        pVM    = pVCpu->CTX_SUFF(pVM);
     9149    PVMCC        pVM    = pVCpu->CTX_SUFF(pVM);
    91499150    PCPUMCTX   pCtx   = &pVCpu->cpum.GstCtx;
    91509151    uint32_t   uError = VMX_IGS_ERROR;
     
    97109711 * @param   pVCpu   The cross context virtual CPU structure.
    97119712 */
    9712 static int hmR0VmxMapHCApicAccessPage(PVMCPU pVCpu)
    9713 {
    9714     PVM pVM = pVCpu->CTX_SUFF(pVM);
     9713static int hmR0VmxMapHCApicAccessPage(PVMCPUCC pVCpu)
     9714{
     9715    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    97159716    uint64_t const u64MsrApicBase = APICGetBaseMsrNoCheck(pVCpu);
    97169717
     
    97609761 *                      operation.
    97619762 */
    9762 static int hmR0VmxExitHostNmi(PVMCPU pVCpu, PCVMXVMCSINFO pVmcsInfo)
     9763static int hmR0VmxExitHostNmi(PVMCPUCC pVCpu, PCVMXVMCSINFO pVmcsInfo)
    97639764{
    97649765    RTCPUID const idCpu = pVmcsInfo->idHostCpu;
     
    98149815 * @param   pVmcsInfoGst        The guest VMCS info. object.
    98159816 */
    9816 static void hmR0VmxMergeMsrBitmapNested(PCVMCPU pVCpu, PVMXVMCSINFO pVmcsInfoNstGst, PCVMXVMCSINFO pVmcsInfoGst)
     9817static void hmR0VmxMergeMsrBitmapNested(PCVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfoNstGst, PCVMXVMCSINFO pVmcsInfoGst)
    98179818{
    98189819    uint32_t const cbMsrBitmap    = X86_PAGE_4K_SIZE;
     
    98659866 * @param   pVCpu   The cross context virtual CPU structure.
    98669867 */
    9867 static int hmR0VmxMergeVmcsNested(PVMCPU pVCpu)
    9868 {
    9869     PVM pVM = pVCpu->CTX_SUFF(pVM);
     9868static int hmR0VmxMergeVmcsNested(PVMCPUCC pVCpu)
     9869{
     9870    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    98709871    PCVMXVMCSINFO pVmcsInfoGst = &pVCpu->hm.s.vmx.VmcsInfo;
    98719872    PCVMXVVMCS    pVmcsNstGst  = pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs);
     
    1018710188 *                          if event dispatching took place.
    1018810189 */
    10189 static VBOXSTRICTRC hmR0VmxPreRunGuest(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, bool fStepping)
     10190static VBOXSTRICTRC hmR0VmxPreRunGuest(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, bool fStepping)
    1019010191{
    1019110192    Assert(VMMRZCallRing3IsEnabled(pVCpu));
     
    1023110232     *        VERR_IOM_MMIO_RANGE_NOT_FOUND guru while booting Visa 64 SMP VM. No
    1023210233     *        idea why atm. */
    10233     PVM pVM = pVCpu->CTX_SUFF(pVM);
     10234    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    1023410235    if (   !pVCpu->hm.s.vmx.u64GstMsrApicBase
    1023510236        && (pVM->hm.s.vmx.Msrs.ProcCtls2.n.allowed1 & VMX_PROC_CTLS2_VIRT_APIC_ACCESS)
     
    1043110432 * @remarks No-long-jump zone!!!
    1043210433 */
    10433 static void hmR0VmxPreRunGuestCommitted(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     10434static void hmR0VmxPreRunGuestCommitted(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1043410435{
    1043510436    Assert(!VMMRZCallRing3IsEnabled(pVCpu));
     
    1044410445    VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED_EXEC);
    1044510446
    10446     PVM          pVM           = pVCpu->CTX_SUFF(pVM);
     10447    PVMCC          pVM           = pVCpu->CTX_SUFF(pVM);
    1044710448    PVMXVMCSINFO pVmcsInfo     = pVmxTransient->pVmcsInfo;
    1044810449    PHMPHYSCPU   pHostCpu      = hmR0GetCurrentCpu();
     
    1058810589 *          unconditionally when it is safe to do so.
    1058910590 */
    10590 static void hmR0VmxPostRunGuest(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, int rcVMRun)
     10591static void hmR0VmxPostRunGuest(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, int rcVMRun)
    1059110592{
    1059210593    uint64_t const uHostTsc = ASMReadTSC();                     /** @todo We can do a lot better here, see @bugref{9180#c38}. */
     
    1076310764 * @param   pcLoops     Pointer to the number of executed loops.
    1076410765 */
    10765 static VBOXSTRICTRC hmR0VmxRunGuestCodeNormal(PVMCPU pVCpu, uint32_t *pcLoops)
     10766static VBOXSTRICTRC hmR0VmxRunGuestCodeNormal(PVMCPUCC pVCpu, uint32_t *pcLoops)
    1076610767{
    1076710768    uint32_t const cMaxResumeLoops = pVCpu->CTX_SUFF(pVM)->hm.s.cMaxResumeLoops;
     
    1087610877 * @sa      hmR0VmxRunGuestCodeNormal.
    1087710878 */
    10878 static VBOXSTRICTRC hmR0VmxRunGuestCodeNested(PVMCPU pVCpu, uint32_t *pcLoops)
     10879static VBOXSTRICTRC hmR0VmxRunGuestCodeNested(PVMCPUCC pVCpu, uint32_t *pcLoops)
    1087910880{
    1088010881    uint32_t const cMaxResumeLoops = pVCpu->CTX_SUFF(pVM)->hm.s.cMaxResumeLoops;
     
    1105711058 * @param   pDbgState       The debug state to initialize.
    1105811059 */
    11059 static void hmR0VmxRunDebugStateInit(PVMCPU pVCpu, PCVMXTRANSIENT pVmxTransient, PVMXRUNDBGSTATE pDbgState)
     11060static void hmR0VmxRunDebugStateInit(PVMCPUCC pVCpu, PCVMXTRANSIENT pVmxTransient, PVMXRUNDBGSTATE pDbgState)
    1106011061{
    1106111062    pDbgState->uRipStart            = pVCpu->cpum.GstCtx.rip;
     
    1108911090 * @param   pDbgState       The debug state.
    1109011091 */
    11091 static void hmR0VmxPreRunGuestDebugStateApply(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, PVMXRUNDBGSTATE pDbgState)
     11092static void hmR0VmxPreRunGuestDebugStateApply(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, PVMXRUNDBGSTATE pDbgState)
    1109211093{
    1109311094    /*
     
    1115411155 *                          stepping.
    1115511156 */
    11156 static VBOXSTRICTRC hmR0VmxRunDebugStateRevert(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, PVMXRUNDBGSTATE pDbgState,
     11157static VBOXSTRICTRC hmR0VmxRunDebugStateRevert(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, PVMXRUNDBGSTATE pDbgState,
    1115711158                                               VBOXSTRICTRC rcStrict)
    1115811159{
     
    1120411205 * @param   pDbgState       The debug state.
    1120511206 */
    11206 static void hmR0VmxPreRunGuestDebugStateUpdate(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, PVMXRUNDBGSTATE pDbgState)
     11207static void hmR0VmxPreRunGuestDebugStateUpdate(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, PVMXRUNDBGSTATE pDbgState)
    1120711208{
    1120811209    /*
     
    1122611227     * Software interrupts (INT XXh) - no idea how to trigger these...
    1122711228     */
    11228     PVM pVM = pVCpu->CTX_SUFF(pVM);
     11229    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    1122911230    if (   DBGF_IS_EVENT_ENABLED(pVM, DBGFEVENT_INTERRUPT_SOFTWARE)
    1123011231        || VBOXVMM_INT_SOFTWARE_ENABLED())
     
    1150011501 *          and to the point. No longer than 33 chars long, please.
    1150111502 */
    11502 static VBOXSTRICTRC hmR0VmxHandleExitDtraceEvents(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, uint32_t uExitReason)
     11503static VBOXSTRICTRC hmR0VmxHandleExitDtraceEvents(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, uint32_t uExitReason)
    1150311504{
    1150411505    /*
     
    1185011851     *       one, in order to avoid event nesting.
    1185111852     */
    11852     PVM pVM = pVCpu->CTX_SUFF(pVM);
     11853    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    1185311854    if (   enmEvent1 != DBGFEVENT_END
    1185411855        && DBGF_IS_EVENT_ENABLED(pVM, enmEvent1))
     
    1188411885 * @param   pDbgState       The debug state.
    1188511886 */
    11886 DECLINLINE(VBOXSTRICTRC) hmR0VmxRunDebugHandleExit(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, PVMXRUNDBGSTATE pDbgState)
     11887DECLINLINE(VBOXSTRICTRC) hmR0VmxRunDebugHandleExit(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, PVMXRUNDBGSTATE pDbgState)
    1188711888{
    1188811889    /*
     
    1203812039 * @note    Mostly the same as hmR0VmxRunGuestCodeNormal().
    1203912040 */
    12040 static VBOXSTRICTRC hmR0VmxRunGuestCodeDebug(PVMCPU pVCpu, uint32_t *pcLoops)
     12041static VBOXSTRICTRC hmR0VmxRunGuestCodeDebug(PVMCPUCC pVCpu, uint32_t *pcLoops)
    1204112042{
    1204212043    uint32_t const cMaxResumeLoops = pVCpu->CTX_SUFF(pVM)->hm.s.cMaxResumeLoops;
     
    1233012331 * @param   pVCpu   The cross context virtual CPU structure.
    1233112332 */
    12332 VMMR0DECL(VBOXSTRICTRC) VMXR0RunGuestCode(PVMCPU pVCpu)
     12333VMMR0DECL(VBOXSTRICTRC) VMXR0RunGuestCode(PVMCPUCC pVCpu)
    1233312334{
    1233412335    AssertPtr(pVCpu);
     
    1240412405 * @param   pVmxTransient   The VMX-transient structure.
    1240512406 */
    12406 DECLINLINE(VBOXSTRICTRC) hmR0VmxHandleExit(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     12407DECLINLINE(VBOXSTRICTRC) hmR0VmxHandleExit(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1240712408{
    1240812409#ifdef DEBUG_ramshankar
     
    1251912520 * @param   pVmxTransient   The VMX-transient structure.
    1252012521 */
    12521 DECLINLINE(VBOXSTRICTRC) hmR0VmxHandleExitNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     12522DECLINLINE(VBOXSTRICTRC) hmR0VmxHandleExitNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1252212523{
    1252312524    /** @todo NSTVMX: Remove after debugging regression.  */
     
    1276012761 * @remarks No-long-jump zone!!!
    1276112762 */
    12762 DECLINLINE(void) hmR0VmxAdvanceGuestRipBy(PVMCPU pVCpu, uint32_t cbInstr)
     12763DECLINLINE(void) hmR0VmxAdvanceGuestRipBy(PVMCPUCC pVCpu, uint32_t cbInstr)
    1276312764{
    1276412765    /* Advance the RIP. */
     
    1278212783 * @remarks No-long-jump zone!!!
    1278312784 */
    12784 static int hmR0VmxAdvanceGuestRip(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     12785static int hmR0VmxAdvanceGuestRip(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1278512786{
    1278612787    hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
     
    1281312814 * @remarks No-long-jump zone!!!
    1281412815 */
    12815 static VBOXSTRICTRC hmR0VmxCheckExitDueToEventDelivery(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     12816static VBOXSTRICTRC hmR0VmxCheckExitDueToEventDelivery(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1281612817{
    1281712818    Assert(!pVCpu->hm.s.Event.fPending);
     
    1303413035 * @remarks No-long-jump zone!!!
    1303513036 */
    13036 static VBOXSTRICTRC hmR0VmxCheckExitDueToVmxInstr(PVMCPU pVCpu, uint32_t uExitReason)
     13037static VBOXSTRICTRC hmR0VmxCheckExitDueToVmxInstr(PVMCPUCC pVCpu, uint32_t uExitReason)
    1303713038{
    1303813039    HMVMX_CPUMCTX_ASSERT(pVCpu, CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_RFLAGS | CPUMCTX_EXTRN_SS
     
    1310213103 *          segment is valid.
    1310313104 */
    13104 static VBOXSTRICTRC hmR0VmxDecodeMemOperand(PVMCPU pVCpu, uint32_t uExitInstrInfo, RTGCPTR GCPtrDisp, VMXMEMACCESS enmMemAccess,
     13105static VBOXSTRICTRC hmR0VmxDecodeMemOperand(PVMCPUCC pVCpu, uint32_t uExitInstrInfo, RTGCPTR GCPtrDisp, VMXMEMACCESS enmMemAccess,
    1310513106                                            PRTGCPTR pGCPtrMem)
    1310613107{
     
    1327813279 * VM-exit helper for LMSW.
    1327913280 */
    13280 static VBOXSTRICTRC hmR0VmxExitLmsw(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo, uint8_t cbInstr, uint16_t uMsw, RTGCPTR GCPtrEffDst)
     13281static VBOXSTRICTRC hmR0VmxExitLmsw(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo, uint8_t cbInstr, uint16_t uMsw, RTGCPTR GCPtrEffDst)
    1328113282{
    1328213283    int rc = hmR0VmxImportGuestState(pVCpu, pVmcsInfo, IEM_CPUMCTX_EXTRN_MUST_MASK);
     
    1330313304 * VM-exit helper for CLTS.
    1330413305 */
    13305 static VBOXSTRICTRC hmR0VmxExitClts(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo, uint8_t cbInstr)
     13306static VBOXSTRICTRC hmR0VmxExitClts(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo, uint8_t cbInstr)
    1330613307{
    1330713308    int rc = hmR0VmxImportGuestState(pVCpu, pVmcsInfo, IEM_CPUMCTX_EXTRN_MUST_MASK);
     
    1332813329 * VM-exit helper for MOV from CRx (CRx read).
    1332913330 */
    13330 static VBOXSTRICTRC hmR0VmxExitMovFromCrX(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo, uint8_t cbInstr, uint8_t iGReg, uint8_t iCrReg)
     13331static VBOXSTRICTRC hmR0VmxExitMovFromCrX(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo, uint8_t cbInstr, uint8_t iGReg, uint8_t iCrReg)
    1333113332{
    1333213333    Assert(iCrReg < 16);
     
    1336213363 * VM-exit helper for MOV to CRx (CRx write).
    1336313364 */
    13364 static VBOXSTRICTRC hmR0VmxExitMovToCrX(PVMCPU pVCpu, PVMXVMCSINFO pVmcsInfo, uint8_t cbInstr, uint8_t iGReg, uint8_t iCrReg)
     13365static VBOXSTRICTRC hmR0VmxExitMovToCrX(PVMCPUCC pVCpu, PVMXVMCSINFO pVmcsInfo, uint8_t cbInstr, uint8_t iGReg, uint8_t iCrReg)
    1336513366{
    1336613367    int rc = hmR0VmxImportGuestState(pVCpu, pVmcsInfo, IEM_CPUMCTX_EXTRN_MUST_MASK);
     
    1342313424 * @remarks Requires all fields in HMVMX_READ_XCPT_INFO to be read from the VMCS.
    1342413425 */
    13425 static VBOXSTRICTRC hmR0VmxExitXcptPF(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     13426static VBOXSTRICTRC hmR0VmxExitXcptPF(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1342613427{
    1342713428    HMVMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS(pVCpu, pVmxTransient);
    13428     PVM pVM = pVCpu->CTX_SUFF(pVM);
     13429    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    1342913430    hmR0VmxReadExitQualVmcs(pVmxTransient);
    1343013431
     
    1352113522 * @remarks Requires all fields in HMVMX_READ_XCPT_INFO to be read from the VMCS.
    1352213523 */
    13523 static VBOXSTRICTRC hmR0VmxExitXcptMF(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     13524static VBOXSTRICTRC hmR0VmxExitXcptMF(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1352413525{
    1352513526    HMVMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1355313554 * @remarks Requires all fields in HMVMX_READ_XCPT_INFO to be read from the VMCS.
    1355413555 */
    13555 static VBOXSTRICTRC hmR0VmxExitXcptBP(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     13556static VBOXSTRICTRC hmR0VmxExitXcptBP(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1355613557{
    1355713558    HMVMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1358213583 * @remarks Requires all fields in HMVMX_READ_XCPT_INFO to be read from the VMCS.
    1358313584 */
    13584 static VBOXSTRICTRC hmR0VmxExitXcptAC(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     13585static VBOXSTRICTRC hmR0VmxExitXcptAC(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1358513586{
    1358613587    HMVMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1359913600 * @remarks Requires all fields in HMVMX_READ_XCPT_INFO to be read from the VMCS.
    1360013601 */
    13601 static VBOXSTRICTRC hmR0VmxExitXcptDB(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     13602static VBOXSTRICTRC hmR0VmxExitXcptDB(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1360213603{
    1360313604    HMVMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1368513686 * @sa hmR0SvmHandleMesaDrvGp.
    1368613687 */
    13687 static int hmR0VmxHandleMesaDrvGp(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, PCPUMCTX pCtx)
     13688static int hmR0VmxHandleMesaDrvGp(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, PCPUMCTX pCtx)
    1368813689{
    1368913690    LogFunc(("cs:rip=%#04x:%#RX64 rcx=%#RX64 rbx=%#RX64\n", pCtx->cs.Sel, pCtx->rip, pCtx->rcx, pCtx->rbx));
     
    1370513706 * @sa      hmR0SvmIsMesaDrvGp.
    1370613707 */
    13707 DECLINLINE(bool) hmR0VmxIsMesaDrvGp(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient, PCPUMCTX pCtx)
     13708DECLINLINE(bool) hmR0VmxIsMesaDrvGp(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient, PCPUMCTX pCtx)
    1370813709{
    1370913710    /* 0xed:  IN eAX,dx */
     
    1375213753 * @remarks Requires all fields in HMVMX_READ_XCPT_INFO to be read from the VMCS.
    1375313754 */
    13754 static VBOXSTRICTRC hmR0VmxExitXcptGP(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     13755static VBOXSTRICTRC hmR0VmxExitXcptGP(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1375513756{
    1375613757    HMVMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1383413835 * @remarks Requires all fields in HMVMX_READ_XCPT_INFO to be read from the VMCS.
    1383513836 */
    13836 static VBOXSTRICTRC hmR0VmxExitXcptOthers(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     13837static VBOXSTRICTRC hmR0VmxExitXcptOthers(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1383713838{
    1383813839    HMVMX_VALIDATE_EXIT_XCPT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1390113902 *          executing a nested-guest (e.g., Mesa driver hacks).
    1390213903 */
    13903 static VBOXSTRICTRC hmR0VmxExitXcpt(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     13904static VBOXSTRICTRC hmR0VmxExitXcpt(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1390413905{
    1390513906    HMVMX_ASSERT_READ(pVmxTransient, HMVMX_READ_XCPT_INFO);
     
    1395913960 * VM-exit handler for external interrupts (VMX_EXIT_EXT_INT).
    1396013961 */
    13961 HMVMX_EXIT_DECL hmR0VmxExitExtInt(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     13962HMVMX_EXIT_DECL hmR0VmxExitExtInt(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1396213963{
    1396313964    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1397413975 * VM-exit.
    1397513976 */
    13976 HMVMX_EXIT_DECL hmR0VmxExitXcptOrNmi(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     13977HMVMX_EXIT_DECL hmR0VmxExitXcptOrNmi(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1397713978{
    1397813979    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1404914050 * VM-exit handler for interrupt-window exiting (VMX_EXIT_INT_WINDOW).
    1405014051 */
    14051 HMVMX_EXIT_NSRC_DECL hmR0VmxExitIntWindow(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14052HMVMX_EXIT_NSRC_DECL hmR0VmxExitIntWindow(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1405214053{
    1405314054    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1406614067 * VM-exit handler for NMI-window exiting (VMX_EXIT_NMI_WINDOW).
    1406714068 */
    14068 HMVMX_EXIT_NSRC_DECL hmR0VmxExitNmiWindow(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14069HMVMX_EXIT_NSRC_DECL hmR0VmxExitNmiWindow(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1406914070{
    1407014071    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1410814109 * VM-exit handler for WBINVD (VMX_EXIT_WBINVD). Conditional VM-exit.
    1410914110 */
    14110 HMVMX_EXIT_NSRC_DECL hmR0VmxExitWbinvd(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14111HMVMX_EXIT_NSRC_DECL hmR0VmxExitWbinvd(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1411114112{
    1411214113    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1411814119 * VM-exit handler for INVD (VMX_EXIT_INVD). Unconditional VM-exit.
    1411914120 */
    14120 HMVMX_EXIT_NSRC_DECL hmR0VmxExitInvd(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14121HMVMX_EXIT_NSRC_DECL hmR0VmxExitInvd(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1412114122{
    1412214123    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1412814129 * VM-exit handler for CPUID (VMX_EXIT_CPUID). Unconditional VM-exit.
    1412914130 */
    14130 HMVMX_EXIT_DECL hmR0VmxExitCpuid(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14131HMVMX_EXIT_DECL hmR0VmxExitCpuid(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1413114132{
    1413214133    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1418414185 * VM-exit handler for GETSEC (VMX_EXIT_GETSEC). Unconditional VM-exit.
    1418514186 */
    14186 HMVMX_EXIT_DECL hmR0VmxExitGetsec(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14187HMVMX_EXIT_DECL hmR0VmxExitGetsec(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1418714188{
    1418814189    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1420314204 * VM-exit handler for RDTSC (VMX_EXIT_RDTSC). Conditional VM-exit.
    1420414205 */
    14205 HMVMX_EXIT_DECL hmR0VmxExitRdtsc(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14206HMVMX_EXIT_DECL hmR0VmxExitRdtsc(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1420614207{
    1420714208    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1423314234 * VM-exit handler for RDTSCP (VMX_EXIT_RDTSCP). Conditional VM-exit.
    1423414235 */
    14235 HMVMX_EXIT_DECL hmR0VmxExitRdtscp(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14236HMVMX_EXIT_DECL hmR0VmxExitRdtscp(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1423614237{
    1423714238    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1426314264 * VM-exit handler for RDPMC (VMX_EXIT_RDPMC). Conditional VM-exit.
    1426414265 */
    14265 HMVMX_EXIT_DECL hmR0VmxExitRdpmc(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14266HMVMX_EXIT_DECL hmR0VmxExitRdpmc(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1426614267{
    1426714268    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1429114292 * VM-exit handler for VMCALL (VMX_EXIT_VMCALL). Unconditional VM-exit.
    1429214293 */
    14293 HMVMX_EXIT_DECL hmR0VmxExitVmcall(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14294HMVMX_EXIT_DECL hmR0VmxExitVmcall(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1429414295{
    1429514296    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1433514336 * VM-exit handler for INVLPG (VMX_EXIT_INVLPG). Conditional VM-exit.
    1433614337 */
    14337 HMVMX_EXIT_DECL hmR0VmxExitInvlpg(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14338HMVMX_EXIT_DECL hmR0VmxExitInvlpg(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1433814339{
    1433914340    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1436514366 * VM-exit handler for MONITOR (VMX_EXIT_MONITOR). Conditional VM-exit.
    1436614367 */
    14367 HMVMX_EXIT_DECL hmR0VmxExitMonitor(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14368HMVMX_EXIT_DECL hmR0VmxExitMonitor(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1436814369{
    1436914370    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1439014391 * VM-exit handler for MWAIT (VMX_EXIT_MWAIT). Conditional VM-exit.
    1439114392 */
    14392 HMVMX_EXIT_DECL hmR0VmxExitMwait(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14393HMVMX_EXIT_DECL hmR0VmxExitMwait(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1439314394{
    1439414395    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1441514416 * VM-exit.
    1441614417 */
    14417 HMVMX_EXIT_DECL hmR0VmxExitTripleFault(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14418HMVMX_EXIT_DECL hmR0VmxExitTripleFault(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1441814419{
    1441914420    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1442514426 * VM-exit handler for HLT (VMX_EXIT_HLT). Conditional VM-exit.
    1442614427 */
    14427 HMVMX_EXIT_DECL hmR0VmxExitHlt(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14428HMVMX_EXIT_DECL hmR0VmxExitHlt(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1442814429{
    1442914430    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1444814449 * the guest.
    1444914450 */
    14450 HMVMX_EXIT_NSRC_DECL hmR0VmxExitSetPendingXcptUD(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14451HMVMX_EXIT_NSRC_DECL hmR0VmxExitSetPendingXcptUD(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1445114452{
    1445214453    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1445914460 * VM-exit handler for expiry of the VMX-preemption timer.
    1446014461 */
    14461 HMVMX_EXIT_DECL hmR0VmxExitPreemptTimer(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14462HMVMX_EXIT_DECL hmR0VmxExitPreemptTimer(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1446214463{
    1446314464    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1446714468
    1446814469    /* If there are any timer events pending, fall back to ring-3, otherwise resume guest execution. */
    14469     PVM pVM = pVCpu->CTX_SUFF(pVM);
     14470    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    1447014471    bool fTimersPending = TMTimerPollBool(pVM, pVCpu);
    1447114472    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitPreemptTimer);
     
    1447714478 * VM-exit handler for XSETBV (VMX_EXIT_XSETBV). Unconditional VM-exit.
    1447814479 */
    14479 HMVMX_EXIT_DECL hmR0VmxExitXsetbv(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14480HMVMX_EXIT_DECL hmR0VmxExitXsetbv(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1448014481{
    1448114482    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1450014501 * VM-exit handler for INVPCID (VMX_EXIT_INVPCID). Conditional VM-exit.
    1450114502 */
    14502 HMVMX_EXIT_DECL hmR0VmxExitInvpcid(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14503HMVMX_EXIT_DECL hmR0VmxExitInvpcid(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1450314504{
    1450414505    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1451214513 * VM-exit.
    1451314514 */
    14514 HMVMX_EXIT_NSRC_DECL hmR0VmxExitErrInvalidGuestState(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14515HMVMX_EXIT_NSRC_DECL hmR0VmxExitErrInvalidGuestState(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1451514516{
    1451614517    PVMXVMCSINFO pVmcsInfo = pVmxTransient->pVmcsInfo;
     
    1456314564 * VM-exit handler for all undefined/unexpected reasons. Should never happen.
    1456414565 */
    14565 HMVMX_EXIT_NSRC_DECL hmR0VmxExitErrUnexpected(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14566HMVMX_EXIT_NSRC_DECL hmR0VmxExitErrUnexpected(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1456614567{
    1456714568    /*
     
    1465014651 * VM-exit handler for RDMSR (VMX_EXIT_RDMSR).
    1465114652 */
    14652 HMVMX_EXIT_DECL hmR0VmxExitRdmsr(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14653HMVMX_EXIT_DECL hmR0VmxExitRdmsr(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1465314654{
    1465414655    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1471614717 * VM-exit handler for WRMSR (VMX_EXIT_WRMSR).
    1471714718 */
    14718 HMVMX_EXIT_DECL hmR0VmxExitWrmsr(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14719HMVMX_EXIT_DECL hmR0VmxExitWrmsr(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1471914720{
    1472014721    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1485914860 * VM-exit handler for PAUSE (VMX_EXIT_PAUSE). Conditional VM-exit.
    1486014861 */
    14861 HMVMX_EXIT_DECL hmR0VmxExitPause(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14862HMVMX_EXIT_DECL hmR0VmxExitPause(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1486214863{
    1486314864    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1487814879 * threshold (VMX_EXIT_TPR_BELOW_THRESHOLD). Conditional VM-exit.
    1487914880 */
    14880 HMVMX_EXIT_NSRC_DECL hmR0VmxExitTprBelowThreshold(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14881HMVMX_EXIT_NSRC_DECL hmR0VmxExitTprBelowThreshold(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1488114882{
    1488214883    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1490214903 *         incompatible guest state for VMX execution (real-on-v86 case).
    1490314904 */
    14904 HMVMX_EXIT_DECL hmR0VmxExitMovCRx(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     14905HMVMX_EXIT_DECL hmR0VmxExitMovCRx(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1490514906{
    1490614907    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1491214913
    1491314914    VBOXSTRICTRC rcStrict;
    14914     PVM pVM = pVCpu->CTX_SUFF(pVM);
     14915    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    1491514916    uint64_t const uExitQual   = pVmxTransient->uExitQual;
    1491614917    uint32_t const uAccessType = VMX_EXIT_QUAL_CRX_ACCESS(uExitQual);
     
    1505215053 * VM-exit.
    1505315054 */
    15054 HMVMX_EXIT_DECL hmR0VmxExitIoInstr(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15055HMVMX_EXIT_DECL hmR0VmxExitIoInstr(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1505515056{
    1505615057    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1509915100        uint32_t const cbInstr  = pVmxTransient->cbInstr;
    1510015101        bool fUpdateRipAlready  = false; /* ugly hack, should be temporary. */
    15101         PVM pVM                 = pVCpu->CTX_SUFF(pVM);
     15102        PVMCC pVM                 = pVCpu->CTX_SUFF(pVM);
    1510215103        if (fIOString)
    1510315104        {
     
    1528815289 * VM-exit.
    1528915290 */
    15290 HMVMX_EXIT_DECL hmR0VmxExitTaskSwitch(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15291HMVMX_EXIT_DECL hmR0VmxExitTaskSwitch(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1529115292{
    1529215293    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1533515336 * VM-exit handler for monitor-trap-flag (VMX_EXIT_MTF). Conditional VM-exit.
    1533615337 */
    15337 HMVMX_EXIT_DECL hmR0VmxExitMtf(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15338HMVMX_EXIT_DECL hmR0VmxExitMtf(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1533815339{
    1533915340    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1535015351 * VM-exit handler for APIC access (VMX_EXIT_APIC_ACCESS). Conditional VM-exit.
    1535115352 */
    15352 HMVMX_EXIT_DECL hmR0VmxExitApicAccess(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15353HMVMX_EXIT_DECL hmR0VmxExitApicAccess(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1535315354{
    1535415355    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1540315404                 VMX_EXIT_QUAL_APIC_ACCESS_OFFSET(pVmxTransient->uExitQual)));
    1540415405
    15405             PVM      pVM  = pVCpu->CTX_SUFF(pVM);
     15406            PVMCC      pVM  = pVCpu->CTX_SUFF(pVM);
    1540615407            PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    1540715408            rcStrict = IOMMMIOPhysHandler(pVM, pVCpu,
     
    1543815439 * VM-exit.
    1543915440 */
    15440 HMVMX_EXIT_DECL hmR0VmxExitMovDRx(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15441HMVMX_EXIT_DECL hmR0VmxExitMovDRx(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1544115442{
    1544215443    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1549815499    Log4Func(("cs:rip=%#04x:%#RX64\n", pCtx->cs.Sel, pCtx->rip));
    1549915500
    15500     PVM pVM = pVCpu->CTX_SUFF(pVM);
     15501    PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    1550115502    if (VMX_EXIT_QUAL_DRX_DIRECTION(pVmxTransient->uExitQual) == VMX_EXIT_QUAL_DRX_DIRECTION_WRITE)
    1550215503    {
     
    1553115532 * Conditional VM-exit.
    1553215533 */
    15533 HMVMX_EXIT_DECL hmR0VmxExitEptMisconfig(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15534HMVMX_EXIT_DECL hmR0VmxExitEptMisconfig(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1553415535{
    1553515536    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1559315594         * weird case. See @bugref{6043}.
    1559415595         */
    15595         PVM      pVM  = pVCpu->CTX_SUFF(pVM);
     15596        PVMCC      pVM  = pVCpu->CTX_SUFF(pVM);
    1559615597        PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    1559715598        rcStrict = PGMR0Trap0eHandlerNPMisconfig(pVM, pVCpu, PGMMODE_EPT, CPUMCTX2CORE(pCtx), GCPhys, UINT32_MAX);
     
    1563015631 * VM-exit.
    1563115632 */
    15632 HMVMX_EXIT_DECL hmR0VmxExitEptViolation(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15633HMVMX_EXIT_DECL hmR0VmxExitEptViolation(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1563315634{
    1563415635    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1567815679        uErrorCode |= X86_TRAP_PF_P;
    1567915680
    15680     PVM      pVM  = pVCpu->CTX_SUFF(pVM);
     15681    PVMCC      pVM  = pVCpu->CTX_SUFF(pVM);
    1568115682    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    1568215683    Log4Func(("at %#RX64 (%#RX64 errcode=%#x) cs:rip=%#04x:%#RX64\n", GCPhys, uExitQual, uErrorCode, pCtx->cs.Sel, pCtx->rip));
     
    1570915710 * VM-exit handler for VMCLEAR (VMX_EXIT_VMCLEAR). Unconditional VM-exit.
    1571015711 */
    15711 HMVMX_EXIT_DECL hmR0VmxExitVmclear(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15712HMVMX_EXIT_DECL hmR0VmxExitVmclear(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1571215713{
    1571315714    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1574615747 * VM-exit handler for VMLAUNCH (VMX_EXIT_VMLAUNCH). Unconditional VM-exit.
    1574715748 */
    15748 HMVMX_EXIT_DECL hmR0VmxExitVmlaunch(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15749HMVMX_EXIT_DECL hmR0VmxExitVmlaunch(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1574915750{
    1575015751    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1577515776 * VM-exit handler for VMPTRLD (VMX_EXIT_VMPTRLD). Unconditional VM-exit.
    1577615777 */
    15777 HMVMX_EXIT_DECL hmR0VmxExitVmptrld(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15778HMVMX_EXIT_DECL hmR0VmxExitVmptrld(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1577815779{
    1577915780    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1581215813 * VM-exit handler for VMPTRST (VMX_EXIT_VMPTRST). Unconditional VM-exit.
    1581315814 */
    15814 HMVMX_EXIT_DECL hmR0VmxExitVmptrst(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15815HMVMX_EXIT_DECL hmR0VmxExitVmptrst(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1581515816{
    1581615817    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1584915850 * VM-exit handler for VMREAD (VMX_EXIT_VMREAD). Conditional VM-exit.
    1585015851 */
    15851 HMVMX_EXIT_DECL hmR0VmxExitVmread(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15852HMVMX_EXIT_DECL hmR0VmxExitVmread(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1585215853{
    1585315854    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1589215893 * VM-exit handler for VMRESUME (VMX_EXIT_VMRESUME). Unconditional VM-exit.
    1589315894 */
    15894 HMVMX_EXIT_DECL hmR0VmxExitVmresume(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15895HMVMX_EXIT_DECL hmR0VmxExitVmresume(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1589515896{
    1589615897    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1592115922 * VM-exit handler for VMWRITE (VMX_EXIT_VMWRITE). Conditional VM-exit.
    1592215923 */
    15923 HMVMX_EXIT_DECL hmR0VmxExitVmwrite(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15924HMVMX_EXIT_DECL hmR0VmxExitVmwrite(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1592415925{
    1592515926    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1596415965 * VM-exit handler for VMXOFF (VMX_EXIT_VMXOFF). Unconditional VM-exit.
    1596515966 */
    15966 HMVMX_EXIT_DECL hmR0VmxExitVmxoff(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15967HMVMX_EXIT_DECL hmR0VmxExitVmxoff(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1596715968{
    1596815969    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1599115992 * VM-exit handler for VMXON (VMX_EXIT_VMXON). Unconditional VM-exit.
    1599215993 */
    15993 HMVMX_EXIT_DECL hmR0VmxExitVmxon(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     15994HMVMX_EXIT_DECL hmR0VmxExitVmxon(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1599415995{
    1599515996    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1602816029 * VM-exit handler for INVVPID (VMX_EXIT_INVVPID). Unconditional VM-exit.
    1602916030 */
    16030 HMVMX_EXIT_DECL hmR0VmxExitInvvpid(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16031HMVMX_EXIT_DECL hmR0VmxExitInvvpid(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1603116032{
    1603216033    HMVMX_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1607516076 * Conditional VM-exit.
    1607616077 */
    16077 HMVMX_EXIT_DECL hmR0VmxExitXcptOrNmiNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16078HMVMX_EXIT_DECL hmR0VmxExitXcptOrNmiNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1607816079{
    1607916080    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1618616187 * Unconditional VM-exit.
    1618716188 */
    16188 HMVMX_EXIT_DECL hmR0VmxExitTripleFaultNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16189HMVMX_EXIT_DECL hmR0VmxExitTripleFaultNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1618916190{
    1619016191    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1619616197 * Nested-guest VM-exit handler for interrupt-window exiting (VMX_EXIT_INT_WINDOW).
    1619716198 */
    16198 HMVMX_EXIT_NSRC_DECL hmR0VmxExitIntWindowNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16199HMVMX_EXIT_NSRC_DECL hmR0VmxExitIntWindowNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1619916200{
    1620016201    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1620916210 * Nested-guest VM-exit handler for NMI-window exiting (VMX_EXIT_NMI_WINDOW).
    1621016211 */
    16211 HMVMX_EXIT_NSRC_DECL hmR0VmxExitNmiWindowNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16212HMVMX_EXIT_NSRC_DECL hmR0VmxExitNmiWindowNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1621216213{
    1621316214    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1622316224 * Unconditional VM-exit.
    1622416225 */
    16225 HMVMX_EXIT_DECL hmR0VmxExitTaskSwitchNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16226HMVMX_EXIT_DECL hmR0VmxExitTaskSwitchNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1622616227{
    1622716228    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1624916250 * Nested-guest VM-exit handler for HLT (VMX_EXIT_HLT). Conditional VM-exit.
    1625016251 */
    16251 HMVMX_EXIT_DECL hmR0VmxExitHltNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16252HMVMX_EXIT_DECL hmR0VmxExitHltNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1625216253{
    1625316254    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1626516266 * Nested-guest VM-exit handler for INVLPG (VMX_EXIT_INVLPG). Conditional VM-exit.
    1626616267 */
    16267 HMVMX_EXIT_DECL hmR0VmxExitInvlpgNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16268HMVMX_EXIT_DECL hmR0VmxExitInvlpgNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1626816269{
    1626916270    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1628816289 * Nested-guest VM-exit handler for RDPMC (VMX_EXIT_RDPMC). Conditional VM-exit.
    1628916290 */
    16290 HMVMX_EXIT_DECL hmR0VmxExitRdpmcNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16291HMVMX_EXIT_DECL hmR0VmxExitRdpmcNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1629116292{
    1629216293    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1630516306 * (VMX_EXIT_VMWRITE). Conditional VM-exit.
    1630616307 */
    16307 HMVMX_EXIT_DECL hmR0VmxExitVmreadVmwriteNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16308HMVMX_EXIT_DECL hmR0VmxExitVmreadVmwriteNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1630816309{
    1630916310    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1634516346 * Nested-guest VM-exit handler for RDTSC (VMX_EXIT_RDTSC). Conditional VM-exit.
    1634616347 */
    16347 HMVMX_EXIT_DECL hmR0VmxExitRdtscNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16348HMVMX_EXIT_DECL hmR0VmxExitRdtscNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1634816349{
    1634916350    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1636316364 * Conditional VM-exit.
    1636416365 */
    16365 HMVMX_EXIT_DECL hmR0VmxExitMovCRxNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16366HMVMX_EXIT_DECL hmR0VmxExitMovCRxNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1636616367{
    1636716368    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1652216523 * Conditional VM-exit.
    1652316524 */
    16524 HMVMX_EXIT_DECL hmR0VmxExitMovDRxNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16525HMVMX_EXIT_DECL hmR0VmxExitMovDRxNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1652516526{
    1652616527    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1654616547 * Conditional VM-exit.
    1654716548 */
    16548 HMVMX_EXIT_DECL hmR0VmxExitIoInstrNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16549HMVMX_EXIT_DECL hmR0VmxExitIoInstrNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1654916550{
    1655016551    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1656916570         *   - Optionally provides VM-exit instruction info (depends on CPU feature).
    1657016571         */
    16571         PVM pVM = pVCpu->CTX_SUFF(pVM);
     16572        PVMCC pVM = pVCpu->CTX_SUFF(pVM);
    1657216573        hmR0VmxReadExitInstrLenVmcs(pVmxTransient);
    1657316574
     
    1660416605 * Nested-guest VM-exit handler for RDMSR (VMX_EXIT_RDMSR).
    1660516606 */
    16606 HMVMX_EXIT_DECL hmR0VmxExitRdmsrNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16607HMVMX_EXIT_DECL hmR0VmxExitRdmsrNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1660716608{
    1660816609    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1662616627 * Nested-guest VM-exit handler for WRMSR (VMX_EXIT_WRMSR).
    1662716628 */
    16628 HMVMX_EXIT_DECL hmR0VmxExitWrmsrNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16629HMVMX_EXIT_DECL hmR0VmxExitWrmsrNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1662916630{
    1663016631    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1664816649 * Nested-guest VM-exit handler for MWAIT (VMX_EXIT_MWAIT). Conditional VM-exit.
    1664916650 */
    16650 HMVMX_EXIT_DECL hmR0VmxExitMwaitNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16651HMVMX_EXIT_DECL hmR0VmxExitMwaitNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1665116652{
    1665216653    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1666516666 * VM-exit.
    1666616667 */
    16667 HMVMX_EXIT_DECL hmR0VmxExitMtfNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16668HMVMX_EXIT_DECL hmR0VmxExitMtfNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1666816669{
    1666916670    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1667716678 * Nested-guest VM-exit handler for MONITOR (VMX_EXIT_MONITOR). Conditional VM-exit.
    1667816679 */
    16679 HMVMX_EXIT_DECL hmR0VmxExitMonitorNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16680HMVMX_EXIT_DECL hmR0VmxExitMonitorNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1668016681{
    1668116682    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1669316694 * Nested-guest VM-exit handler for PAUSE (VMX_EXIT_PAUSE). Conditional VM-exit.
    1669416695 */
    16695 HMVMX_EXIT_DECL hmR0VmxExitPauseNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16696HMVMX_EXIT_DECL hmR0VmxExitPauseNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1669616697{
    1669716698    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1671616717 * specified threshold (VMX_EXIT_TPR_BELOW_THRESHOLD). Conditional VM-exit.
    1671716718 */
    16718 HMVMX_EXIT_NSRC_DECL hmR0VmxExitTprBelowThresholdNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16719HMVMX_EXIT_NSRC_DECL hmR0VmxExitTprBelowThresholdNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1671916720{
    1672016721    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1673016731 * VM-exit.
    1673116732 */
    16732 HMVMX_EXIT_DECL hmR0VmxExitApicAccessNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16733HMVMX_EXIT_DECL hmR0VmxExitApicAccessNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1673316734{
    1673416735    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1676216763 * Conditional VM-exit.
    1676316764 */
    16764 HMVMX_EXIT_DECL hmR0VmxExitApicWriteNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16765HMVMX_EXIT_DECL hmR0VmxExitApicWriteNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1676516766{
    1676616767    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1677616777 * Conditional VM-exit.
    1677716778 */
    16778 HMVMX_EXIT_DECL hmR0VmxExitVirtEoiNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16779HMVMX_EXIT_DECL hmR0VmxExitVirtEoiNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1677916780{
    1678016781    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1678916790 * Nested-guest VM-exit handler for RDTSCP (VMX_EXIT_RDTSCP). Conditional VM-exit.
    1679016791 */
    16791 HMVMX_EXIT_DECL hmR0VmxExitRdtscpNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16792HMVMX_EXIT_DECL hmR0VmxExitRdtscpNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1679216793{
    1679316794    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1680616807 * Nested-guest VM-exit handler for WBINVD (VMX_EXIT_WBINVD). Conditional VM-exit.
    1680716808 */
    16808 HMVMX_EXIT_NSRC_DECL hmR0VmxExitWbinvdNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16809HMVMX_EXIT_NSRC_DECL hmR0VmxExitWbinvdNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1680916810{
    1681016811    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1682216823 * Nested-guest VM-exit handler for INVPCID (VMX_EXIT_INVPCID). Conditional VM-exit.
    1682316824 */
    16824 HMVMX_EXIT_DECL hmR0VmxExitInvpcidNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16825HMVMX_EXIT_DECL hmR0VmxExitInvpcidNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1682516826{
    1682616827    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1684916850 * (VMX_EXIT_ERR_INVALID_GUEST_STATE). Error VM-exit.
    1685016851 */
    16851 HMVMX_EXIT_DECL hmR0VmxExitErrInvalidGuestStateNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16852HMVMX_EXIT_DECL hmR0VmxExitErrInvalidGuestStateNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1685216853{
    1685316854    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1687116872 * Unconditional VM-exit.
    1687216873 */
    16873 HMVMX_EXIT_DECL hmR0VmxExitInstrNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16874HMVMX_EXIT_DECL hmR0VmxExitInstrNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1687416875{
    1687516876    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
     
    1690016901 * Unconditional VM-exit.
    1690116902 */
    16902 HMVMX_EXIT_DECL hmR0VmxExitInstrWithInfoNested(PVMCPU pVCpu, PVMXTRANSIENT pVmxTransient)
     16903HMVMX_EXIT_DECL hmR0VmxExitInstrWithInfoNested(PVMCPUCC pVCpu, PVMXTRANSIENT pVmxTransient)
    1690316904{
    1690416905    HMVMX_VALIDATE_NESTED_EXIT_HANDLER_PARAMS(pVCpu, pVmxTransient);
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.h

    r80150 r80274  
    3131
    3232#ifdef IN_RING0
    33 VMMR0DECL(int)          VMXR0Enter(PVMCPU pVCpu);
    34 VMMR0DECL(void)         VMXR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPU pVCpu, bool fGlobalInit);
    35 VMMR0DECL(int)          VMXR0EnableCpu(PHMPHYSCPU pHostCpu, PVM pVM, void *pvPageCpu, RTHCPHYS pPageCpuPhys,
     33VMMR0DECL(int)          VMXR0Enter(PVMCPUCC pVCpu);
     34VMMR0DECL(void)         VMXR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, PVMCPUCC pVCpu, bool fGlobalInit);
     35VMMR0DECL(int)          VMXR0EnableCpu(PHMPHYSCPU pHostCpu, PVMCC pVM, void *pvPageCpu, RTHCPHYS pPageCpuPhys,
    3636                                       bool fEnabledBySystem, PCSUPHWVIRTMSRS pHwvirtMsrs);
    3737VMMR0DECL(int)          VMXR0DisableCpu(void *pvPageCpu, RTHCPHYS pPageCpuPhys);
    3838VMMR0DECL(int)          VMXR0GlobalInit(void);
    3939VMMR0DECL(void)         VMXR0GlobalTerm(void);
    40 VMMR0DECL(int)          VMXR0InitVM(PVM pVM);
    41 VMMR0DECL(int)          VMXR0TermVM(PVM pVM);
    42 VMMR0DECL(int)          VMXR0SetupVM(PVM pVM);
    43 VMMR0DECL(int)          VMXR0ExportHostState(PVMCPU pVCpu);
    44 VMMR0DECL(int)          VMXR0InvalidatePage(PVMCPU pVCpu, RTGCPTR GCVirt);
    45 VMMR0DECL(int)          VMXR0ImportStateOnDemand(PVMCPU pVCpu, uint64_t fWhat);
    46 VMMR0DECL(VBOXSTRICTRC) VMXR0RunGuestCode(PVMCPU pVCpu);
    47 DECLASM(int)            VMXR0StartVM32(RTHCUINT fResume, PCPUMCTX pCtx, void *pvUnused, PVM pVM, PVMCPU pVCpu);
    48 DECLASM(int)            VMXR0StartVM64(RTHCUINT fResume, PCPUMCTX pCtx, void *pvUnused, PVM pVM, PVMCPU pVCpu);
     40VMMR0DECL(int)          VMXR0InitVM(PVMCC pVM);
     41VMMR0DECL(int)          VMXR0TermVM(PVMCC pVM);
     42VMMR0DECL(int)          VMXR0SetupVM(PVMCC pVM);
     43VMMR0DECL(int)          VMXR0ExportHostState(PVMCPUCC pVCpu);
     44VMMR0DECL(int)          VMXR0InvalidatePage(PVMCPUCC pVCpu, RTGCPTR GCVirt);
     45VMMR0DECL(int)          VMXR0ImportStateOnDemand(PVMCPUCC pVCpu, uint64_t fWhat);
     46VMMR0DECL(VBOXSTRICTRC) VMXR0RunGuestCode(PVMCPUCC pVCpu);
     47DECLASM(int)            VMXR0StartVM32(RTHCUINT fResume, PCPUMCTX pCtx, void *pvUnused, PVMCC pVM, PVMCPUCC pVCpu);
     48DECLASM(int)            VMXR0StartVM64(RTHCUINT fResume, PCPUMCTX pCtx, void *pvUnused, PVMCC pVM, PVMCPUCC pVCpu);
    4949#endif /* IN_RING0 */
    5050
  • trunk/src/VBox/VMM/VMMR0/NEMR0Native-win.cpp

    r80268 r80274  
    3535#include "NEMInternal.h"
    3636#include <VBox/vmm/gvm.h>
    37 #include <VBox/vmm/vm.h>
     37#include <VBox/vmm/vmcc.h>
    3838#include <VBox/vmm/gvmm.h>
    3939#include <VBox/param.h>
     
    8080*   Internal Functions                                                                                                           *
    8181*********************************************************************************************************************************/
    82 NEM_TMPL_STATIC int  nemR0WinMapPages(PGVM pGVM, PVM pVM, PGVMCPU pGVCpu, RTGCPHYS GCPhysSrc, RTGCPHYS GCPhysDst,
     82NEM_TMPL_STATIC int  nemR0WinMapPages(PGVM pGVM, PVMCC pVM, PGVMCPU pGVCpu, RTGCPHYS GCPhysSrc, RTGCPHYS GCPhysDst,
    8383                                      uint32_t cPages, uint32_t fFlags);
    8484NEM_TMPL_STATIC int  nemR0WinUnmapPages(PGVM pGVM, PGVMCPU pGVCpu, RTGCPHYS GCPhys, uint32_t cPages);
     
    8989NEM_TMPL_STATIC int  nemR0WinResumeCpuTickOnAll(PGVM pGVM, PGVMCPU pGVCpu, uint64_t uPausedTscValue);
    9090#endif
    91 DECLINLINE(NTSTATUS) nemR0NtPerformIoControl(PGVM pGVM, uint32_t uFunction, void *pvInput, uint32_t cbInput,
     91DECLINLINE(NTSTATUS) nemR0NtPerformIoControl(PGVM pGVM, PVMCPUCC pVCpu, uint32_t uFunction, void *pvInput, uint32_t cbInput,
    9292                                             void *pvOutput, uint32_t cbOutput);
    9393
     
    159159 * @thread  EMT(0)
    160160 */
    161 VMMR0_INT_DECL(int) NEMR0InitVM(PGVM pGVM, PVM pVM)
     161VMMR0_INT_DECL(int) NEMR0InitVM(PGVM pGVM, PVMCC pVM)
    162162{
    163163    AssertCompile(sizeof(pGVM->nemr0.s) <= sizeof(pGVM->nemr0.padding));
     
    238238 * @returns NT status code.
    239239 * @param   pGVM            The ring-0 VM structure.
     240 * @param   pVCpu           The cross context CPU structure of the calling EMT.
    240241 * @param   uFunction       The function to perform.
    241242 * @param   pvInput         The input buffer.  This must point within the VM
     
    248249 * @param   cbOutput        The size of the output.  @a pvOutput must be NULL
    249250 *                          when zero.
     251 * @thread  EMT(pVCpu)
    250252 */
    251 DECLINLINE(NTSTATUS) nemR0NtPerformIoControl(PGVM pGVM, uint32_t uFunction, void *pvInput, uint32_t cbInput,
     253DECLINLINE(NTSTATUS) nemR0NtPerformIoControl(PGVM pGVM, PVMCPUCC pVCpu, uint32_t uFunction, void *pvInput, uint32_t cbInput,
    252254                                             void *pvOutput, uint32_t cbOutput)
    253255{
     
    256258     * Input and output parameters are part of the VM CPU structure.
    257259     */
    258     PVM          pVM  = pGVM->pVM;
     260    VMCPU_ASSERT_EMT(pVCpu);
     261# ifdef VBOX_BUGREF_9217
     262    if (pvInput)
     263        AssertReturn(((uintptr_t)pvInput + cbInput) - (uintptr_t)pVCpu <= sizeof(*pVCpu), VERR_INVALID_PARAMETER);
     264    if (pvOutput)
     265        AssertReturn(((uintptr_t)pvOutput + cbOutput) - (uintptr_t)pVCpu <= sizeof(*pVCpu), VERR_INVALID_PARAMETER);
     266# else
     267    PVMCC        pVM  = pGVM->pVM;
    259268    size_t const cbVM = RT_UOFFSETOF_DYN(VM, aCpus[pGVM->cCpus]);
    260269    if (pvInput)
     
    262271    if (pvOutput)
    263272        AssertReturn(((uintptr_t)pvOutput + cbOutput) - (uintptr_t)pVM <= cbVM, VERR_INVALID_PARAMETER);
     273# endif
    264274#endif
    265275
     
    267277    int rc = SUPR0IoCtlPerform(pGVM->nemr0.s.pIoCtlCtx, uFunction,
    268278                               pvInput,
     279#ifdef VBOX_BUGREF_9217
     280                               pvInput  ? (uintptr_t)pvInput  + pVCpu->nemr0.s.offRing3ConversionDelta : NIL_RTR3PTR,
     281#else
    269282                               pvInput  ? (uintptr_t)pvInput  + pGVM->nemr0.s.offRing3ConversionDelta : NIL_RTR3PTR,
     283#endif
    270284                               cbInput,
    271285                               pvOutput,
     286#ifdef VBOX_BUGREF_9217
     287                               pvOutput ? (uintptr_t)pvOutput + pVCpu->nemr0.s.offRing3ConversionDelta : NIL_RTR3PTR,
     288#else
    272289                               pvOutput ? (uintptr_t)pvOutput + pGVM->nemr0.s.offRing3ConversionDelta : NIL_RTR3PTR,
     290#endif
    273291                               cbOutput,
    274292                               &rcNt);
    275293    if (RT_SUCCESS(rc) || !NT_SUCCESS((NTSTATUS)rcNt))
    276294        return (NTSTATUS)rcNt;
     295#ifndef VBOX_BUGREF_9217
     296    RT_NOREF(pVCpu);
     297#endif
    277298    return STATUS_UNSUCCESSFUL;
    278299}
     
    287308 * @thread  EMT(0)
    288309 */
    289 VMMR0_INT_DECL(int) NEMR0InitVMPart2(PGVM pGVM, PVM pVM)
     310VMMR0_INT_DECL(int) NEMR0InitVMPart2(PGVM pGVM, PVMCC pVM)
    290311{
    291312    int rc = GVMMR0ValidateGVMandVMandEMT(pGVM, pVM, 0);
     
    342363        rc = SUPR0IoCtlSetupForHandle(pGVM->pSession, pVM->nem.s.hPartitionDevice, 0, &pGVM->nemr0.s.pIoCtlCtx);
    343364        AssertLogRelRCReturn(rc, rc);
     365#ifdef VBOX_BUGREF_9217
     366        for (VMCPUID idCpu = 0; idCpu < pGVM->cCpus; idCpu++)
     367        {
     368            PGVMCPU pGVCpu = &pGVM->aCpus[idCpu];
     369            pGVCpu->nemr0.s.offRing3ConversionDelta = (uintptr_t)pGVM->aCpus[idCpu].pVCpuR3 - (uintptr_t)pGVCpu;
     370        }
     371#else
    344372        pGVM->nemr0.s.offRing3ConversionDelta = (uintptr_t)pVM->pVMR3 - (uintptr_t)pGVM->pVM;
     373#endif
    345374
    346375        /*
    347376         * Get the partition ID.
    348377         */
    349         PVMCPU pVCpu = &pGVM->pVM->aCpus[0];
    350         NTSTATUS rcNt = nemR0NtPerformIoControl(pGVM, pGVM->nemr0.s.IoCtlGetHvPartitionId.uFunction, NULL, 0,
    351                                                 &pVCpu->nem.s.uIoCtlBuf.idPartition, sizeof(pVCpu->nem.s.uIoCtlBuf.idPartition));
     378#ifdef VBOX_BUGREF_9217
     379        PVMCPUCC pVCpu0 = &pGVM->aCpus[0];
     380#else
     381        PVMCPUCC pVCpu0 = &pGVM->pVM->aCpus[0];
     382#endif
     383        NTSTATUS rcNt = nemR0NtPerformIoControl(pGVM, pVCpu0, pGVM->nemr0.s.IoCtlGetHvPartitionId.uFunction, NULL, 0,
     384                                                &pVCpu0->nem.s.uIoCtlBuf.idPartition, sizeof(pVCpu0->nem.s.uIoCtlBuf.idPartition));
    352385        AssertLogRelMsgReturn(NT_SUCCESS(rcNt), ("IoCtlGetHvPartitionId failed: %#x\n", rcNt), VERR_NEM_INIT_FAILED);
    353         pGVM->nemr0.s.idHvPartition = pVCpu->nem.s.uIoCtlBuf.idPartition;
     386        pGVM->nemr0.s.idHvPartition = pVCpu0->nem.s.uIoCtlBuf.idPartition;
    354387        AssertLogRelMsgReturn(pGVM->nemr0.s.idHvPartition == pVM->nem.s.idHvPartition,
    355388                              ("idHvPartition mismatch: r0=%#RX64, r3=%#RX64\n", pGVM->nemr0.s.idHvPartition, pVM->nem.s.idHvPartition),
     
    419452 * Worker for NEMR0MapPages and others.
    420453 */
    421 NEM_TMPL_STATIC int nemR0WinMapPages(PGVM pGVM, PVM pVM, PGVMCPU pGVCpu, RTGCPHYS GCPhysSrc, RTGCPHYS GCPhysDst,
     454NEM_TMPL_STATIC int nemR0WinMapPages(PGVM pGVM, PVMCC pVM, PGVMCPU pGVCpu, RTGCPHYS GCPhysSrc, RTGCPHYS GCPhysDst,
    422455                                     uint32_t cPages, uint32_t fFlags)
    423456{
     
    501534 * @thread  EMT(idCpu)
    502535 */
    503 VMMR0_INT_DECL(int) NEMR0MapPages(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     536VMMR0_INT_DECL(int) NEMR0MapPages(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    504537{
    505538    /*
     
    509542    if (RT_SUCCESS(rc))
    510543    {
    511         PVMCPU  pVCpu  = &pVM->aCpus[idCpu];
     544        PVMCPUCC  pVCpu  = VMCC_GET_CPU(pVM, idCpu);
    512545        PGVMCPU pGVCpu = &pGVM->aCpus[idCpu];
    513546
     
    581614 * @thread  EMT(idCpu)
    582615 */
    583 VMMR0_INT_DECL(int) NEMR0UnmapPages(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     616VMMR0_INT_DECL(int) NEMR0UnmapPages(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    584617{
    585618    /*
     
    589622    if (RT_SUCCESS(rc))
    590623    {
    591         PVMCPU  pVCpu  = &pVM->aCpus[idCpu];
     624        PVMCPUCC  pVCpu  = VMCC_GET_CPU(pVM, idCpu);
    592625        PGVMCPU pGVCpu = &pGVM->aCpus[idCpu];
    593626
     
    617650NEM_TMPL_STATIC int nemR0WinExportState(PGVM pGVM, PGVMCPU pGVCpu, PCPUMCTX pCtx)
    618651{
    619     PVMCPU                     pVCpu  = &pGVM->pVM->aCpus[pGVCpu->idCpu];
     652#ifdef VBOX_BUGREF_9217
     653    PVMCPUCC                   pVCpu  = pGVCpu;
     654#else
     655    PVMCPUCC                   pVCpu  = &pGVM->pVM->aCpus[pGVCpu->idCpu];
     656#endif
    620657    HV_INPUT_SET_VP_REGISTERS *pInput = (HV_INPUT_SET_VP_REGISTERS *)pGVCpu->nemr0.s.HypercallData.pbPage;
    621658    AssertPtrReturn(pInput, VERR_INTERNAL_ERROR_3);
     
    12951332 *                      hypercall page and arguments.
    12961333 */
    1297 VMMR0_INT_DECL(int)  NEMR0ExportState(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     1334VMMR0_INT_DECL(int)  NEMR0ExportState(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    12981335{
    12991336#if defined(NEM_WIN_WITH_RING0_RUNLOOP) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS)
     
    13041341    if (RT_SUCCESS(rc))
    13051342    {
    1306         PVMCPU  pVCpu  = &pVM->aCpus[idCpu];
     1343        PVMCPUCC  pVCpu  = VMCC_GET_CPU(pVM, idCpu);
    13071344        PGVMCPU pGVCpu = &pGVM->aCpus[idCpu];
    13081345        AssertReturn(g_pfnHvlInvokeHypercall, VERR_NEM_MISSING_KERNEL_API);
     
    13391376    AssertPtrReturn(pInput, VERR_INTERNAL_ERROR_3);
    13401377    AssertReturn(g_pfnHvlInvokeHypercall, VERR_NEM_MISSING_KERNEL_API);
     1378#ifdef VBOX_BUGREF_9217
     1379    Assert(pCtx == &pGVCpu->cpum.GstCtx);
     1380#else
    13411381    Assert(pCtx == &pGVCpu->pVCpu->cpum.GstCtx);
     1382#endif
    13421383
    13431384    fWhat &= pCtx->fExtrn;
     
    15071548
    15081549# ifdef LOG_ENABLED
     1550#  ifdef VBOX_BUGREF_9217
     1551    const CPUMCPUVENDOR enmCpuVendor = CPUMGetHostCpuVendor(pGVM);
     1552#  else
    15091553    const CPUMCPUVENDOR enmCpuVendor = CPUMGetHostCpuVendor(pGVM->pVM);
     1554#  endif
    15101555# endif
    15111556    if (fWhat & CPUMCTX_EXTRN_OTHER_MSRS)
     
    15711616     * Copy information to the CPUM context.
    15721617     */
    1573     PVMCPU pVCpu = &pGVM->pVM->aCpus[pGVCpu->idCpu];
     1618# ifdef VBOX_BUGREF_9217
     1619    PVMCPUCC pVCpu = pGVCpu;
     1620# else
     1621    PVMCPUCC pVCpu = &pGVM->pVM->aCpus[pGVCpu->idCpu];
     1622# endif
    15741623    iReg = 0;
    15751624
     
    22152264 *                      CPUMCTX_EXTERN_ALL for everything.
    22162265 */
    2217 VMMR0_INT_DECL(int) NEMR0ImportState(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint64_t fWhat)
     2266VMMR0_INT_DECL(int) NEMR0ImportState(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, uint64_t fWhat)
    22182267{
    22192268#if defined(NEM_WIN_WITH_RING0_RUNLOOP) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS)
     
    22242273    if (RT_SUCCESS(rc))
    22252274    {
    2226         PVMCPU  pVCpu  = &pVM->aCpus[idCpu];
     2275        PVMCPUCC  pVCpu  = VMCC_GET_CPU(pVM, idCpu);
    22272276        PGVMCPU pGVCpu = &pGVM->aCpus[idCpu];
    22282277        AssertReturn(g_pfnHvlInvokeHypercall, VERR_NEM_MISSING_KERNEL_API);
     
    22992348 *                      hypercall page and arguments.
    23002349 */
    2301 VMMR0_INT_DECL(int) NEMR0QueryCpuTick(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     2350VMMR0_INT_DECL(int) NEMR0QueryCpuTick(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    23022351{
    23032352#if defined(NEM_WIN_WITH_RING0_RUNLOOP) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS)
     
    23082357    if (RT_SUCCESS(rc))
    23092358    {
    2310         PVMCPU  pVCpu  = &pVM->aCpus[idCpu];
     2359        PVMCPUCC  pVCpu  = VMCC_GET_CPU(pVM, idCpu);
    23112360        PGVMCPU pGVCpu = &pGVM->aCpus[idCpu];
    23122361        AssertReturn(g_pfnHvlInvokeHypercall, VERR_NEM_MISSING_KERNEL_API);
     
    24092458 * @param   uPausedTscValue The TSC value at the time of pausing.
    24102459 */
    2411 VMMR0_INT_DECL(int) NEMR0ResumeCpuTickOnAll(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint64_t uPausedTscValue)
     2460VMMR0_INT_DECL(int) NEMR0ResumeCpuTickOnAll(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, uint64_t uPausedTscValue)
    24122461{
    24132462#if defined(NEM_WIN_WITH_RING0_RUNLOOP) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS)
     
    24182467    if (RT_SUCCESS(rc))
    24192468    {
    2420         PVMCPU  pVCpu  = &pVM->aCpus[idCpu];
     2469        PVMCPUCC  pVCpu  = VMCC_GET_CPU(pVM, idCpu);
    24212470        PGVMCPU pGVCpu = &pGVM->aCpus[idCpu];
    24222471        AssertReturn(g_pfnHvlInvokeHypercall, VERR_NEM_MISSING_KERNEL_API);
     
    24412490#ifdef NEM_WIN_WITH_RING0_RUNLOOP
    24422491    if (pGVM->nemr0.s.fMayUseRing0Runloop)
    2443     {
    2444         PVM pVM = pGVM->pVM;
     2492# ifdef VBOX_BUGREF_9217
     2493        return nemHCWinRunGC(pGVM, &pGVM->aCpus[idCpu], pGVM, &pGVM->aCpus[idCpu]);
     2494# else
     2495    {
     2496        PVMCC pVM = pGVM->pVM;
    24452497        return nemHCWinRunGC(pVM, &pVM->aCpus[idCpu], pGVM, &pGVM->aCpus[idCpu]);
    24462498    }
     2499# endif
    24472500    return VERR_NEM_RING3_ONLY;
    24482501#else
     
    24622515 *                      page and arguments.
    24632516 */
    2464 VMMR0_INT_DECL(int)  NEMR0UpdateStatistics(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     2517VMMR0_INT_DECL(int)  NEMR0UpdateStatistics(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    24652518{
    24662519    /*
     
    25352588 * @param   u64Arg      What to query.  0 == registers.
    25362589 */
    2537 VMMR0_INT_DECL(int) NEMR0DoExperiment(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint64_t u64Arg)
     2590VMMR0_INT_DECL(int) NEMR0DoExperiment(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, uint64_t u64Arg)
    25382591{
    25392592    /*
     
    25462599
    25472600        PGVMCPU pGVCpu = &pGVM->aCpus[idCpu];
    2548         PVMCPU  pVCpu  = &pVM->aCpus[idCpu];
     2601        PVMCPUCC  pVCpu  = VMCC_GET_CPU(pVM, idCpu);
    25492602        if (u64Arg == 0)
    25502603        {
  • trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp

    r80074 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_PDM_DEVICE
    2324#define PDMPCIDEV_INCLUDE_PRIVATE  /* Hack to get pdmpcidevint.h included at the right point. */
     
    2627#include <VBox/vmm/pgm.h>
    2728#include <VBox/vmm/mm.h>
    28 #include <VBox/vmm/vm.h>
     29#include <VBox/vmm/vmcc.h>
    2930#include <VBox/vmm/gvm.h>
    3031#include <VBox/vmm/vmm.h>
     
    6061*   Internal Functions                                                                                                           *
    6162*********************************************************************************************************************************/
    62 static bool pdmR0IsaSetIrq(PVM pVM, int iIrq, int iLevel, uint32_t uTagSrc);
     63static bool pdmR0IsaSetIrq(PVMCC pVM, int iIrq, int iLevel, uint32_t uTagSrc);
    6364
    6465
     
    132133    LogFlow(("pdmR0DevHlp_PCISetIrq: caller=%p/%d: pPciDev=%p:{%#x} iIrq=%d iLevel=%d\n",
    133134             pDevIns, pDevIns->iInstance, pPciDev, pPciDev->uDevFn, iIrq, iLevel));
    134     PVM          pVM     = pDevIns->Internal.s.pVMR0;
     135    PVMCC        pVM     = pDevIns->Internal.s.pVMR0;
    135136    PPDMPCIBUS   pPciBus = pPciDev->Int.s.pPdmBusR0;
    136137
     
    185186    PDMDEV_ASSERT_DEVINS(pDevIns);
    186187    LogFlow(("pdmR0DevHlp_ISASetIrq: caller=%p/%d: iIrq=%d iLevel=%d\n", pDevIns, pDevIns->iInstance, iIrq, iLevel));
    187     PVM pVM = pDevIns->Internal.s.pVMR0;
     188    PVMCC pVM = pDevIns->Internal.s.pVMR0;
    188189
    189190    pdmLock(pVM);
     
    214215    PDMDEV_ASSERT_DEVINS(pDevIns);
    215216    LogFlow(("pdmR0DevHlp_IoApicSendMsi: caller=%p/%d: GCPhys=%RGp uValue=%#x\n", pDevIns, pDevIns->iInstance, GCPhys, uValue));
    216     PVM pVM = pDevIns->Internal.s.pVMR0;
     217    PVMCC pVM = pDevIns->Internal.s.pVMR0;
    217218
    218219    uint32_t uTagSrc;
     
    341342
    342343/** @interface_method_impl{PDMDEVHLPR0,pfnGetVM} */
    343 static DECLCALLBACK(PVM)  pdmR0DevHlp_GetVM(PPDMDEVINS pDevIns)
     344static DECLCALLBACK(PVMCC)  pdmR0DevHlp_GetVM(PPDMDEVINS pDevIns)
    344345{
    345346    PDMDEV_ASSERT_DEVINS(pDevIns);
     
    350351
    351352/** @interface_method_impl{PDMDEVHLPR0,pfnGetVMCPU} */
    352 static DECLCALLBACK(PVMCPU) pdmR0DevHlp_GetVMCPU(PPDMDEVINS pDevIns)
     353static DECLCALLBACK(PVMCPUCC) pdmR0DevHlp_GetVMCPU(PPDMDEVINS pDevIns)
    353354{
    354355    PDMDEV_ASSERT_DEVINS(pDevIns);
     
    460461#ifdef VBOX_BUGREF_9217
    461462    PGVM   pGVM  = (PGVM)pDevIns->Internal.s.pVMR0;
    462     PVMCPU pVCpu = &pGVM->aCpus[0];     /* for PIC we always deliver to CPU 0, MP use APIC */
     463    PVMCPUCC pVCpu = &pGVM->aCpus[0];     /* for PIC we always deliver to CPU 0, MP use APIC */
    463464#else
    464     PVM    pVM   = pDevIns->Internal.s.pVMR0;
    465     PVMCPU pVCpu = &pVM->aCpus[0];      /* for PIC we always deliver to CPU 0, MP use APIC */
     465    PVMCC    pVM   = pDevIns->Internal.s.pVMR0;
     466    PVMCPUCC pVCpu = VMCC_GET_CPU_0(pVM); /* for PIC we always deliver to CPU 0, MP use APIC */
    466467#endif
    467468    /** @todo r=ramshankar: Propagating rcRZ and make all callers handle it? */
     
    476477#ifdef VBOX_BUGREF_9217
    477478    PGVM   pGVM  = (PGVM)pDevIns->Internal.s.pVMR0;
    478     PVMCPU pVCpu = &pGVM->aCpus[0];     /* for PIC we always deliver to CPU 0, MP use APIC */
     479    PVMCPUCC pVCpu = &pGVM->aCpus[0];     /* for PIC we always deliver to CPU 0, MP use APIC */
    479480#else
    480     PVM    pVM   = pDevIns->Internal.s.pVMR0;
    481     PVMCPU pVCpu = &pVM->aCpus[0];      /* for PIC we always deliver to CPU 0, MP use APIC */
     481    PVMCC    pVM   = pDevIns->Internal.s.pVMR0;
     482    PVMCPUCC pVCpu = VMCC_GET_CPU_0(pVM); /* for PIC we always deliver to CPU 0, MP use APIC */
    482483#endif
    483484    /** @todo r=ramshankar: Propagating rcRZ and make all callers handle it? */
     
    528529{
    529530    PDMDEV_ASSERT_DEVINS(pDevIns);
    530     PVM pVM = pDevIns->Internal.s.pVMR0;
     531    PVMCC pVM = pDevIns->Internal.s.pVMR0;
    531532    LogFlow(("pdmR0IoApicHlp_ApicBusDeliver: caller=%p/%d: u8Dest=%RX8 u8DestMode=%RX8 u8DeliveryMode=%RX8 uVector=%RX8 u8Polarity=%RX8 u8TriggerMode=%RX8 uTagSrc=%#x\n",
    532533             pDevIns, pDevIns->iInstance, u8Dest, u8DestMode, u8DeliveryMode, uVector, u8Polarity, u8TriggerMode, uTagSrc));
     
    577578    PDMDEV_ASSERT_DEVINS(pDevIns);
    578579    Log4(("pdmR0PciHlp_IsaSetIrq: iIrq=%d iLevel=%d uTagSrc=%#x\n", iIrq, iLevel, uTagSrc));
    579     PVM pVM = pDevIns->Internal.s.pVMR0;
     580    PVMCC pVM = pDevIns->Internal.s.pVMR0;
    580581
    581582    pdmLock(pVM);
     
    590591    PDMDEV_ASSERT_DEVINS(pDevIns);
    591592    Log4(("pdmR0PciHlp_IoApicSetIrq: iIrq=%d iLevel=%d uTagSrc=%#x\n", iIrq, iLevel, uTagSrc));
    592     PVM pVM = pDevIns->Internal.s.pVMR0;
     593    PVMCC pVM = pDevIns->Internal.s.pVMR0;
    593594
    594595    if (pVM->pdm.s.IoApic.pDevInsR0)
     
    619620    PDMDEV_ASSERT_DEVINS(pDevIns);
    620621    Log4(("pdmR0PciHlp_IoApicSendMsi: GCPhys=%p uValue=%d uTagSrc=%#x\n", GCPhys, uValue, uTagSrc));
    621     PVM pVM = pDevIns->Internal.s.pVMR0;
     622    PVMCC pVM = pDevIns->Internal.s.pVMR0;
    622623    if (pVM->pdm.s.IoApic.pDevInsR0)
    623624        pVM->pdm.s.IoApic.pfnSendMsiR0(pVM->pdm.s.IoApic.pDevInsR0, GCPhys, uValue, uTagSrc);
     
    801802 * @remarks The caller holds the PDM lock.
    802803 */
    803 static bool pdmR0IsaSetIrq(PVM pVM, int iIrq, int iLevel, uint32_t uTagSrc)
     804static bool pdmR0IsaSetIrq(PVMCC pVM, int iIrq, int iLevel, uint32_t uTagSrc)
    804805{
    805806    if (RT_LIKELY(    (   pVM->pdm.s.IoApic.pDevInsR0
     
    838839 * @param   pReq    Pointer to the request buffer.
    839840 */
    840 VMMR0_INT_DECL(int) PDMR0DeviceCallReqHandler(PGVM pGVM, PVM pVM, PPDMDEVICECALLREQHANDLERREQ pReq)
     841VMMR0_INT_DECL(int) PDMR0DeviceCallReqHandler(PGVM pGVM, PVMCC pVM, PPDMDEVICECALLREQHANDLERREQ pReq)
    841842{
    842843    /*
  • trunk/src/VBox/VMM/VMMR0/PDMR0Driver.cpp

    r76553 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_PDM_DRIVER
    2324#include "PDMInternal.h"
    2425#include <VBox/vmm/pdm.h>
    25 #include <VBox/vmm/vm.h>
     26#include <VBox/vmm/vmcc.h>
    2627#include <VBox/vmm/gvmm.h>
    2728
     
    4041 * @param   pReq    Pointer to the request buffer.
    4142 */
    42 VMMR0_INT_DECL(int) PDMR0DriverCallReqHandler(PGVM pGVM, PVM pVM, PPDMDRIVERCALLREQHANDLERREQ pReq)
     43VMMR0_INT_DECL(int) PDMR0DriverCallReqHandler(PGVM pGVM, PVMCC pVM, PPDMDRIVERCALLREQHANDLERREQ pReq)
    4344{
    4445    /*
  • trunk/src/VBox/VMM/VMMR0/PGMR0.cpp

    r78431 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_PGM
    2324#include <VBox/rawpci.h>
     
    2526#include <VBox/vmm/gmm.h>
    2627#include "PGMInternal.h"
    27 #include <VBox/vmm/vm.h>
     28#include <VBox/vmm/vmcc.h>
    2829#include <VBox/vmm/gvm.h>
    2930#include "PGMInline.h"
     
    7172 *          must clear the new pages.
    7273 */
    73 VMMR0_INT_DECL(int) PGMR0PhysAllocateHandyPages(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     74VMMR0_INT_DECL(int) PGMR0PhysAllocateHandyPages(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    7475{
    7576    /*
     
    8182    PGM_LOCK_ASSERT_OWNER_EX(pVM, &pGVM->aCpus[idCpu]);
    8283#else
    83     PGM_LOCK_ASSERT_OWNER_EX(pVM, &pVM->aCpus[idCpu]);
     84    PGM_LOCK_ASSERT_OWNER_EX(pVM, VMCC_GET_CPU(pVM, idCpu));
    8485#endif
    8586
     
    198199 * @remarks Must be called from within the PGM critical section.
    199200 */
    200 VMMR0_INT_DECL(int) PGMR0PhysFlushHandyPages(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     201VMMR0_INT_DECL(int) PGMR0PhysFlushHandyPages(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    201202{
    202203    /*
     
    208209    PGM_LOCK_ASSERT_OWNER_EX(pVM, &pGVM->aCpus[idCpu]);
    209210#else
    210     PGM_LOCK_ASSERT_OWNER_EX(pVM, &pVM->aCpus[idCpu]);
     211    PGM_LOCK_ASSERT_OWNER_EX(pVM, VMCC_GET_CPU(pVM, idCpu));
    211212#endif
    212213
     
    242243 *          must clear the new pages.
    243244 */
    244 VMMR0_INT_DECL(int) PGMR0PhysAllocateLargeHandyPage(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     245VMMR0_INT_DECL(int) PGMR0PhysAllocateLargeHandyPage(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    245246{
    246247    /*
     
    252253    PGM_LOCK_ASSERT_OWNER_EX(pVM, &pGVM->aCpus[idCpu]);
    253254#else
    254     PGM_LOCK_ASSERT_OWNER_EX(pVM, &pVM->aCpus[idCpu]);
     255    PGM_LOCK_ASSERT_OWNER_EX(pVM, VMCC_GET_CPU(pVM, idCpu));
    255256#endif
    256257    Assert(!pVM->pgm.s.cLargeHandyPages);
     
    397398 * @param   pVM                 The cross context VM structure.
    398399 */
    399 VMMR0_INT_DECL(int) PGMR0PhysSetupIoMmu(PGVM pGVM, PVM pVM)
     400VMMR0_INT_DECL(int) PGMR0PhysSetupIoMmu(PGVM pGVM, PVMCC pVM)
    400401{
    401402    int rc = GVMMR0ValidateGVMandVM(pGVM, pVM);
     
    459460 * @param   GCPhysFault         The fault address.
    460461 */
    461 VMMR0DECL(int) PGMR0Trap0eHandlerNestedPaging(PVM pVM, PVMCPU pVCpu, PGMMODE enmShwPagingMode, RTGCUINT uErr,
     462VMMR0DECL(int) PGMR0Trap0eHandlerNestedPaging(PVMCC pVM, PVMCPUCC pVCpu, PGMMODE enmShwPagingMode, RTGCUINT uErr,
    462463                                              PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault)
    463464{
     
    588589 *                              (VT-x).
    589590 */
    590 VMMR0DECL(VBOXSTRICTRC) PGMR0Trap0eHandlerNPMisconfig(PVM pVM, PVMCPU pVCpu, PGMMODE enmShwPagingMode,
     591VMMR0DECL(VBOXSTRICTRC) PGMR0Trap0eHandlerNPMisconfig(PVMCC pVM, PVMCPUCC pVCpu, PGMMODE enmShwPagingMode,
    591592                                                      PCPUMCTXCORE pRegFrame, RTGCPHYS GCPhysFault, uint32_t uErr)
    592593{
  • trunk/src/VBox/VMM/VMMR0/PGMR0Bth.h

    r76553 r80274  
    2121*******************************************************************************/
    2222RT_C_DECLS_BEGIN
    23 PGM_BTH_DECL(int, Trap0eHandler)(PVMCPU pVCpu, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, bool *pfLockTaken);
     23PGM_BTH_DECL(int, Trap0eHandler)(PVMCPUCC pVCpu, RTGCUINT uErr, PCPUMCTXCORE pRegFrame, RTGCPTR pvFault, bool *pfLockTaken);
    2424RT_C_DECLS_END
    2525
  • trunk/src/VBox/VMM/VMMR0/PGMR0SharedPage.cpp

    r78431 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_PGM_SHARED
    2324#include <VBox/vmm/pgm.h>
    2425#include <VBox/vmm/gmm.h>
    2526#include "PGMInternal.h"
    26 #include <VBox/vmm/vm.h>
     27#include <VBox/vmm/vmcc.h>
    2728#include <VBox/vmm/gvm.h>
    2829#include "PGMInline.h"
     
    4950 *                              process.
    5051 */
    51 VMMR0DECL(int) PGMR0SharedModuleCheck(PVM pVM, PGVM pGVM, VMCPUID idCpu, PGMMSHAREDMODULE pModule, PCRTGCPTR64 paRegionsGCPtrs)
     52VMMR0DECL(int) PGMR0SharedModuleCheck(PVMCC pVM, PGVM pGVM, VMCPUID idCpu, PGMMSHAREDMODULE pModule, PCRTGCPTR64 paRegionsGCPtrs)
    5253{
    5354#ifdef VBOX_BUGREF_9217
    54     PVMCPU              pVCpu         = &pGVM->aCpus[idCpu];
     55    PVMCPUCC              pVCpu         = &pGVM->aCpus[idCpu];
    5556#else
    56     PVMCPU              pVCpu         = &pVM->aCpus[idCpu];
     57    PVMCPUCC              pVCpu         = VMCC_GET_CPU(pVM, idCpu);
    5758#endif
    5859    int                 rc            = VINF_SUCCESS;
     
    172173#else
    173174        for (VMCPUID idCurCpu = 0; idCurCpu < pVM->cCpus; idCurCpu++)
    174             CPUMSetChangedFlags(&pVM->aCpus[idCurCpu], CPUM_CHANGED_GLOBAL_TLB_FLUSH);
     175            CPUMSetChangedFlags(VMCC_GET_CPU(pVM, idCurCpu), CPUM_CHANGED_GLOBAL_TLB_FLUSH);
    175176#endif
    176177
  • trunk/src/VBox/VMM/VMMR0/TRPMR0.cpp

    r80015 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_TRPM
    2324#include <VBox/vmm/trpm.h>
    2425#include "TRPMInternal.h"
    25 #include <VBox/vmm/vm.h>
     26#include <VBox/vmm/vmcc.h>
    2627#include <VBox/vmm/vmm.h>
    2728#include <iprt/errcore.h>
     
    4243 * @remark  Must be called with interrupts disabled.
    4344 */
    44 VMMR0DECL(void) TRPMR0DispatchHostInterrupt(PVM pVM)
     45VMMR0DECL(void) TRPMR0DispatchHostInterrupt(PVMCC pVM)
    4546{
    4647    /*
    4748     * Get the active interrupt vector number.
    4849     */
    49     PVMCPU pVCpu = VMMGetCpu0(pVM);
     50    PVMCPUCC pVCpu = VMMGetCpu0(pVM);
    5051    RTUINT uActiveVector = pVCpu->trpm.s.uActiveVector;
    5152    pVCpu->trpm.s.uActiveVector = UINT32_MAX;
  • trunk/src/VBox/VMM/VMMR0/VMMR0.cpp

    r80052 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_VMM
    2324#include <VBox/vmm/vmm.h>
     
    3435#include <VBox/vmm/tm.h>
    3536#include "VMMInternal.h"
    36 #include <VBox/vmm/vm.h>
     37#include <VBox/vmm/vmcc.h>
    3738#include <VBox/vmm/gvm.h>
    3839#ifdef VBOX_WITH_PCI_PASSTHROUGH
     
    366367 * @thread  EMT(0)
    367368 */
    368 static int vmmR0InitVM(PGVM pGVM, PVM pVM, uint32_t uSvnRev, uint32_t uBuildType)
     369static int vmmR0InitVM(PGVM pGVM, PVMCC pVM, uint32_t uSvnRev, uint32_t uBuildType)
    369370{
    370371    VMM_CHECK_SMAP_SETUP();
     
    396397     */
    397398#ifdef VBOX_BUGREF_9217
    398     PVMCPU pVCpu = &pGVM->aCpus[0];
     399    PVMCPUCC pVCpu = &pGVM->aCpus[0];
    399400#else
    400     PVMCPU pVCpu = &pVM->aCpus[0];
     401    PVMCPUCC pVCpu = VMCC_GET_CPU_0(pVM);
    401402#endif
    402403
     
    534535 * @param   idCpu       The EMT that's calling.
    535536 */
    536 static int vmmR0InitVMEmt(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     537static int vmmR0InitVMEmt(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    537538{
    538539    /* Paranoia (caller checked these already). */
     
    545546     */
    546547#ifdef VBOX_BUGREF_9217
    547     PVMCPU       pVCpu     = &pGVM->aCpus[idCpu];
     548    PVMCPUCC       pVCpu     = &pGVM->aCpus[idCpu];
    548549#else
    549     PVMCPU       pVCpu     = &pVM->aCpus[idCpu];
     550    PVMCPUCC       pVCpu     = VMCC_GET_CPU(pVM, idCpu);
    550551#endif
    551552    PVMMR0LOGGER pR0Logger = pVCpu->vmm.s.pR0LoggerR0;
     
    579580 * @thread  EMT(0) or session clean up thread.
    580581 */
    581 VMMR0_INT_DECL(int) VMMR0TermVM(PGVM pGVM, PVM pVM, VMCPUID idCpu)
     582VMMR0_INT_DECL(int) VMMR0TermVM(PGVM pGVM, PVMCC pVM, VMCPUID idCpu)
    582583{
    583584    /*
     
    627628 * @param   enmInterruptibility     Guest CPU interruptbility level.
    628629 */
    629 static int vmmR0DoHaltInterrupt(PVMCPU pVCpu, unsigned uMWait, CPUMINTERRUPTIBILITY enmInterruptibility)
     630static int vmmR0DoHaltInterrupt(PVMCPUCC pVCpu, unsigned uMWait, CPUMINTERRUPTIBILITY enmInterruptibility)
    630631{
    631632    Assert(!TRPMHasTrap(pVCpu));
     
    727728 *       parameters and statistics.
    728729 */
    729 static int vmmR0DoHalt(PGVM pGVM, PVM pVM, PGVMCPU pGVCpu, PVMCPU pVCpu)
     730static int vmmR0DoHalt(PGVM pGVM, PVMCC pVM, PGVMCPU pGVCpu, PVMCPUCC pVCpu)
    730731{
    731732#ifdef VBOX_BUGREF_9217
     
    908909static DECLCALLBACK(void) vmmR0ThreadCtxCallback(RTTHREADCTXEVENT enmEvent, void *pvUser)
    909910{
    910     PVMCPU pVCpu = (PVMCPU)pvUser;
     911    PVMCPUCC pVCpu = (PVMCPUCC)pvUser;
    911912
    912913    switch (enmEvent)
     
    980981 * @thread  EMT(pVCpu)
    981982 */
    982 VMMR0_INT_DECL(int) VMMR0ThreadCtxHookCreateForEmt(PVMCPU pVCpu)
     983VMMR0_INT_DECL(int) VMMR0ThreadCtxHookCreateForEmt(PVMCPUCC pVCpu)
    983984{
    984985    VMCPU_ASSERT_EMT(pVCpu);
     
    10091010 * @remarks Can be called from any thread.
    10101011 */
    1011 VMMR0_INT_DECL(void) VMMR0ThreadCtxHookDestroyForEmt(PVMCPU pVCpu)
     1012VMMR0_INT_DECL(void) VMMR0ThreadCtxHookDestroyForEmt(PVMCPUCC pVCpu)
    10121013{
    10131014    int rc = RTThreadCtxHookDestroy(pVCpu->vmm.s.hCtxHook);
     
    10261027 *          this call.  This means you have to be careful with what you do!
    10271028 */
    1028 VMMR0_INT_DECL(void) VMMR0ThreadCtxHookDisable(PVMCPU pVCpu)
     1029VMMR0_INT_DECL(void) VMMR0ThreadCtxHookDisable(PVMCPUCC pVCpu)
    10291030{
    10301031    /*
     
    10631064 * @param   pVCpu       The cross context virtual CPU structure.
    10641065 */
    1065 DECLINLINE(bool) vmmR0ThreadCtxHookIsEnabled(PVMCPU pVCpu)
     1066DECLINLINE(bool) vmmR0ThreadCtxHookIsEnabled(PVMCPUCC pVCpu)
    10661067{
    10671068    return RTThreadCtxHookIsEnabled(pVCpu->vmm.s.hCtxHook);
     
    10751076 * @param   pVCpu       The cross context virtual CPU structure.
    10761077 */
    1077 VMMR0_INT_DECL(bool) VMMR0ThreadCtxHookIsEnabled(PVMCPU pVCpu)
     1078VMMR0_INT_DECL(bool) VMMR0ThreadCtxHookIsEnabled(PVMCPUCC pVCpu)
    10781079{
    10791080    return vmmR0ThreadCtxHookIsEnabled(pVCpu);
     
    10881089 * @param   rc          The status code.
    10891090 */
    1090 static void vmmR0RecordRC(PVM pVM, PVMCPU pVCpu, int rc)
     1091static void vmmR0RecordRC(PVMCC pVM, PVMCPUCC pVCpu, int rc)
    10911092{
    10921093    /*
     
    12951296 * @remarks Assume called with interrupts _enabled_.
    12961297 */
    1297 VMMR0DECL(void) VMMR0EntryFast(PGVM pGVM, PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation)
     1298VMMR0DECL(void) VMMR0EntryFast(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation)
    12981299{
    12991300    /*
     
    13111312    PGVMCPU pGVCpu = &pGVM->aCpus[idCpu];
    13121313#ifdef VBOX_BUGREF_9217
    1313     PVMCPU  pVCpu  = pGVCpu;
     1314    PVMCPUCC  pVCpu  = pGVCpu;
    13141315#else
    1315     PVMCPU  pVCpu  = &pVM->aCpus[idCpu];
     1316    PVMCPUCC  pVCpu  = VMCC_GET_CPU(pVM, idCpu);
    13161317#endif
    13171318    RTNATIVETHREAD const hNativeThread = RTThreadNativeSelf();
     
    15811582 * @param   pSession        The session argument.
    15821583 */
    1583 DECLINLINE(bool) vmmR0IsValidSession(PVM pVM, PSUPDRVSESSION pClaimedSession, PSUPDRVSESSION pSession)
     1584DECLINLINE(bool) vmmR0IsValidSession(PVMCC pVM, PSUPDRVSESSION pClaimedSession, PSUPDRVSESSION pSession)
    15841585{
    15851586    /* This must be set! */
     
    16131614 * @remarks Assume called with interrupts _enabled_.
    16141615 */
    1615 static int vmmR0EntryExWorker(PGVM pGVM, PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation,
     1616static int vmmR0EntryExWorker(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation,
    16161617                              PSUPVMMR0REQHDR pReqHdr, uint64_t u64Arg, PSUPDRVSESSION pSession)
    16171618{
     
    16561657        }
    16571658
     1659#ifdef VBOX_BUGREF_9217
     1660        if (RT_LIKELY(   pVM->enmVMState >= VMSTATE_CREATING
     1661                      && pVM->enmVMState <= VMSTATE_TERMINATED
     1662                      && pVM->cCpus      == pGVM->cCpus
     1663                      && pVM->pSession   == pSession
     1664                      && pVM->pSelf      == pVM))
     1665#else
    16581666        if (RT_LIKELY(   pVM->enmVMState >= VMSTATE_CREATING
    16591667                      && pVM->enmVMState <= VMSTATE_TERMINATED
     
    16611669                      && pVM->pSession   == pSession
    16621670                      && pVM->pVMR0      == pVM))
     1671#endif
    16631672        { /* likely */ }
    16641673        else
    16651674        {
     1675#ifdef VBOX_BUGREF_9217
     1676            SUPR0Printf("vmmR0EntryExWorker: Invalid pVM=%p:{.enmVMState=%d, .cCpus=%#x(==%#x), .pSession=%p(==%p), .pSelf=%p(==%p)}! (op=%d)\n",
     1677                        pVM, pVM->enmVMState, pVM->cCpus, pGVM->cCpus, pVM->pSession, pSession, pVM->pSelf, pVM, enmOperation);
     1678#else
    16661679            SUPR0Printf("vmmR0EntryExWorker: Invalid pVM=%p:{.enmVMState=%d, .cCpus=%#x(==%#x), .pSession=%p(==%p), .pVMR0=%p(==%p)}! (op=%d)\n",
    16671680                        pVM, pVM->enmVMState, pVM->cCpus, pGVM->cCpus, pVM->pSession, pSession, pVM->pVMR0, pVM, enmOperation);
     1681#endif
    16681682            return VERR_INVALID_POINTER;
    16691683        }
     
    22282242{
    22292243    PGVM                pGVM;
    2230     PVM                 pVM;
     2244    PVMCC               pVM;
    22312245    VMCPUID             idCpu;
    22322246    VMMR0OPERATION      enmOperation;
     
    22702284 * @remarks Assume called with interrupts _enabled_.
    22712285 */
    2272 VMMR0DECL(int) VMMR0EntryEx(PGVM pGVM, PVM pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation,
     2286VMMR0DECL(int) VMMR0EntryEx(PGVM pGVM, PVMCC pVM, VMCPUID idCpu, VMMR0OPERATION enmOperation,
    22732287                            PSUPVMMR0REQHDR pReq, uint64_t u64Arg, PSUPDRVSESSION pSession)
    22742288{
     
    22802294        && pGVM != NULL
    22812295        && idCpu < pGVM->cCpus
    2282         && pVM->pVMR0 != NULL)
     2296        && pVM->pSession == pSession
     2297#ifdef VBOX_BUGREF_9217
     2298        && pVM->pSelf != NULL
     2299#else
     2300        && pVM->pVMR0 != NULL
     2301#endif
     2302       )
    22832303    {
    22842304        switch (enmOperation)
     
    22962316                PGVMCPU pGVCpu = &pGVM->aCpus[idCpu];
    22972317#ifdef VBOX_BUGREF_9217
    2298                 PVMCPU  pVCpu  = pGVCpu;
     2318                PVMCPUCC  pVCpu  = pGVCpu;
    22992319#else
    2300                 PVMCPU  pVCpu  = &pVM->aCpus[idCpu];
     2320                PVMCPUCC  pVCpu  = VMCC_GET_CPU(pVM, idCpu);
    23012321#endif
    23022322                RTNATIVETHREAD hNativeThread = RTThreadNativeSelf();
     
    23372357 * @sa      VMMIsLongJumpArmed
    23382358 */
    2339 VMMR0_INT_DECL(bool) VMMR0IsLongJumpArmed(PVMCPU pVCpu)
     2359VMMR0_INT_DECL(bool) VMMR0IsLongJumpArmed(PVMCPUCC pVCpu)
    23402360{
    23412361#ifdef RT_ARCH_X86
     
    23562376 * @thread  EMT
    23572377 */
    2358 VMMR0_INT_DECL(bool) VMMR0IsInRing3LongJump(PVMCPU pVCpu)
     2378VMMR0_INT_DECL(bool) VMMR0IsInRing3LongJump(PVMCPUCC pVCpu)
    23592379{
    23602380    return pVCpu->vmm.s.CallRing3JmpBufR0.fInRing3Call;
     
    23882408        return; /* quietly */
    23892409
    2390     PVM pVM = pR0Logger->pVM;
     2410    PVMCC pVM = pR0Logger->pVM;
    23912411    if (    !VALID_PTR(pVM)
    2392         ||  pVM->pVMR0 != pVM)
     2412# ifdef VBOX_BUGREF_9217
     2413        ||  pVM->pSelf != pVM
     2414# else
     2415        ||  pVM->pVMR0 != pVM
     2416# endif
     2417       )
    23932418    {
    23942419# ifdef DEBUG
     2420#  ifdef VBOX_BUGREF_9217
     2421        SUPR0Printf("vmmR0LoggerFlush: pVM=%p! pSelf=%p! pLogger=%p\n", pVM, pVM->pSelf, pLogger);
     2422#  else
    23952423        SUPR0Printf("vmmR0LoggerFlush: pVM=%p! pVMR0=%p! pLogger=%p\n", pVM, pVM->pVMR0, pLogger);
     2424#  endif
    23962425# endif
    23972426        return;
    23982427    }
    23992428
    2400     PVMCPU pVCpu = VMMGetCpu(pVM);
     2429    PVMCPUCC pVCpu = VMMGetCpu(pVM);
    24012430    if (pVCpu)
    24022431    {
     
    24352464 * @param   pVCpu       The cross context virtual CPU structure.
    24362465 */
    2437 VMMR0_INT_DECL(void) VMMR0LogFlushDisable(PVMCPU pVCpu)
     2466VMMR0_INT_DECL(void) VMMR0LogFlushDisable(PVMCPUCC pVCpu)
    24382467{
    24392468    if (pVCpu->vmm.s.pR0LoggerR0)
     
    24492478 * @param   pVCpu       The cross context virtual CPU structure.
    24502479 */
    2451 VMMR0_INT_DECL(void) VMMR0LogFlushEnable(PVMCPU pVCpu)
     2480VMMR0_INT_DECL(void) VMMR0LogFlushEnable(PVMCPUCC pVCpu)
    24522481{
    24532482    if (pVCpu->vmm.s.pR0LoggerR0)
     
    24632492 * @param   pVCpu       The cross context virtual CPU structure.
    24642493 */
    2465 VMMR0_INT_DECL(bool) VMMR0IsLogFlushDisabled(PVMCPU pVCpu)
     2494VMMR0_INT_DECL(bool) VMMR0IsLogFlushDisabled(PVMCPUCC pVCpu)
    24662495{
    24672496    if (pVCpu->vmm.s.pR0LoggerR0)
     
    24832512    {
    24842513#ifdef VBOX_BUGREF_9217
    2485         PVMCPU pVCpu = pGVCpu;
     2514        PVMCPUCC pVCpu = pGVCpu;
    24862515#else
    2487         PVMCPU pVCpu = pGVCpu->pVCpu;
     2516        PVMCPUCC pVCpu = pGVCpu->pVCpu;
    24882517#endif
    24892518        if (RT_VALID_PTR(pVCpu))
     
    25282557    return true;
    25292558#else
    2530     PVM pVM = GVMMR0GetVMByEMT(NIL_RTNATIVETHREAD);
     2559    PVMCC pVM = GVMMR0GetVMByEMT(NIL_RTNATIVETHREAD);
    25312560    if (pVM)
    25322561    {
    2533         PVMCPU pVCpu = VMMGetCpu(pVM);
     2562        PVMCPUCC pVCpu = VMMGetCpu(pVM);
    25342563
    25352564        if (pVCpu)
     
    25782607     * To the global VMM buffer.
    25792608     */
    2580     PVM pVM = GVMMR0GetVMByEMT(NIL_RTNATIVETHREAD);
     2609    PVMCC pVM = GVMMR0GetVMByEMT(NIL_RTNATIVETHREAD);
    25812610    if (pVM)
    25822611        RTStrPrintf(pVM->vmm.s.szRing0AssertMsg1, sizeof(pVM->vmm.s.szRing0AssertMsg1),
     
    26412670     * Push it to the global VMM buffer.
    26422671     */
    2643     PVM pVM = GVMMR0GetVMByEMT(NIL_RTNATIVETHREAD);
     2672    PVMCC pVM = GVMMR0GetVMByEMT(NIL_RTNATIVETHREAD);
    26442673    if (pVM)
    26452674    {
  • trunk/src/VBox/VMM/VMMRZ/CPUMRZ.cpp

    r80064 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_CPUM
    2324#include <VBox/vmm/cpum.h>
  • trunk/src/VBox/VMM/VMMRZ/DBGFRZ.cpp

    r76553 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
    2223#define LOG_GROUP LOG_GROUP_DBGF
    2324#include <VBox/vmm/dbgf.h>
     
    2829#include <VBox/log.h>
    2930#include "DBGFInternal.h"
    30 #include <VBox/vmm/vm.h>
     31#include <VBox/vmm/vmcc.h>
    3132#include <VBox/err.h>
    3233#include <iprt/assert.h>
  • trunk/src/VBox/VMM/VMMRZ/VMMRZ.cpp

    r76553 r80274  
    2020*   Header Files                                                                                                                 *
    2121*********************************************************************************************************************************/
     22#define VBOX_BUGREF_9217_PART_I
     23#define LOG_GROUP LOG_GROUP_VMM
    2224#include <VBox/vmm/vmm.h>
    2325#include "VMMInternal.h"
    24 #include <VBox/vmm/vm.h>
     26#include <VBox/vmm/vmcc.h>
    2527#include <VBox/err.h>
    2628
     
    4446 * @param   uArg            The argument to the operation.
    4547 */
    46 VMMRZDECL(int) VMMRZCallRing3(PVM pVM, PVMCPU pVCpu, VMMCALLRING3 enmOperation, uint64_t uArg)
     48VMMRZDECL(int) VMMRZCallRing3(PVMCC pVM, PVMCPUCC pVCpu, VMMCALLRING3 enmOperation, uint64_t uArg)
    4749{
    4850    VMCPU_ASSERT_EMT(pVCpu);
     
    116118 * @param   uArg            The argument to the operation.
    117119 */
    118 VMMRZDECL(int) VMMRZCallRing3NoCpu(PVM pVM, VMMCALLRING3 enmOperation, uint64_t uArg)
     120VMMRZDECL(int) VMMRZCallRing3NoCpu(PVMCC pVM, VMMCALLRING3 enmOperation, uint64_t uArg)
    119121{
    120122    return VMMRZCallRing3(pVM, VMMGetCpu(pVM), enmOperation, uArg);
     
    128130 * @thread  EMT.
    129131 */
    130 VMMRZDECL(void) VMMRZCallRing3Disable(PVMCPU pVCpu)
     132VMMRZDECL(void) VMMRZCallRing3Disable(PVMCPUCC pVCpu)
    131133{
    132134    VMCPU_ASSERT_EMT(pVCpu);
     
    164166 * @thread  EMT.
    165167 */
    166 VMMRZDECL(void) VMMRZCallRing3Enable(PVMCPU pVCpu)
     168VMMRZDECL(void) VMMRZCallRing3Enable(PVMCPUCC pVCpu)
    167169{
    168170    VMCPU_ASSERT_EMT(pVCpu);
     
    198200 * @param   pVCpu               The cross context virtual CPU structure of the calling EMT.
    199201 */
    200 VMMRZDECL(bool) VMMRZCallRing3IsEnabled(PVMCPU pVCpu)
     202VMMRZDECL(bool) VMMRZCallRing3IsEnabled(PVMCPUCC pVCpu)
    201203{
    202204    VMCPU_ASSERT_EMT(pVCpu);
     
    215217 * @return VBox status code.
    216218 */
    217 VMMRZDECL(int) VMMRZCallRing3SetNotification(PVMCPU pVCpu, R0PTRTYPE(PFNVMMR0CALLRING3NOTIFICATION) pfnCallback, RTR0PTR pvUser)
     219VMMRZDECL(int) VMMRZCallRing3SetNotification(PVMCPUCC pVCpu, R0PTRTYPE(PFNVMMR0CALLRING3NOTIFICATION) pfnCallback, RTR0PTR pvUser)
    218220{
    219221    AssertPtrReturn(pVCpu, VERR_INVALID_POINTER);
     
    234236 * @param   pVCpu   The cross context virtual CPU structure.
    235237 */
    236 VMMRZDECL(void) VMMRZCallRing3RemoveNotification(PVMCPU pVCpu)
     238VMMRZDECL(void) VMMRZCallRing3RemoveNotification(PVMCPUCC pVCpu)
    237239{
    238240    pVCpu->vmm.s.pfnCallRing3CallbackR0 = NULL;
     
    246248 * @returns true if there the notification is active, false otherwise.
    247249 */
    248 VMMRZDECL(bool) VMMRZCallRing3IsNotificationSet(PVMCPU pVCpu)
     250VMMRZDECL(bool) VMMRZCallRing3IsNotificationSet(PVMCPUCC pVCpu)
    249251{
    250252    return pVCpu->vmm.s.pfnCallRing3CallbackR0 != NULL;
  • trunk/src/VBox/VMM/include/HMInternal.h

    r80268 r80274  
    675675 * @param   pVCpu       Pointer to the cross context per-CPU structure.
    676676 */
    677 typedef DECLCALLBACK(int) FNHMVMXSTARTVM(RTHCUINT fResume, PCPUMCTX pCtx, void *pvUnused, PVM pVM, PVMCPU pVCpu);
     677typedef DECLCALLBACK(int) FNHMVMXSTARTVM(RTHCUINT fResume, PCPUMCTX pCtx, void *pvUnused, PVMCC pVM, PVMCPUCC pVCpu);
    678678/** Pointer to a VMX StartVM function. */
    679679typedef R0PTRTYPE(FNHMVMXSTARTVM *) PFNHMVMXSTARTVM;
    680680
    681681/** SVM VMRun function. */
    682 typedef DECLCALLBACK(int) FNHMSVMVMRUN(RTHCPHYS pVmcbHostPhys, RTHCPHYS pVmcbPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu);
     682typedef DECLCALLBACK(int) FNHMSVMVMRUN(RTHCPHYS pVmcbHostPhys, RTHCPHYS pVmcbPhys, PCPUMCTX pCtx, PVMCC pVM, PVMCPUCC pVCpu);
    683683/** Pointer to a SVM VMRun function. */
    684684typedef R0PTRTYPE(FNHMSVMVMRUN *) PFNHMSVMVMRUN;
  • trunk/src/VBox/VMM/include/NEMInternal.h

    r76585 r80274  
    361361    /** Hypercall input/ouput page. */
    362362    NEMR0HYPERCALLDATA          HypercallData;
     363#  ifdef VBOX_BUGREF_9217
     364    /** Delta to add to convert a ring-0 pointer to a ring-3 one.   */
     365    uintptr_t                   offRing3ConversionDelta;
     366#  endif
    363367# else
    364368    uint32_t                    uDummy;
     
    376380    /** I/O control context. */
    377381    PSUPR0IOCTLCTX              pIoCtlCtx;
     382# ifndef VBOX_BUGREF_9217
    378383    /** Delta to add to convert a ring-0 pointer to a ring-3 one.   */
    379384    uintptr_t                   offRing3ConversionDelta;
     385# endif
    380386    /** Info about the VidGetHvPartitionId I/O control interface. */
    381387    NEMWINIOCTL                 IoCtlGetHvPartitionId;
  • trunk/src/VBox/VMM/include/PDMInternal.h

    r78208 r80274  
    148148
    149149    /** R0 pointer to the VM this instance was created for. */
    150     PVMR0                           pVMR0;
     150    R0PTRTYPE(PVMCC)                pVMR0;
    151151    /** Associated PCI device list head (first is default). (R0 ptr) */
    152152    R0PTRTYPE(PPDMPCIDEV)           pHeadPciDevR0;
     
    244244    PVMR3                           pVMR3;
    245245    /** Pointer to the VM this instance was created for, ring-0 context. */
    246     PVMR0                           pVMR0;
     246    R0PTRTYPE(PVMCC)                pVMR0;
    247247    /** Pointer to the VM this instance was created for, raw-mode context. */
    248248    PVMRC                           pVMRC;
  • trunk/src/VBox/VMM/include/VMMInternal.h

    r80019 r80274  
    7575{
    7676    /** Pointer to Pointer to the VM. */
    77     R0PTRTYPE(PVM            pVM;
     77    R0PTRTYPE(PVMCC)            pVM;
    7878    /** Size of the allocated logger instance (Logger). */
    7979    uint32_t                    cbLogger;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette