VirtualBox

Changeset 72967 in vbox for trunk/src


Ignore:
Timestamp:
Jul 8, 2018 10:38:08 AM (6 years ago)
Author:
vboxsync
Message:

VMM/HMSVM: bugref:9193 Stop passing pCtx around and use pVCpu->cpum.GstCtx instead where possible.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/HMSVMAll.cpp

    r72963 r72967  
    5151 * @param   pCtx                Pointer to the guest-CPU context.
    5252 */
    53 int hmSvmEmulateMovTpr(PVMCPU pVCpu, PCPUMCTX pCtx)
    54 {
     53int hmSvmEmulateMovTpr(PVMCPU pVCpu)
     54{
     55    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    5556    Log4(("Emulated VMMCall TPR access replacement at RIP=%RGv\n", pCtx->rip));
    5657
     
    229230 *
    230231 * @param   pVCpu               The cross context virtual CPU structure.
    231  * @param   pCtx                Pointer to the guest-CPU context.
    232  */
    233 VMM_INT_DECL(int) HMHCSvmMaybeMovTprHypercall(PVMCPU pVCpu, PCPUMCTX pCtx)
     232 */
     233VMM_INT_DECL(int) HMHCSvmMaybeMovTprHypercall(PVMCPU pVCpu)
    234234{
    235235    PVM pVM = pVCpu->CTX_SUFF(pVM);
    236236    if (pVM->hm.s.fTprPatchingAllowed)
    237237    {
    238         int rc = hmSvmEmulateMovTpr(pVCpu, pCtx);
     238        int rc = hmSvmEmulateMovTpr(pVCpu);
    239239        if (RT_SUCCESS(rc))
    240240            return VINF_SUCCESS;
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImplSvmInstr.cpp.h

    r72643 r72967  
    11601160#ifndef IN_RC
    11611161    /* This is a little bit more complicated than the VT-x version because HM/SVM may
    1162        patch MOV CR8 instructions too speed up APIC.TPR access for 32-bit windows guests. */
     1162       patch MOV CR8 instructions to speed up APIC.TPR access for 32-bit windows guests. */
    11631163    if (VM_IS_HM_ENABLED(pVCpu->CTX_SUFF(pVM)))
    11641164    {
    1165         int rc = HMHCSvmMaybeMovTprHypercall(pVCpu, IEM_GET_CTX(pVCpu));
     1165        int rc = HMHCSvmMaybeMovTprHypercall(pVCpu);
    11661166        if (RT_SUCCESS(rc))
    11671167        {
  • trunk/src/VBox/VMM/VMMR0/HMR0.cpp

    r72907 r72967  
    9191    DECLR0CALLBACKMEMBER(void, pfnThreadCtxCallback, (RTTHREADCTXEVENT enmEvent, PVMCPU pVCpu, bool fGlobalInit));
    9292    DECLR0CALLBACKMEMBER(int,  pfnExportHostState, (PVMCPU pVCpu));
    93     DECLR0CALLBACKMEMBER(VBOXSTRICTRC, pfnRunGuestCode, (PVMCPU pVCpu, PCPUMCTX pCtx));
     93    DECLR0CALLBACKMEMBER(VBOXSTRICTRC, pfnRunGuestCode, (PVMCPU pVCpu));
    9494    DECLR0CALLBACKMEMBER(int,  pfnEnableCpu, (PHMGLOBALCPUINFO pHostCpu, PVM pVM, void *pvCpuPage, RTHCPHYS HCPhysCpuPage,
    9595                                              bool fEnabledByHost, void *pvArg));
     
    276276}
    277277
    278 static DECLCALLBACK(VBOXSTRICTRC) hmR0DummyRunGuestCode(PVMCPU pVCpu, PCPUMCTX pCtx)
    279 {
    280     RT_NOREF2(pVCpu, pCtx);
     278static DECLCALLBACK(VBOXSTRICTRC) hmR0DummyRunGuestCode(PVMCPU pVCpu)
     279{
     280    RT_NOREF(pVCpu);
    281281    return VINF_SUCCESS;
    282282}
     
    15551555#endif
    15561556
    1557     VBOXSTRICTRC rcStrict = g_HmR0.pfnRunGuestCode(pVCpu, &pVCpu->cpum.GstCtx);
     1557    VBOXSTRICTRC rcStrict = g_HmR0.pfnRunGuestCode(pVCpu);
    15581558
    15591559#ifdef VBOX_WITH_2X_4GB_ADDR_SPACE
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp

    r72966 r72967  
    149149 * event in the guest. */
    150150#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    151 # define HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY() \
     151# define HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(a_pVCpu, a_pSvmTransient) \
    152152    do \
    153153    { \
    154         int rc = hmR0SvmCheckExitDueToEventDelivery(pVCpu, pCtx, pSvmTransient); \
     154        int rc = hmR0SvmCheckExitDueToEventDelivery((a_pVCpu), (a_pSvmTransient)); \
    155155        if (RT_LIKELY(rc == VINF_SUCCESS))        { /* continue #VMEXIT handling */ } \
    156156        else if (     rc == VINF_HM_DOUBLE_FAULT) { return VINF_SUCCESS;            } \
    157157        else if (     rc == VINF_EM_RESET \
    158                  &&   CPUMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_SHUTDOWN)) \
     158                 &&   CPUMIsGuestSvmCtrlInterceptSet((a_pVCpu), &(a_pVCpu)->cpum.GstCtx, SVM_CTRL_INTERCEPT_SHUTDOWN)) \
    159159        { \
    160             HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_SVM_VMEXIT_MASK); \
    161             return VBOXSTRICTRC_TODO(IEMExecSvmVmexit(pVCpu, SVM_EXIT_SHUTDOWN, 0, 0)); \
     160            HMSVM_CPUMCTX_IMPORT_STATE((a_pVCpu), IEM_CPUMCTX_EXTRN_SVM_VMEXIT_MASK); \
     161            return VBOXSTRICTRC_TODO(IEMExecSvmVmexit((a_pVCpu), SVM_EXIT_SHUTDOWN, 0, 0)); \
    162162        } \
    163163        else \
     
    165165    } while (0)
    166166#else
    167 # define HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY() \
     167# define HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(a_pVCpu, a_pSvmTransient) \
    168168    do \
    169169    { \
    170         int rc = hmR0SvmCheckExitDueToEventDelivery(pVCpu, pCtx, pSvmTransient); \
     170        int rc = hmR0SvmCheckExitDueToEventDelivery((a_pVCpu), (a_pSvmTransient)); \
    171171        if (RT_LIKELY(rc == VINF_SUCCESS))        { /* continue #VMEXIT handling */ } \
    172172        else if (     rc == VINF_HM_DOUBLE_FAULT) { return VINF_SUCCESS;            } \
     
    177177
    178178/** Macro which updates interrupt shadow for the current RIP.  */
    179 #define HMSVM_UPDATE_INTR_SHADOW(pVCpu, pCtx) \
     179#define HMSVM_UPDATE_INTR_SHADOW(a_pVCpu) \
    180180    do { \
    181181        /* Update interrupt shadow. */ \
    182         if (   VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS) \
    183             && pCtx->rip != EMGetInhibitInterruptsPC(pVCpu)) \
    184             VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS); \
     182        if (   VMCPU_FF_IS_PENDING((a_pVCpu), VMCPU_FF_INHIBIT_INTERRUPTS) \
     183            && (a_pVCpu)->cpum.GstCtx.rip != EMGetInhibitInterruptsPC((a_pVCpu))) \
     184            VMCPU_FF_CLEAR((a_pVCpu), VMCPU_FF_INHIBIT_INTERRUPTS); \
    185185    } while (0)
    186186
     
    361361 * @returns VBox status code.
    362362 * @param   pVCpu           The cross context virtual CPU structure.
    363  * @param   pCtx            Pointer to the guest-CPU context.
    364363 * @param   pSvmTransient   Pointer to the SVM-transient structure.
    365364 */
    366 typedef int FNSVMEXITHANDLER(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
     365typedef int FNSVMEXITHANDLER(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient);
    367366
    368367
     
    425424/** @} */
    426425
    427 static int hmR0SvmHandleExit(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
     426static int hmR0SvmHandleExit(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient);
    428427#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    429 static int hmR0SvmHandleExitNested(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
     428static int hmR0SvmHandleExitNested(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient);
    430429#endif
    431430
     
    808807 * @return @c true if supported, @c false otherwise.
    809808 * @param   pVCpu       The cross context virtual CPU structure.
    810  * @param   pCtx        Pointer to the guest-CPU context.
    811  */
    812 DECLINLINE(bool) hmR0SvmSupportsVmcbCleanBits(PVMCPU pVCpu, PCCPUMCTX pCtx)
     809 */
     810DECLINLINE(bool) hmR0SvmSupportsVmcbCleanBits(PVMCPU pVCpu)
    813811{
    814812    PVM pVM = pVCpu->CTX_SUFF(pVM);
    815813#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    816     if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     814    if (CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx))
    817815    {
    818816        return (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_VMCB_CLEAN)
    819817            &&  pVM->cpum.ro.GuestFeatures.fSvmVmcbClean;
    820818    }
    821 #else
    822     RT_NOREF(pCtx);
    823819#endif
    824820    return RT_BOOL(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_VMCB_CLEAN);
     
    831827 * @return @c true if supported, @c false otherwise.
    832828 * @param   pVCpu       The cross context virtual CPU structure.
    833  * @param   pCtx        Pointer to the guest-CPU context.
    834  */
    835 DECLINLINE(bool) hmR0SvmSupportsDecodeAssists(PVMCPU pVCpu, PCPUMCTX pCtx)
     829 */
     830DECLINLINE(bool) hmR0SvmSupportsDecodeAssists(PVMCPU pVCpu)
    836831{
    837832    PVM pVM = pVCpu->CTX_SUFF(pVM);
    838833#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    839     if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     834    if (CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx))
    840835    {
    841836        return (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSISTS)
    842837            &&  pVM->cpum.ro.GuestFeatures.fSvmDecodeAssists;
    843838    }
    844 #else
    845     RT_NOREF(pCtx);
    846839#endif
    847840    return RT_BOOL(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSISTS);
     
    854847 * @return @c true if supported, @c false otherwise.
    855848 * @param   pVCpu       The cross context virtual CPU structure.
    856  * @param   pCtx        Pointer to the guest-CPU context.
    857  */
    858 DECLINLINE(bool) hmR0SvmSupportsNextRipSave(PVMCPU pVCpu, PCPUMCTX pCtx)
     849 */
     850DECLINLINE(bool) hmR0SvmSupportsNextRipSave(PVMCPU pVCpu)
    859851{
    860852    PVM pVM = pVCpu->CTX_SUFF(pVM);
    861853#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    862     if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     854    if (CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx))
    863855    {
    864856        return (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE)
    865857            &&  pVM->cpum.ro.GuestFeatures.fSvmNextRipSave;
    866858    }
    867 #else
    868     RT_NOREF(pCtx);
    869859#endif
    870860    return RT_BOOL(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE);
     
    875865 * Sets the permission bits for the specified MSR in the MSRPM bitmap.
    876866 *
    877  * @param   pCtx            Pointer to the guest-CPU or nested-guest-CPU context.
     867 * @param   pVCpu           The cross context virtual CPU structure.
    878868 * @param   pbMsrBitmap     Pointer to the MSR bitmap.
    879869 * @param   idMsr           The MSR for which the permissions are being set.
     
    884874 *          caller needs to take care of this.
    885875 */
    886 static void hmR0SvmSetMsrPermission(PCCPUMCTX pCtx, uint8_t *pbMsrBitmap, uint32_t idMsr, SVMMSREXITREAD enmRead,
     876static void hmR0SvmSetMsrPermission(PVMCPU pVCpu, uint8_t *pbMsrBitmap, uint32_t idMsr, SVMMSREXITREAD enmRead,
    887877                                    SVMMSREXITWRITE enmWrite)
    888878{
    889     bool const  fInNestedGuestMode = CPUMIsGuestInSvmNestedHwVirtMode(pCtx);
     879    bool const  fInNestedGuestMode = CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx);
    890880    uint16_t    offMsrpm;
    891881    uint8_t     uMsrpmBit;
     
    907897        {
    908898            /* Only clear the bit if the nested-guest is also not intercepting the MSR read.*/
    909             uint8_t const *pbNstGstMsrBitmap = (uint8_t *)pCtx->hwvirt.svm.CTX_SUFF(pvMsrBitmap);
     899            uint8_t const *pbNstGstMsrBitmap = (uint8_t *)pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pvMsrBitmap);
    910900            pbNstGstMsrBitmap += offMsrpm;
    911901            if (!(*pbNstGstMsrBitmap & RT_BIT(uMsrpmBit)))
     
    927917        {
    928918            /* Only clear the bit if the nested-guest is also not intercepting the MSR write.*/
    929             uint8_t const *pbNstGstMsrBitmap = (uint8_t *)pCtx->hwvirt.svm.CTX_SUFF(pvMsrBitmap);
     919            uint8_t const *pbNstGstMsrBitmap = (uint8_t *)pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pvMsrBitmap);
    930920            pbNstGstMsrBitmap += offMsrpm;
    931921            if (!(*pbNstGstMsrBitmap & RT_BIT(uMsrpmBit + 1)))
     
    10841074     */
    10851075    uint8_t *pbMsrBitmap = (uint8_t *)pVCpu->hm.s.svm.pvMsrBitmap;
    1086     PCPUMCTX pCtx        = &pVCpu->cpum.GstCtx;
    1087     hmR0SvmSetMsrPermission(pCtx, pbMsrBitmap, MSR_K8_LSTAR,          SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1088     hmR0SvmSetMsrPermission(pCtx, pbMsrBitmap, MSR_K8_CSTAR,          SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1089     hmR0SvmSetMsrPermission(pCtx, pbMsrBitmap, MSR_K6_STAR,           SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1090     hmR0SvmSetMsrPermission(pCtx, pbMsrBitmap, MSR_K8_SF_MASK,        SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1091     hmR0SvmSetMsrPermission(pCtx, pbMsrBitmap, MSR_K8_FS_BASE,        SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1092     hmR0SvmSetMsrPermission(pCtx, pbMsrBitmap, MSR_K8_GS_BASE,        SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1093     hmR0SvmSetMsrPermission(pCtx, pbMsrBitmap, MSR_K8_KERNEL_GS_BASE, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1094     hmR0SvmSetMsrPermission(pCtx, pbMsrBitmap, MSR_IA32_SYSENTER_CS,  SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1095     hmR0SvmSetMsrPermission(pCtx, pbMsrBitmap, MSR_IA32_SYSENTER_ESP, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    1096     hmR0SvmSetMsrPermission(pCtx, pbMsrBitmap, MSR_IA32_SYSENTER_EIP, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1076    hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_LSTAR,          SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1077    hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_CSTAR,          SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1078    hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K6_STAR,           SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1079    hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_SF_MASK,        SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1080    hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_FS_BASE,        SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1081    hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_GS_BASE,        SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1082    hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_KERNEL_GS_BASE, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1083    hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_IA32_SYSENTER_CS,  SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1084    hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_IA32_SYSENTER_ESP, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     1085    hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_IA32_SYSENTER_EIP, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    10971086    pVmcbCtrl->u64MSRPMPhysAddr = pVCpu->hm.s.svm.HCPhysMsrBitmap;
    10981087
     
    11311120 * @returns Pointer to the current context VMCB.
    11321121 * @param   pVCpu           The cross context virtual CPU structure.
    1133  * @param   pCtx            Pointer to the guest-CPU context.
    1134  */
    1135 DECLINLINE(PSVMVMCB) hmR0SvmGetCurrentVmcb(PVMCPU pVCpu, PCPUMCTX pCtx)
     1122 */
     1123DECLINLINE(PSVMVMCB) hmR0SvmGetCurrentVmcb(PVMCPU pVCpu)
    11361124{
    11371125#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    1138     if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
    1139         return pCtx->hwvirt.svm.CTX_SUFF(pVmcb);
    1140 #else
    1141     RT_NOREF(pCtx);
     1126    if (CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx))
     1127        return pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pVmcb);
    11421128#endif
    11431129    return pVCpu->hm.s.svm.pVmcb;
     
    11811167        Log4Func(("%#RGv\n", GCVirt));
    11821168
    1183         PCPUMCTX pCtx  = &pVCpu->cpum.GstCtx;
    1184         PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     1169        PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
    11851170        AssertMsgReturn(pVmcb, ("Invalid pVmcb!\n"), VERR_SVM_INVALID_PVMCB);
    11861171
     
    12041189 *
    12051190 * @param   pVCpu       The cross context virtual CPU structure.
    1206  * @param   pCtx        Pointer to the guest-CPU or nested-guest-CPU context.
    12071191 * @param   pVmcb       Pointer to the VM control block.
    12081192 * @param   pHostCpu    Pointer to the HM host-CPU info.
    12091193 */
    1210 static void hmR0SvmFlushTaggedTlb(PVMCPU pVCpu, PCCPUMCTX pCtx, PSVMVMCB pVmcb, PHMGLOBALCPUINFO pHostCpu)
    1211 {
    1212 #ifndef VBOX_WITH_NESTED_HWVIRT_SVM
    1213     RT_NOREF(pCtx);
    1214 #endif
    1215     PVM pVM = pVCpu->CTX_SUFF(pVM);
    1216 
     1194static void hmR0SvmFlushTaggedTlb(PVMCPU pVCpu, PSVMVMCB pVmcb, PHMGLOBALCPUINFO pHostCpu)
     1195{
    12171196    /*
    12181197     * Force a TLB flush for the first world switch if the current CPU differs from the one
     
    12311210        || pVCpu->hm.s.cTlbFlushes != pHostCpu->cTlbFlushes
    12321211#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    1233         || CPUMIsGuestInSvmNestedHwVirtMode(pCtx)
     1212        || CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx)
    12341213#endif
    12351214        )
     
    12541233     * This Host CPU requirement takes precedence.
    12551234     */
     1235    PVM pVM = pVCpu->CTX_SUFF(pVM);
    12561236    if (pVM->hm.s.svm.fAlwaysFlushTLB)
    12571237    {
     
    14971477 * @returns @c true if the intercept is still set, @c false otherwise.
    14981478 * @param   pVCpu           The cross context virtual CPU structure.
    1499  * @param   pCtx            Pointer to the guest-CPU context.
    15001479 * @param   pVmcb           Pointer to the VM control block.
    15011480 * @param   fCtrlIntercept  The control intercept (SVM_CTRL_INTERCEPT_*).
     
    15051484 *          are not intercepting it.
    15061485 */
    1507 DECLINLINE(bool) hmR0SvmClearCtrlIntercept(PVMCPU pVCpu, PCCPUMCTX pCtx, PSVMVMCB pVmcb, uint64_t fCtrlIntercept)
     1486static bool hmR0SvmClearCtrlIntercept(PVMCPU pVCpu, PSVMVMCB pVmcb, uint64_t fCtrlIntercept)
    15081487{
    15091488    if (pVmcb->ctrl.u64InterceptCtrl & fCtrlIntercept)
     
    15121491#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    15131492        /* Only remove the control intercept if the nested-guest is also not intercepting it! */
    1514         if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     1493        if (CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx))
    15151494        {
    15161495            PCSVMNESTEDVMCBCACHE pVmcbNstGstCache = hmR0SvmGetNestedVmcbCache(pVCpu);
    15171496            fRemove = !(pVmcbNstGstCache->u64InterceptCtrl & fCtrlIntercept);
    15181497        }
    1519 #else
    1520         RT_NOREF2(pVCpu, pCtx);
    15211498#endif
    15221499        if (fRemove)
     
    21262103    if (ASMAtomicUoReadU64(&pVCpu->hm.s.fCtxChanged) & HM_CHANGED_GUEST_APIC_TPR)
    21272104    {
    2128         PVM       pVM = pVCpu->CTX_SUFF(pVM);
    2129         PCCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
     2105        PVM pVM = pVCpu->CTX_SUFF(pVM);
    21302106        if (   PDMHasApic(pVM)
    21312107            && APICIsEnabled(pVCpu))
     
    21662142                /* If there are interrupts pending, intercept LSTAR writes, otherwise don't intercept reads or writes. */
    21672143                if (fPendingIntr)
    2168                     hmR0SvmSetMsrPermission(pCtx, pbMsrBitmap, MSR_K8_LSTAR, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_INTERCEPT_WRITE);
     2144                    hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_LSTAR, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_INTERCEPT_WRITE);
    21692145                else
    21702146                {
    2171                     hmR0SvmSetMsrPermission(pCtx, pbMsrBitmap, MSR_K8_LSTAR, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     2147                    hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_LSTAR, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    21722148                    pVCpu->hm.s.svm.fSyncVTpr = true;
    21732149                }
     
    22262202 * @param   pVCpu           The cross context virtual CPU structure.
    22272203 * @param   pVmcbNstGst     Pointer to the nested-guest VM control block.
    2228  * @param   pCtx            Pointer to the nested-guest-CPU context.
    2229  */
    2230 static void hmR0SvmMergeVmcbCtrlsNested(PVMCPU pVCpu, PCCPUMCTX pCtx)
     2204 */
     2205static void hmR0SvmMergeVmcbCtrlsNested(PVMCPU pVCpu)
    22312206{
    22322207    PVM          pVM             = pVCpu->CTX_SUFF(pVM);
    22332208    PCSVMVMCB    pVmcb           = pVCpu->hm.s.svm.pVmcb;
    2234     PSVMVMCB     pVmcbNstGst     = pCtx->hwvirt.svm.CTX_SUFF(pVmcb);
     2209    PSVMVMCB     pVmcbNstGst     = pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pVmcb);
    22352210    PSVMVMCBCTRL pVmcbNstGstCtrl = &pVmcbNstGst->ctrl;
    22362211
     
    25362511 * @param   pHostCpu        Pointer to the physical CPU HM info. struct.
    25372512 * @param   pVCpu           The cross context virtual CPU structure.
    2538  * @param   pCtx            Pointer to the nested-guest-CPU context.
    25392513 *
    25402514 * @remarks No-long-jmp zone!!!
    25412515 */
    2542 DECLINLINE(void) hmR0SvmMergeMsrpmNested(PHMGLOBALCPUINFO pHostCpu, PVMCPU pVCpu, PCCPUMCTX pCtx)
     2516DECLINLINE(void) hmR0SvmMergeMsrpmNested(PHMGLOBALCPUINFO pHostCpu, PVMCPU pVCpu)
    25432517{
    25442518    uint64_t const *pu64GstMsrpm    = (uint64_t const *)pVCpu->hm.s.svm.pvMsrBitmap;
    2545     uint64_t const *pu64NstGstMsrpm = (uint64_t const *)pCtx->hwvirt.svm.CTX_SUFF(pvMsrBitmap);
     2519    uint64_t const *pu64NstGstMsrpm = (uint64_t const *)pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pvMsrBitmap);
    25462520    uint64_t       *pu64DstMsrpm    = (uint64_t *)pHostCpu->n.svm.pvNstGstMsrpm;
    25472521
     
    25582532 *
    25592533 * @returns true if the VMCB was previously already cached, false otherwise.
    2560  * @param   pCtx            Pointer to the guest-CPU context.
     2534 * @param   pVCpu           The cross context virtual CPU structure.
    25612535 *
    25622536 * @sa      HMSvmNstGstVmExitNotify.
    25632537 */
    2564 static bool hmR0SvmCacheVmcbNested(PVMCPU pVCpu, PCCPUMCTX pCtx)
     2538static bool hmR0SvmCacheVmcbNested(PVMCPU pVCpu)
    25652539{
    25662540    /*
     
    25752549    if (!fWasCached)
    25762550    {
    2577         PCSVMVMCB      pVmcbNstGst    = pCtx->hwvirt.svm.CTX_SUFF(pVmcb);
     2551        PCSVMVMCB      pVmcbNstGst    = pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pVmcb);
    25782552        PCSVMVMCBCTRL pVmcbNstGstCtrl = &pVmcbNstGst->ctrl;
    25792553        pVmcbNstGstCache->u16InterceptRdCRx       = pVmcbNstGstCtrl->u16InterceptRdCRx;
     
    26082582static void hmR0SvmSetupVmcbNested(PVMCPU pVCpu)
    26092583{
    2610     PCCPUMCTX    pCtx            = &pVCpu->cpum.GstCtx;
    2611     PSVMVMCB     pVmcbNstGst     = pCtx->hwvirt.svm.CTX_SUFF(pVmcb);
     2584    PSVMVMCB     pVmcbNstGst     = pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pVmcb);
    26122585    PSVMVMCBCTRL pVmcbNstGstCtrl = &pVmcbNstGst->ctrl;
    26132586
     
    26152588     * First cache the nested-guest VMCB fields we may potentially modify.
    26162589     */
    2617     bool const fVmcbCached = hmR0SvmCacheVmcbNested(pVCpu, pCtx);
     2590    bool const fVmcbCached = hmR0SvmCacheVmcbNested(pVCpu);
    26182591    if (!fVmcbCached)
    26192592    {
     
    26632636
    26642637        /* Merge the guest and nested-guest intercepts. */
    2665         hmR0SvmMergeVmcbCtrlsNested(pVCpu, pCtx);
     2638        hmR0SvmMergeVmcbCtrlsNested(pVCpu);
    26662639
    26672640        /* Update the VMCB clean bits. */
     
    28032776
    28042777    PCPUMCTX           pCtx       = &pVCpu->cpum.GstCtx;
    2805     PCSVMVMCB          pVmcb      = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     2778    PCSVMVMCB          pVmcb      = hmR0SvmGetCurrentVmcb(pVCpu);
    28062779    PCSVMVMCBSTATESAVE pVmcbGuest = &pVmcb->guest;
    28072780    PCSVMVMCBCTRL      pVmcbCtrl  = &pVmcb->ctrl;
     
    31913164 * @param   pVCpu           The cross context virtual CPU structure.
    31923165 * @param   enmOperation    The operation causing the ring-3 longjump.
    3193  * @param   pvUser          The user argument (pointer to the possibly
    3194  *                          out-of-date guest-CPU context).
     3166 * @param   pvUser          The user argument, NULL (currently unused).
    31953167 */
    31963168static DECLCALLBACK(int) hmR0SvmCallRing3Callback(PVMCPU pVCpu, VMMCALLRING3 enmOperation, void *pvUser)
     
    32553227 * @returns VBox status code.
    32563228 * @param   pVCpu       The cross context virtual CPU structure.
    3257  * @param   pCtx        Pointer to the guest-CPU context.
    32583229 * @param   rcExit      The reason for exiting to ring-3. Can be
    32593230 *                      VINF_VMM_UNKNOWN_RING3_CALL.
    32603231 */
    3261 static int hmR0SvmExitToRing3(PVMCPU pVCpu, PCPUMCTX pCtx, int rcExit)
     3232static int hmR0SvmExitToRing3(PVMCPU pVCpu, int rcExit)
    32623233{
    32633234    Assert(pVCpu);
    3264     Assert(pCtx);
    32653235    HMSVM_ASSERT_PREEMPT_SAFE(pVCpu);
    32663236
     
    32893259                             | CPUM_CHANGED_HIDDEN_SEL_REGS);
    32903260    if (   pVCpu->CTX_SUFF(pVM)->hm.s.fNestedPaging
    3291         && CPUMIsGuestPagingEnabledEx(pCtx))
     3261        && CPUMIsGuestPagingEnabledEx(&pVCpu->cpum.GstCtx))
    32923262    {
    32933263        CPUMSetChangedFlags(pVCpu, CPUM_CHANGED_GLOBAL_TLB_FLUSH);
     
    33003270    if (rcExit != VINF_EM_RAW_INTERRUPT)
    33013271    {
    3302         Assert(!(pCtx->fExtrn & HMSVM_CPUMCTX_EXTRN_ALL));
     3272        Assert(!(pVCpu->cpum.GstCtx.fExtrn & HMSVM_CPUMCTX_EXTRN_ALL));
    33033273        ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_ALL_GUEST);
    33043274    }
     
    33303300 *
    33313301 * @param   pVCpu       The cross context virtual CPU structure.
    3332  * @param   pCtx        Pointer to the guest-CPU or nested-guest-CPU context.
    33333302 * @param   pVmcb       Pointer to the VM control block.
    33343303 *
    33353304 * @remarks No-long-jump zone!!!
    33363305 */
    3337 static void hmR0SvmUpdateTscOffsetting(PVMCPU pVCpu, PCCPUMCTX pCtx, PSVMVMCB pVmcb)
     3306static void hmR0SvmUpdateTscOffsetting(PVMCPU pVCpu, PSVMVMCB pVmcb)
    33383307{
    33393308    /*
     
    33483317    bool fIntercept;
    33493318    if (fCanUseRealTsc)
    3350          fIntercept = hmR0SvmClearCtrlIntercept(pVCpu, pCtx, pVmcb, SVM_CTRL_INTERCEPT_RDTSC | SVM_CTRL_INTERCEPT_RDTSCP);
     3319         fIntercept = hmR0SvmClearCtrlIntercept(pVCpu, pVmcb, SVM_CTRL_INTERCEPT_RDTSC | SVM_CTRL_INTERCEPT_RDTSCP);
    33513320    else
    33523321    {
     
    33573326    if (!fIntercept)
    33583327    {
     3328#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    33593329        /* Apply the nested-guest VMCB's TSC offset over the guest TSC offset. */
    3360         if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     3330        if (CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx))
    33613331            uTscOffset = HMSvmNstGstApplyTscOffset(pVCpu, uTscOffset);
     3332#endif
    33623333
    33633334        /* Update the TSC offset in the VMCB and the relevant clean bits. */
     
    34383409 *
    34393410 * @param   pVCpu           The cross context virtual CPU structure.
    3440  * @param   pCtx            Pointer to the guest-CPU context.
    34413411 * @param   u32ErrCode      The error-code for the page-fault.
    34423412 * @param   uFaultAddress   The page fault address (CR2).
     
    34443414 * @remarks This updates the guest CR2 with @a uFaultAddress!
    34453415 */
    3446 DECLINLINE(void) hmR0SvmSetPendingXcptPF(PVMCPU pVCpu, PCPUMCTX pCtx, uint32_t u32ErrCode, RTGCUINTPTR uFaultAddress)
     3416DECLINLINE(void) hmR0SvmSetPendingXcptPF(PVMCPU pVCpu, uint32_t u32ErrCode, RTGCUINTPTR uFaultAddress)
    34473417{
    34483418    SVMEVENT Event;
     
    34563426    /* Update CR2 of the guest. */
    34573427    HMSVM_CPUMCTX_ASSERT(pVCpu, CPUMCTX_EXTRN_CR2);
    3458     if (pCtx->cr2 != uFaultAddress)
    3459     {
    3460         pCtx->cr2 = uFaultAddress;
     3428    if (pVCpu->cpum.GstCtx.cr2 != uFaultAddress)
     3429    {
     3430        pVCpu->cpum.GstCtx.cr2 = uFaultAddress;
    34613431        /* The VMCB clean bit for CR2 will be updated while re-loading the guest state. */
    34623432        ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_GUEST_CR2);
     
    36423612 * @returns @c true if the interrupt shadow is active, @c false otherwise.
    36433613 * @param   pVCpu   The cross context virtual CPU structure.
    3644  * @param   pCtx    Pointer to the guest-CPU context.
    36453614 *
    36463615 * @remarks No-long-jump zone!!!
    36473616 * @remarks Has side-effects with VMCPU_FF_INHIBIT_INTERRUPTS force-flag.
    36483617 */
    3649 DECLINLINE(bool) hmR0SvmIsIntrShadowActive(PVMCPU pVCpu, PCCPUMCTX pCtx)
     3618static bool hmR0SvmIsIntrShadowActive(PVMCPU pVCpu)
    36503619{
    36513620    /*
     
    36563625    if (VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_INHIBIT_INTERRUPTS))
    36573626    {
    3658         if (pCtx->rip != EMGetInhibitInterruptsPC(pVCpu))
     3627        if (pVCpu->cpum.GstCtx.rip != EMGetInhibitInterruptsPC(pVCpu))
    36593628        {
    36603629            /*
     
    36773646 * @param   pVCpu   The cross context virtual CPU structure.
    36783647 * @param   pVmcb   Pointer to the VM control block.
    3679  * @param   pCtx    Pointer to the guest-CPU context.
    3680  */
    3681 DECLINLINE(void) hmR0SvmSetIntWindowExiting(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pCtx)
     3648 */
     3649static void hmR0SvmSetIntWindowExiting(PVMCPU pVCpu, PSVMVMCB pVmcb)
    36823650{
    36833651    /*
     
    37043672    if (!fEnableIntWindow)
    37053673    {
    3706         Assert(CPUMIsGuestInSvmNestedHwVirtMode(pCtx)); RT_NOREF(pCtx);
     3674        Assert(CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx));
    37073675        Log4(("Nested-guest V_IRQ already pending\n"));
    37083676    }
    37093677#else
    3710     RT_NOREF2(pVCpu, pCtx);
    37113678    bool const fEnableIntWindow = true;
    37123679#endif
     
    37293696 * @param   pVCpu   The cross context virtual CPU structure.
    37303697 * @param   pVmcb   Pointer to the VM control block.
    3731  * @param   pCtx    Pointer to the guest-CPU context.
    3732  */
    3733 DECLINLINE(void) hmR0SvmClearIntWindowExiting(PVMCPU pVCpu, PSVMVMCB pVmcb, PCPUMCTX pCtx)
     3698 */
     3699static void hmR0SvmClearIntWindowExiting(PVMCPU pVCpu, PSVMVMCB pVmcb)
    37343700{
    37353701    PSVMVMCBCTRL pVmcbCtrl = &pVmcb->ctrl;
     
    37393705        pVmcbCtrl->IntCtrl.n.u1VIrqPending = 0;
    37403706        pVmcbCtrl->u32VmcbCleanBits &= ~HMSVM_VMCB_CLEAN_INT_CTRL;
    3741         hmR0SvmClearCtrlIntercept(pVCpu, pCtx, pVmcb, SVM_CTRL_INTERCEPT_VINTR);
     3707        hmR0SvmClearCtrlIntercept(pVCpu, pVmcb, SVM_CTRL_INTERCEPT_VINTR);
    37423708        Log4(("Cleared VINTR intercept\n"));
    37433709    }
     
    37513717 * @returns VBox strict status code.
    37523718 * @param   pVCpu       The cross context virtual CPU structure.
    3753  * @param   pCtx        Pointer to the guest-CPU context.
    3754  */
    3755 static VBOXSTRICTRC hmR0SvmEvaluatePendingEventNested(PVMCPU pVCpu, PCPUMCTX pCtx)
    3756 {
     3719 */
     3720static VBOXSTRICTRC hmR0SvmEvaluatePendingEventNested(PVMCPU pVCpu)
     3721{
     3722    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    37573723    HMSVM_ASSERT_IN_NESTED_GUEST(pCtx);
    37583724    HMSVM_CPUMCTX_ASSERT(pVCpu, CPUMCTX_EXTRN_HWVIRT
     
    37633729    Assert(!pVCpu->hm.s.Event.fPending);
    37643730    Assert(pCtx->hwvirt.fGif);
    3765     PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     3731    PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
    37663732    Assert(pVmcb);
    37673733
    37683734    bool const fVirtualGif = CPUMGetSvmNstGstVGif(pCtx);
    3769     bool const fIntShadow  = hmR0SvmIsIntrShadowActive(pVCpu, pCtx);
     3735    bool const fIntShadow  = hmR0SvmIsIntrShadowActive(pVCpu);
    37703736    bool const fBlockNmi   = VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS);
    37713737
     
    38063772            hmR0SvmSetCtrlIntercept(pVmcb, SVM_CTRL_INTERCEPT_STGI);
    38073773        else
    3808             hmR0SvmSetIntWindowExiting(pVCpu, pVmcb, pCtx);
     3774            hmR0SvmSetIntWindowExiting(pVCpu, pVmcb);
    38093775    }
    38103776    /*
     
    38613827            hmR0SvmSetCtrlIntercept(pVmcb, SVM_CTRL_INTERCEPT_STGI);
    38623828        else
    3863             hmR0SvmSetIntWindowExiting(pVCpu, pVmcb, pCtx);
     3829            hmR0SvmSetIntWindowExiting(pVCpu, pVmcb);
    38643830    }
    38653831
     
    38733839 *
    38743840 * @param   pVCpu       The cross context virtual CPU structure.
    3875  * @param   pCtx        Pointer to the guest-CPU context.
    3876  */
    3877 static void hmR0SvmEvaluatePendingEvent(PVMCPU pVCpu, PCPUMCTX pCtx)
    3878 {
     3841 */
     3842static void hmR0SvmEvaluatePendingEvent(PVMCPU pVCpu)
     3843{
     3844    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    38793845    HMSVM_ASSERT_NOT_IN_NESTED_GUEST(pCtx);
    38803846    HMSVM_CPUMCTX_ASSERT(pVCpu, CPUMCTX_EXTRN_HWVIRT
     
    38833849
    38843850    Assert(!pVCpu->hm.s.Event.fPending);
    3885     PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     3851    PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
    38863852    Assert(pVmcb);
    38873853
     
    38913857    bool const fGif       = true;
    38923858#endif
    3893     bool const fIntShadow = hmR0SvmIsIntrShadowActive(pVCpu, pCtx);
     3859    bool const fIntShadow = hmR0SvmIsIntrShadowActive(pVCpu);
    38943860    bool const fBlockInt  = !(pCtx->eflags.u32 & X86_EFL_IF);
    38953861    bool const fBlockNmi  = VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_BLOCK_NMIS);
     
    39253891            hmR0SvmSetCtrlIntercept(pVmcb, SVM_CTRL_INTERCEPT_STGI);
    39263892        else
    3927             hmR0SvmSetIntWindowExiting(pVCpu, pVmcb, pCtx);
     3893            hmR0SvmSetIntWindowExiting(pVCpu, pVmcb);
    39283894    }
    39293895    /*
     
    39653931            hmR0SvmSetCtrlIntercept(pVmcb, SVM_CTRL_INTERCEPT_STGI);
    39663932        else
    3967             hmR0SvmSetIntWindowExiting(pVCpu, pVmcb, pCtx);
     3933            hmR0SvmSetIntWindowExiting(pVCpu, pVmcb);
    39683934    }
    39693935}
     
    39743940 *
    39753941 * @param   pVCpu       The cross context virtual CPU structure.
    3976  * @param   pCtx        Pointer to the guest-CPU context.
    39773942 * @param   pVmcb       Pointer to the VM control block.
    39783943 *
     
    39813946 *          prematurely.
    39823947 */
    3983 static void hmR0SvmInjectPendingEvent(PVMCPU pVCpu, PCCPUMCTX pCtx, PSVMVMCB pVmcb)
     3948static void hmR0SvmInjectPendingEvent(PVMCPU pVCpu, PSVMVMCB pVmcb)
    39843949{
    39853950    Assert(!TRPMHasTrap(pVCpu));
    39863951    Assert(!VMMRZCallRing3IsEnabled(pVCpu));
    39873952
    3988     bool const fIntShadow = hmR0SvmIsIntrShadowActive(pVCpu, pCtx);
     3953    bool const fIntShadow = hmR0SvmIsIntrShadowActive(pVCpu);
    39893954#ifdef VBOX_STRICT
     3955    PCCPUMCTX  pCtx       = &pVCpu->cpum.GstCtx;
    39903956    bool const fGif       = pCtx->hwvirt.fGif;
    39913957    bool       fAllowInt  = fGif;
     
    40804046 *                          VERR_SVM_INVALID_GUEST_STATE for invalid
    40814047 *                          guest-state).
    4082  * @param   pCtx            Pointer to the guest-CPU context.
    4083  */
    4084 static void hmR0SvmReportWorldSwitchError(PVMCPU pVCpu, int rcVMRun, PCPUMCTX pCtx)
     4048 */
     4049static void hmR0SvmReportWorldSwitchError(PVMCPU pVCpu, int rcVMRun)
    40854050{
    40864051    HMSVM_ASSERT_PREEMPT_SAFE(pVCpu);
    4087     HMSVM_ASSERT_NOT_IN_NESTED_GUEST(pCtx);
     4052    HMSVM_ASSERT_NOT_IN_NESTED_GUEST(&pVCpu->cpum.GstCtx);
    40884053    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    40894054
     
    40914056    {
    40924057#ifdef VBOX_STRICT
    4093         hmR0DumpRegs(pVCpu, pCtx);
    4094         PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     4058        hmR0DumpRegs(pVCpu, &pVCpu->cpum.GstCtx);
     4059        PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
    40954060        Log4(("ctrl.u32VmcbCleanBits                 %#RX32\n",   pVmcb->ctrl.u32VmcbCleanBits));
    40964061        Log4(("ctrl.u16InterceptRdCRx                %#x\n",      pVmcb->ctrl.u16InterceptRdCRx));
     
    42194184    else
    42204185        Log4Func(("rcVMRun=%d\n", rcVMRun));
    4221 
    4222     NOREF(pCtx);
    42234186}
    42244187
     
    42414204 *
    42424205 * @param   pVCpu       The cross context virtual CPU structure.
    4243  * @param   pCtx        Pointer to the guest-CPU context.
    4244  */
    4245 static int hmR0SvmCheckForceFlags(PVMCPU pVCpu, PCPUMCTX pCtx)
     4206 */
     4207static int hmR0SvmCheckForceFlags(PVMCPU pVCpu)
    42464208{
    42474209    Assert(VMMRZCallRing3IsEnabled(pVCpu));
     
    42654227        if (VMCPU_FF_IS_PENDING(pVCpu,VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL))
    42664228        {
    4267             int rc = PGMSyncCR3(pVCpu, pCtx->cr0, pCtx->cr3, pCtx->cr4, VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3));
     4229            int rc = PGMSyncCR3(pVCpu, pVCpu->cpum.GstCtx.cr0, pVCpu->cpum.GstCtx.cr3, pVCpu->cpum.GstCtx.cr4,
     4230                                VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_PGM_SYNC_CR3));
    42684231            if (rc != VINF_SUCCESS)
    42694232            {
     
    43204283 *
    43214284 * @param   pVCpu           The cross context virtual CPU structure.
    4322  * @param   pCtx            Pointer to the nested-guest-CPU context.
    43234285 * @param   pSvmTransient   Pointer to the SVM transient structure.
    43244286 *
     
    43264288 * @sa      hmR0SvmPreRunGuest.
    43274289 */
    4328 static int hmR0SvmPreRunGuestNested(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    4329 {
     4290static int hmR0SvmPreRunGuestNested(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     4291{
     4292    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    43304293    HMSVM_ASSERT_PREEMPT_SAFE(pVCpu);
    43314294    HMSVM_ASSERT_IN_NESTED_GUEST(pCtx);
     
    43374300
    43384301    /* Check force flag actions that might require us to go back to ring-3. */
    4339     int rc = hmR0SvmCheckForceFlags(pVCpu, pCtx);
     4302    int rc = hmR0SvmCheckForceFlags(pVCpu);
    43404303    if (rc != VINF_SUCCESS)
    43414304        return rc;
     
    43454308    else if (!pVCpu->hm.s.Event.fPending)
    43464309    {
    4347         VBOXSTRICTRC rcStrict = hmR0SvmEvaluatePendingEventNested(pVCpu, pCtx);
     4310        VBOXSTRICTRC rcStrict = hmR0SvmEvaluatePendingEventNested(pVCpu);
    43484311        if (    rcStrict != VINF_SUCCESS
    43494312            || !CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     
    44424405 *
    44434406 * @param   pVCpu           The cross context virtual CPU structure.
    4444  * @param   pCtx            Pointer to the guest-CPU context.
    44454407 * @param   pSvmTransient   Pointer to the SVM transient structure.
    44464408 */
    4447 static int hmR0SvmPreRunGuest(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    4448 {
     4409static int hmR0SvmPreRunGuest(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     4410{
     4411    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    44494412    HMSVM_ASSERT_PREEMPT_SAFE(pVCpu);
    44504413    HMSVM_ASSERT_NOT_IN_NESTED_GUEST(pCtx);
    44514414
    44524415    /* Check force flag actions that might require us to go back to ring-3. */
    4453     int rc = hmR0SvmCheckForceFlags(pVCpu, pCtx);
     4416    int rc = hmR0SvmCheckForceFlags(pVCpu);
    44544417    if (rc != VINF_SUCCESS)
    44554418        return rc;
     
    44584421        hmR0SvmTrpmTrapToPendingEvent(pVCpu);
    44594422    else if (!pVCpu->hm.s.Event.fPending)
    4460         hmR0SvmEvaluatePendingEvent(pVCpu, pCtx);
     4423        hmR0SvmEvaluatePendingEvent(pVCpu);
    44614424
    44624425    /*
     
    45464509 *
    45474510 * @param   pVCpu           The cross context virtual CPU structure.
    4548  * @param   pCtx            Pointer to the guest-CPU context.
    45494511 * @param   pSvmTransient   Pointer to the SVM transient structure.
    45504512 *
     
    45524514 * @remarks No-long-jump zone!!!
    45534515 */
    4554 static void hmR0SvmPreRunGuestCommitted(PVMCPU pVCpu, PCCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
     4516static void hmR0SvmPreRunGuestCommitted(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
    45554517{
    45564518    Assert(!VMMRZCallRing3IsEnabled(pVCpu));
     
    45644526    PSVMVMCB pVmcb = pSvmTransient->pVmcb;
    45654527
    4566     hmR0SvmInjectPendingEvent(pVCpu, pCtx, pVmcb);
     4528    hmR0SvmInjectPendingEvent(pVCpu, pVmcb);
    45674529
    45684530    if (!CPUMIsGuestFPUStateActive(pVCpu))
     
    45894551        || fMigratedHostCpu)
    45904552    {
    4591         hmR0SvmUpdateTscOffsetting(pVCpu, pCtx, pVmcb);
     4553        hmR0SvmUpdateTscOffsetting(pVCpu, pVmcb);
    45924554        pSvmTransient->fUpdateTscOffsetting = false;
    45934555    }
     
    45994561    /* Store status of the shared guest-host state at the time of VMRUN. */
    46004562#if HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS)
    4601     if (CPUMIsGuestInLongModeEx(pCtx))
     4563    if (CPUMIsGuestInLongModeEx(&pVCpu->cpum.GstCtx))
    46024564    {
    46034565        pSvmTransient->fWasGuestDebugStateActive = CPUMIsGuestDebugStateActivePending(pVCpu);
     
    46174579    else
    46184580    {
    4619         hmR0SvmMergeMsrpmNested(pHostCpu, pVCpu, pCtx);
     4581        hmR0SvmMergeMsrpmNested(pHostCpu, pVCpu);
    46204582
    46214583        /* Update the nested-guest VMCB with the newly merged MSRPM (clean bits updated below). */
     
    46294591    ASMAtomicWriteBool(&pVCpu->hm.s.fCheckedTLBFlush, true);    /* Used for TLB flushing, set this across the world switch. */
    46304592    /* Flush the appropriate tagged-TLB entries. */
    4631     hmR0SvmFlushTaggedTlb(pVCpu, pCtx, pVmcb, pHostCpu);
     4593    hmR0SvmFlushTaggedTlb(pVCpu, pVmcb, pHostCpu);
    46324594    Assert(pVCpu->hm.s.idLastCpu == idHostCpu);
    46334595
     
    46504612        if (uGuestTscAux != pVCpu->hm.s.u64HostTscAux)
    46514613            ASMWrMsr(MSR_K8_TSC_AUX, uGuestTscAux);
    4652         hmR0SvmSetMsrPermission(pCtx, pbMsrBitmap, MSR_K8_TSC_AUX, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
     4614        hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_TSC_AUX, SVMMSREXIT_PASSTHRU_READ, SVMMSREXIT_PASSTHRU_WRITE);
    46534615        pSvmTransient->fRestoreTscAuxMsr = true;
    46544616    }
    46554617    else
    46564618    {
    4657         hmR0SvmSetMsrPermission(pCtx, pbMsrBitmap, MSR_K8_TSC_AUX, SVMMSREXIT_INTERCEPT_READ, SVMMSREXIT_INTERCEPT_WRITE);
     4619        hmR0SvmSetMsrPermission(pVCpu, pbMsrBitmap, MSR_K8_TSC_AUX, SVMMSREXIT_INTERCEPT_READ, SVMMSREXIT_INTERCEPT_WRITE);
    46584620        pSvmTransient->fRestoreTscAuxMsr = false;
    46594621    }
     
    46654627     * from the VMCB.
    46664628     */
    4667     bool const fSupportsVmcbCleanBits = hmR0SvmSupportsVmcbCleanBits(pVCpu, pCtx);
     4629    bool const fSupportsVmcbCleanBits = hmR0SvmSupportsVmcbCleanBits(pVCpu);
    46684630    if (!fSupportsVmcbCleanBits)
    46694631        pVmcb->ctrl.u32VmcbCleanBits = 0;
     
    46764638 * @returns VBox strict status code.
    46774639 * @param   pVCpu       The cross context virtual CPU structure.
    4678  * @param   pCtx        Pointer to the guest-CPU context.
    46794640 * @param   HCPhysVmcb  The host physical address of the VMCB.
    46804641 *
    46814642 * @remarks No-long-jump zone!!!
    46824643 */
    4683 DECLINLINE(int) hmR0SvmRunGuest(PVMCPU pVCpu, PCPUMCTX pCtx, RTHCPHYS HCPhysVmcb)
     4644DECLINLINE(int) hmR0SvmRunGuest(PVMCPU pVCpu, RTHCPHYS HCPhysVmcb)
    46844645{
    46854646    /* Mark that HM is the keeper of all guest-CPU registers now that we're going to execute guest code. */
     4647    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    46864648    pCtx->fExtrn |= HMSVM_CPUMCTX_EXTRN_ALL | CPUMCTX_EXTRN_KEEPER_HM;
    46874649
     
    47284690 *
    47294691 * @param   pVCpu           The cross context virtual CPU structure.
    4730  * @param   pCtx       Pointer to the guest-CPU context. The data maybe
    4731  *                          out-of-sync. Make sure to update the required fields
    4732  *                          before using them.
    47334692 * @param   pSvmTransient   Pointer to the SVM transient structure.
    47344693 * @param   rcVMRun         Return code of VMRUN.
     
    47384697 *          unconditionally when it is safe to do so.
    47394698 */
    4740 static void hmR0SvmPostRunGuest(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient, int rcVMRun)
     4699static void hmR0SvmPostRunGuest(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient, int rcVMRun)
    47414700{
    47424701    Assert(!VMMRZCallRing3IsEnabled(pVCpu));
     
    47944753#ifdef HMSVM_SYNC_FULL_GUEST_STATE
    47954754    hmR0SvmImportGuestState(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    4796     Assert(!(pCtx->fExtrn & HMSVM_CPUMCTX_EXTRN_ALL));
     4755    Assert(!(pVCpu->cpum.GstCtx.fExtrn & HMSVM_CPUMCTX_EXTRN_ALL));
    47974756#else
    47984757    /*
     
    48414800
    48424801#ifdef DEBUG_ramshankar
    4843     if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     4802    if (CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx))
    48444803    {
    48454804        hmR0SvmImportGuestState(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    4846         hmR0SvmLogState(pVCpu, pVmcb, pCtx, "hmR0SvmPostRunGuestNested", HMSVM_LOG_ALL & ~HMSVM_LOG_LBR, 0 /* uVerbose */);
     4805        hmR0SvmLogState(pVCpu, pVmcb, pVCpu->cpum.GstCtx, "hmR0SvmPostRunGuestNested", HMSVM_LOG_ALL & ~HMSVM_LOG_LBR,
     4806                        0 /* uVerbose */);
    48474807    }
    48484808#endif
     
    48504810    HMSVM_CPUMCTX_ASSERT(pVCpu, CPUMCTX_EXTRN_CS | CPUMCTX_EXTRN_RIP);
    48514811    EMHistoryAddExit(pVCpu, EMEXIT_MAKE_FT(EMEXIT_F_KIND_SVM, pSvmTransient->u64ExitCode & EMEXIT_F_TYPE_MASK),
    4852                      pCtx->cs.u64Base + pCtx->rip, uHostTsc);
     4812                     pVCpu->cpum.GstCtx.cs.u64Base + pVCpu->cpum.GstCtx.rip, uHostTsc);
    48534813}
    48544814
     
    48594819 * @returns VBox status code.
    48604820 * @param   pVCpu       The cross context virtual CPU structure.
    4861  * @param   pCtx        Pointer to the guest-CPU context.
    48624821 * @param   pcLoops     Pointer to the number of executed loops.
    48634822 */
    4864 static int hmR0SvmRunGuestCodeNormal(PVMCPU pVCpu, PCPUMCTX pCtx, uint32_t *pcLoops)
     4823static int hmR0SvmRunGuestCodeNormal(PVMCPU pVCpu, uint32_t *pcLoops)
    48654824{
    48664825    uint32_t const cMaxResumeLoops = pVCpu->CTX_SUFF(pVM)->hm.s.cMaxResumeLoops;
     
    48824841           ring-3.  This bugger disables interrupts on VINF_SUCCESS! */
    48834842        STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatEntry, x);
    4884         rc = hmR0SvmPreRunGuest(pVCpu, pCtx, &SvmTransient);
     4843        rc = hmR0SvmPreRunGuest(pVCpu, &SvmTransient);
    48854844        if (rc != VINF_SUCCESS)
    48864845            break;
     
    48924851         * better than a kernel panic. This also disables flushing of the R0-logger instance.
    48934852         */
    4894         hmR0SvmPreRunGuestCommitted(pVCpu, pCtx, &SvmTransient);
    4895         rc = hmR0SvmRunGuest(pVCpu, pCtx, pVCpu->hm.s.svm.HCPhysVmcb);
     4853        hmR0SvmPreRunGuestCommitted(pVCpu, &SvmTransient);
     4854        rc = hmR0SvmRunGuest(pVCpu, pVCpu->hm.s.svm.HCPhysVmcb);
    48964855
    48974856        /* Restore any residual host-state and save any bits shared between host and guest
    48984857           into the guest-CPU state.  Re-enables interrupts! */
    4899         hmR0SvmPostRunGuest(pVCpu, pCtx, &SvmTransient, rc);
     4858        hmR0SvmPostRunGuest(pVCpu, &SvmTransient, rc);
    49004859
    49014860        if (RT_UNLIKELY(   rc != VINF_SUCCESS                               /* Check for VMRUN errors. */
     
    49054864                rc = VERR_SVM_INVALID_GUEST_STATE;
    49064865            STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatPreExit, x);
    4907             hmR0SvmReportWorldSwitchError(pVCpu, rc, pCtx);
     4866            hmR0SvmReportWorldSwitchError(pVCpu, rc);
    49084867            break;
    49094868        }
     
    49124871        HMSVM_EXITCODE_STAM_COUNTER_INC(SvmTransient.u64ExitCode);
    49134872        STAM_PROFILE_ADV_STOP_START(&pVCpu->hm.s.StatPreExit, &pVCpu->hm.s.StatExitHandling, x);
    4914         VBOXVMM_R0_HMSVM_VMEXIT(pVCpu, pCtx, SvmTransient.u64ExitCode, pVCpu->hm.s.svm.pVmcb);
    4915         rc = hmR0SvmHandleExit(pVCpu, pCtx, &SvmTransient);
     4873        VBOXVMM_R0_HMSVM_VMEXIT(pVCpu, &pVCpu->cpum.GstCtx, SvmTransient.u64ExitCode, pVCpu->hm.s.svm.pVmcb);
     4874        rc = hmR0SvmHandleExit(pVCpu, &SvmTransient);
    49164875        STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExitHandling, x);
    49174876        if (rc != VINF_SUCCESS)
     
    49354894 * @returns VBox status code.
    49364895 * @param   pVCpu       The cross context virtual CPU structure.
    4937  * @param   pCtx        Pointer to the guest-CPU context.
    49384896 * @param   pcLoops     Pointer to the number of executed loops.
    49394897 */
    4940 static int hmR0SvmRunGuestCodeStep(PVMCPU pVCpu, PCPUMCTX pCtx, uint32_t *pcLoops)
     4898static int hmR0SvmRunGuestCodeStep(PVMCPU pVCpu, uint32_t *pcLoops)
    49414899{
    49424900    uint32_t const cMaxResumeLoops = pVCpu->CTX_SUFF(pVM)->hm.s.cMaxResumeLoops;
     
    49494907    SvmTransient.pVmcb = pVCpu->hm.s.svm.pVmcb;
    49504908
     4909    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    49514910    uint16_t uCsStart  = pCtx->cs.Sel;
    49524911    uint64_t uRipStart = pCtx->rip;
     
    49634922           ring-3.  This bugger disables interrupts on VINF_SUCCESS! */
    49644923        STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatEntry, x);
    4965         rc = hmR0SvmPreRunGuest(pVCpu, pCtx, &SvmTransient);
     4924        rc = hmR0SvmPreRunGuest(pVCpu, &SvmTransient);
    49664925        if (rc != VINF_SUCCESS)
    49674926            break;
     
    49754934        VMMRZCallRing3Disable(pVCpu);
    49764935        VMMRZCallRing3RemoveNotification(pVCpu);
    4977         hmR0SvmPreRunGuestCommitted(pVCpu, pCtx, &SvmTransient);
    4978 
    4979         rc = hmR0SvmRunGuest(pVCpu, pCtx, pVCpu->hm.s.svm.HCPhysVmcb);
     4936        hmR0SvmPreRunGuestCommitted(pVCpu, &SvmTransient);
     4937
     4938        rc = hmR0SvmRunGuest(pVCpu, pVCpu->hm.s.svm.HCPhysVmcb);
    49804939
    49814940        /* Restore any residual host-state and save any bits shared between host and guest
    49824941           into the guest-CPU state.  Re-enables interrupts! */
    4983         hmR0SvmPostRunGuest(pVCpu, pCtx, &SvmTransient, rc);
     4942        hmR0SvmPostRunGuest(pVCpu, &SvmTransient, rc);
    49844943
    49854944        if (RT_UNLIKELY(   rc != VINF_SUCCESS                               /* Check for VMRUN errors. */
     
    49894948                rc = VERR_SVM_INVALID_GUEST_STATE;
    49904949            STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatPreExit, x);
    4991             hmR0SvmReportWorldSwitchError(pVCpu, rc, pCtx);
     4950            hmR0SvmReportWorldSwitchError(pVCpu, rc);
    49924951            return rc;
    49934952        }
     
    49974956        STAM_PROFILE_ADV_STOP_START(&pVCpu->hm.s.StatPreExit, &pVCpu->hm.s.StatExitHandling, x);
    49984957        VBOXVMM_R0_HMSVM_VMEXIT(pVCpu, pCtx, SvmTransient.u64ExitCode, pVCpu->hm.s.svm.pVmcb);
    4999         rc = hmR0SvmHandleExit(pVCpu, pCtx, &SvmTransient);
     4958        rc = hmR0SvmHandleExit(pVCpu, &SvmTransient);
    50004959        STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExitHandling, x);
    50014960        if (rc != VINF_SUCCESS)
     
    50404999 * @returns VBox status code.
    50415000 * @param   pVCpu       The cross context virtual CPU structure.
    5042  * @param   pCtx        Pointer to the guest-CPU context.
    50435001 * @param   pcLoops     Pointer to the number of executed loops. If we're switching
    50445002 *                      from the guest-code execution loop to this nested-guest
    50455003 *                      execution loop pass the remainder value, else pass 0.
    50465004 */
    5047 static int hmR0SvmRunGuestCodeNested(PVMCPU pVCpu, PCPUMCTX pCtx, uint32_t *pcLoops)
    5048 {
     5005static int hmR0SvmRunGuestCodeNested(PVMCPU pVCpu, uint32_t *pcLoops)
     5006{
     5007    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    50495008    HMSVM_ASSERT_IN_NESTED_GUEST(pCtx);
    50505009    Assert(pcLoops);
     
    50665025           ring-3.  This bugger disables interrupts on VINF_SUCCESS! */
    50675026        STAM_PROFILE_ADV_START(&pVCpu->hm.s.StatEntry, x);
    5068         rc = hmR0SvmPreRunGuestNested(pVCpu, pCtx, &SvmTransient);
     5027        rc = hmR0SvmPreRunGuestNested(pVCpu, &SvmTransient);
    50695028        if (    rc != VINF_SUCCESS
    50705029            || !CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     
    50795038         * better than a kernel panic. This also disables flushing of the R0-logger instance.
    50805039         */
    5081         hmR0SvmPreRunGuestCommitted(pVCpu, pCtx, &SvmTransient);
    5082 
    5083         rc = hmR0SvmRunGuest(pVCpu, pCtx, pCtx->hwvirt.svm.HCPhysVmcb);
     5040        hmR0SvmPreRunGuestCommitted(pVCpu, &SvmTransient);
     5041
     5042        rc = hmR0SvmRunGuest(pVCpu, pCtx->hwvirt.svm.HCPhysVmcb);
    50845043
    50855044        /* Restore any residual host-state and save any bits shared between host and guest
    50865045           into the guest-CPU state.  Re-enables interrupts! */
    5087         hmR0SvmPostRunGuest(pVCpu, pCtx, &SvmTransient, rc);
     5046        hmR0SvmPostRunGuest(pVCpu, &SvmTransient, rc);
    50885047
    50895048        if (RT_LIKELY(   rc == VINF_SUCCESS
     
    51075066        STAM_PROFILE_ADV_STOP_START(&pVCpu->hm.s.StatPreExit, &pVCpu->hm.s.StatExitHandling, x);
    51085067        VBOXVMM_R0_HMSVM_VMEXIT(pVCpu, pCtx, SvmTransient.u64ExitCode, pCtx->hwvirt.svm.CTX_SUFF(pVmcb));
    5109         rc = hmR0SvmHandleExitNested(pVCpu, pCtx, &SvmTransient);
     5068        rc = hmR0SvmHandleExitNested(pVCpu, &SvmTransient);
    51105069        STAM_PROFILE_ADV_STOP(&pVCpu->hm.s.StatExitHandling, x);
    51115070        if (    rc != VINF_SUCCESS
     
    51335092 * @returns Strict VBox status code.
    51345093 * @param   pVCpu       The cross context virtual CPU structure.
    5135  * @param   pCtx        Pointer to the guest-CPU context.
    5136  */
    5137 VMMR0DECL(VBOXSTRICTRC) SVMR0RunGuestCode(PVMCPU pVCpu, PCPUMCTX pCtx)
     5094 */
     5095VMMR0DECL(VBOXSTRICTRC) SVMR0RunGuestCode(PVMCPU pVCpu)
    51385096{
    51395097    Assert(VMMRZCallRing3IsEnabled(pVCpu));
    51405098    HMSVM_ASSERT_PREEMPT_SAFE(pVCpu);
    5141     VMMRZCallRing3SetNotification(pVCpu, hmR0SvmCallRing3Callback, pCtx);
     5099    VMMRZCallRing3SetNotification(pVCpu, hmR0SvmCallRing3Callback, NULL /* pvUser */);
    51425100
    51435101    uint32_t cLoops = 0;
    51445102    int      rc;
    51455103#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    5146     if (!CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     5104    if (!CPUMIsGuestInSvmNestedHwVirtMode(&pVCpu->cpum.GstCtx))
    51475105#endif
    51485106    {
    51495107        if (!pVCpu->hm.s.fSingleInstruction)
    5150             rc = hmR0SvmRunGuestCodeNormal(pVCpu, pCtx, &cLoops);
     5108            rc = hmR0SvmRunGuestCodeNormal(pVCpu, &cLoops);
    51515109        else
    5152             rc = hmR0SvmRunGuestCodeStep(pVCpu, pCtx, &cLoops);
     5110            rc = hmR0SvmRunGuestCodeStep(pVCpu, &cLoops);
    51535111    }
    51545112#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
     
    51625120    if (rc == VINF_SVM_VMRUN)
    51635121    {
    5164         rc = hmR0SvmRunGuestCodeNested(pVCpu, pCtx, &cLoops);
     5122        rc = hmR0SvmRunGuestCodeNested(pVCpu, &cLoops);
    51655123        if (rc == VINF_SVM_VMEXIT)
    51665124            rc = VINF_SUCCESS;
     
    51755133
    51765134    /* Prepare to return to ring-3. This will remove longjmp notifications. */
    5177     rc = hmR0SvmExitToRing3(pVCpu, pCtx, rc);
     5135    rc = hmR0SvmExitToRing3(pVCpu, rc);
    51785136    Assert(!VMMRZCallRing3IsNotificationSet(pVCpu));
    51795137    return rc;
     
    52095167 * @returns VBox status code (informational status codes included).
    52105168 * @param   pVCpu           The cross context virtual CPU structure.
    5211  * @param   pCtx            Pointer to the guest-CPU context.
    52125169 * @param   pSvmTransient   Pointer to the SVM transient structure.
    52135170 */
    5214 static int hmR0SvmHandleExitNested(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    5215 {
    5216     HMSVM_ASSERT_IN_NESTED_GUEST(pCtx);
     5171static int hmR0SvmHandleExitNested(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     5172{
     5173    HMSVM_ASSERT_IN_NESTED_GUEST(&pVCpu->cpum.GstCtx);
    52175174    Assert(pSvmTransient->u64ExitCode != SVM_EXIT_INVALID);
    52185175    Assert(pSvmTransient->u64ExitCode <= SVM_EXIT_MAX);
     
    52215178     *        HMSVM_CPUMCTX_EXTRN_ALL breaks nested guests (XP Pro, DSL etc.), see
    52225179     *        also HMSvmNstGstVmExitNotify(). */
    5223 #define NST_GST_VMEXIT_CALL_RET(a_pVCpu, a_pCtx, a_uExitCode, a_uExitInfo1, a_uExitInfo2) \
     5180#define NST_GST_VMEXIT_CALL_RET(a_pVCpu, a_uExitCode, a_uExitInfo1, a_uExitInfo2) \
    52245181    do { \
    52255182        HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL); \
     
    52315188     * nested-guest. If it isn't, it should be handled by the (outer) guest.
    52325189     */
    5233     PSVMVMCB       pVmcbNstGst     = pCtx->hwvirt.svm.CTX_SUFF(pVmcb);
     5190    PSVMVMCB       pVmcbNstGst     = pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pVmcb);
    52345191    PSVMVMCBCTRL   pVmcbNstGstCtrl = &pVmcbNstGst->ctrl;
    52355192    uint64_t const uExitCode       = pVmcbNstGstCtrl->u64ExitCode;
     
    52435200        {
    52445201            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_CPUID))
    5245                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5246             return hmR0SvmExitCpuid(pVCpu, pCtx, pSvmTransient);
     5202                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5203            return hmR0SvmExitCpuid(pVCpu, pSvmTransient);
    52475204        }
    52485205
     
    52505207        {
    52515208            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_RDTSC))
    5252                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5253             return hmR0SvmExitRdtsc(pVCpu, pCtx, pSvmTransient);
     5209                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5210            return hmR0SvmExitRdtsc(pVCpu, pSvmTransient);
    52545211        }
    52555212
     
    52575214        {
    52585215            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_RDTSCP))
    5259                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5260             return hmR0SvmExitRdtscp(pVCpu, pCtx, pSvmTransient);
     5216                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5217            return hmR0SvmExitRdtscp(pVCpu, pSvmTransient);
    52615218        }
    52625219
     
    52645221        {
    52655222            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_MONITOR))
    5266                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5267             return hmR0SvmExitMonitor(pVCpu, pCtx, pSvmTransient);
     5223                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5224            return hmR0SvmExitMonitor(pVCpu, pSvmTransient);
    52685225        }
    52695226
     
    52715228        {
    52725229            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_MWAIT))
    5273                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5274             return hmR0SvmExitMwait(pVCpu, pCtx, pSvmTransient);
     5230                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5231            return hmR0SvmExitMwait(pVCpu, pSvmTransient);
    52755232        }
    52765233
     
    52785235        {
    52795236            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_HLT))
    5280                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5281             return hmR0SvmExitHlt(pVCpu, pCtx, pSvmTransient);
     5237                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5238            return hmR0SvmExitHlt(pVCpu, pSvmTransient);
    52825239        }
    52835240
     
    52865243            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_MSR_PROT))
    52875244            {
    5288                 uint32_t const idMsr = pCtx->ecx;
     5245                uint32_t const idMsr = pVCpu->cpum.GstCtx.ecx;
    52895246                uint16_t offMsrpm;
    52905247                uint8_t  uMsrpmBit;
     
    52955252                    Assert(offMsrpm < SVM_MSRPM_PAGES << X86_PAGE_4K_SHIFT);
    52965253
    5297                     uint8_t const *pbMsrBitmap = (uint8_t const *)pCtx->hwvirt.svm.CTX_SUFF(pvMsrBitmap);
     5254                    uint8_t const *pbMsrBitmap = (uint8_t const *)pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pvMsrBitmap);
    52985255                    pbMsrBitmap               += offMsrpm;
    52995256                    bool const fInterceptRead  = RT_BOOL(*pbMsrBitmap & RT_BIT(uMsrpmBit));
     
    53035260                        || (fInterceptRead  && pVmcbNstGstCtrl->u64ExitInfo1 == SVM_EXIT1_MSR_READ))
    53045261                    {
    5305                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
     5262                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
    53065263                    }
    53075264                }
     
    53135270                     */
    53145271                    Assert(rc == VERR_OUT_OF_RANGE);
    5315                     NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
     5272                    NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
    53165273                }
    53175274            }
    5318             return hmR0SvmExitMsr(pVCpu, pCtx, pSvmTransient);
     5275            return hmR0SvmExitMsr(pVCpu, pSvmTransient);
    53195276        }
    53205277
     
    53235280            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_IOIO_PROT))
    53245281            {
    5325                 void *pvIoBitmap = pCtx->hwvirt.svm.CTX_SUFF(pvIoBitmap);
     5282                void *pvIoBitmap = pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pvIoBitmap);
    53265283                SVMIOIOEXITINFO IoExitInfo;
    53275284                IoExitInfo.u = pVmcbNstGst->ctrl.u64ExitInfo1;
    53285285                bool const fIntercept = hmR0SvmIsIoInterceptActive(pvIoBitmap, &IoExitInfo);
    53295286                if (fIntercept)
    5330                     NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
     5287                    NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
    53315288            }
    5332             return hmR0SvmExitIOInstr(pVCpu, pCtx, pSvmTransient);
     5289            return hmR0SvmExitIOInstr(pVCpu, pSvmTransient);
    53335290        }
    53345291
     
    53435300                /* If the nested-guest is intercepting #PFs, cause a #PF #VMEXIT. */
    53445301                if (HMIsGuestSvmXcptInterceptSet(pVCpu, X86_XCPT_PF))
    5345                     NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, u32ErrCode, uFaultAddress);
     5302                    NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, u32ErrCode, uFaultAddress);
    53465303
    53475304                /* If the nested-guest is not intercepting #PFs, forward the #PF to the guest. */
    53485305                HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_CR2);
    5349                 hmR0SvmSetPendingXcptPF(pVCpu, pCtx, u32ErrCode, uFaultAddress);
     5306                hmR0SvmSetPendingXcptPF(pVCpu, u32ErrCode, uFaultAddress);
    53505307                return VINF_SUCCESS;
    53515308            }
    5352             return hmR0SvmExitXcptPF(pVCpu, pCtx,pSvmTransient);
     5309            return hmR0SvmExitXcptPF(pVCpu, pSvmTransient);
    53535310        }
    53545311
     
    53565313        {
    53575314            if (HMIsGuestSvmXcptInterceptSet(pVCpu, X86_XCPT_UD))
    5358                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
     5315                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
    53595316            hmR0SvmSetPendingXcptUD(pVCpu);
    53605317            return VINF_SUCCESS;
     
    53645321        {
    53655322            if (HMIsGuestSvmXcptInterceptSet(pVCpu, X86_XCPT_MF))
    5366                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5367             return hmR0SvmExitXcptMF(pVCpu, pCtx, pSvmTransient);
     5323                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5324            return hmR0SvmExitXcptMF(pVCpu, pSvmTransient);
    53685325        }
    53695326
     
    53715328        {
    53725329            if (HMIsGuestSvmXcptInterceptSet(pVCpu, X86_XCPT_DB))
    5373                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5374             return hmR0SvmNestedExitXcptDB(pVCpu, pCtx, pSvmTransient);
     5330                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5331            return hmR0SvmNestedExitXcptDB(pVCpu, pSvmTransient);
    53755332        }
    53765333
     
    53785335        {
    53795336            if (HMIsGuestSvmXcptInterceptSet(pVCpu, X86_XCPT_AC))
    5380                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5381             return hmR0SvmExitXcptAC(pVCpu, pCtx, pSvmTransient);
     5337                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5338            return hmR0SvmExitXcptAC(pVCpu, pSvmTransient);
    53825339        }
    53835340
     
    53855342        {
    53865343            if (HMIsGuestSvmXcptInterceptSet(pVCpu, X86_XCPT_BP))
    5387                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5388             return hmR0SvmNestedExitXcptBP(pVCpu, pCtx, pSvmTransient);
     5344                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5345            return hmR0SvmNestedExitXcptBP(pVCpu, pSvmTransient);
    53895346        }
    53905347
     
    53955352            uint8_t const uCr = uExitCode - SVM_EXIT_READ_CR0;
    53965353            if (HMIsGuestSvmReadCRxInterceptSet(pVCpu, uCr))
    5397                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5398             return hmR0SvmExitReadCRx(pVCpu, pCtx, pSvmTransient);
     5354                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5355            return hmR0SvmExitReadCRx(pVCpu, pSvmTransient);
    53995356        }
    54005357
     
    54025359        {
    54035360            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_CR0_SEL_WRITE))
    5404                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5405             return hmR0SvmExitWriteCRx(pVCpu, pCtx, pSvmTransient);
     5361                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5362            return hmR0SvmExitWriteCRx(pVCpu, pSvmTransient);
    54065363        }
    54075364
     
    54155372
    54165373            if (HMIsGuestSvmWriteCRxInterceptSet(pVCpu, uCr))
    5417                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5418             return hmR0SvmExitWriteCRx(pVCpu, pCtx, pSvmTransient);
     5374                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5375            return hmR0SvmExitWriteCRx(pVCpu, pSvmTransient);
    54195376        }
    54205377
     
    54225379        {
    54235380            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_PAUSE))
    5424                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5425             return hmR0SvmExitPause(pVCpu, pCtx, pSvmTransient);
     5381                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5382            return hmR0SvmExitPause(pVCpu, pSvmTransient);
    54265383        }
    54275384
     
    54295386        {
    54305387            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_VINTR))
    5431                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5432             return hmR0SvmExitUnexpected(pVCpu, pCtx, pSvmTransient);
     5388                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5389            return hmR0SvmExitUnexpected(pVCpu, pSvmTransient);
    54335390        }
    54345391
     
    54465403             */
    54475404            HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_SVM_VMEXIT_MASK);
    5448             return hmR0SvmExitIntr(pVCpu, pCtx, pSvmTransient);
     5405            return hmR0SvmExitIntr(pVCpu, pSvmTransient);
    54495406        }
    54505407
     
    54525409        {
    54535410            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_FERR_FREEZE))
    5454                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5455             return hmR0SvmExitFerrFreeze(pVCpu, pCtx, pSvmTransient);
     5411                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5412            return hmR0SvmExitFerrFreeze(pVCpu, pSvmTransient);
    54565413        }
    54575414
     
    54595416        {
    54605417            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_INVLPG))
    5461                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5462             return hmR0SvmExitInvlpg(pVCpu, pCtx, pSvmTransient);
     5418                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5419            return hmR0SvmExitInvlpg(pVCpu, pSvmTransient);
    54635420        }
    54645421
     
    54665423        {
    54675424            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_WBINVD))
    5468                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5469             return hmR0SvmExitWbinvd(pVCpu, pCtx, pSvmTransient);
     5425                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5426            return hmR0SvmExitWbinvd(pVCpu, pSvmTransient);
    54705427        }
    54715428
     
    54735430        {
    54745431            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_INVD))
    5475                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5476             return hmR0SvmExitInvd(pVCpu, pCtx, pSvmTransient);
     5432                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5433            return hmR0SvmExitInvd(pVCpu, pSvmTransient);
    54775434        }
    54785435
     
    54805437        {
    54815438            if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_RDPMC))
    5482                 NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5483             return hmR0SvmExitRdpmc(pVCpu, pCtx, pSvmTransient);
     5439                NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5440            return hmR0SvmExitRdpmc(pVCpu, pSvmTransient);
    54845441        }
    54855442
     
    54955452                    uint8_t const uDr = uExitCode - SVM_EXIT_READ_DR0;
    54965453                    if (HMIsGuestSvmReadDRxInterceptSet(pVCpu, uDr))
    5497                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5498                     return hmR0SvmExitReadDRx(pVCpu, pCtx, pSvmTransient);
     5454                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5455                    return hmR0SvmExitReadDRx(pVCpu, pSvmTransient);
    54995456                }
    55005457
     
    55065463                    uint8_t const uDr = uExitCode - SVM_EXIT_WRITE_DR0;
    55075464                    if (HMIsGuestSvmWriteDRxInterceptSet(pVCpu, uDr))
    5508                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5509                     return hmR0SvmExitWriteDRx(pVCpu, pCtx, pSvmTransient);
     5465                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5466                    return hmR0SvmExitWriteDRx(pVCpu, pSvmTransient);
    55105467                }
    55115468
     
    55365493                    uint8_t const uVector = uExitCode - SVM_EXIT_XCPT_0;
    55375494                    if (HMIsGuestSvmXcptInterceptSet(pVCpu, uVector))
    5538                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5539                     return hmR0SvmExitXcptGeneric(pVCpu, pCtx, pSvmTransient);
     5495                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5496                    return hmR0SvmExitXcptGeneric(pVCpu, pSvmTransient);
    55405497                }
    55415498
     
    55435500                {
    55445501                    if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_XSETBV))
    5545                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5546                     return hmR0SvmExitXsetbv(pVCpu, pCtx, pSvmTransient);
     5502                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5503                    return hmR0SvmExitXsetbv(pVCpu, pSvmTransient);
    55475504                }
    55485505
     
    55505507                {
    55515508                    if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_TASK_SWITCH))
    5552                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5553                     return hmR0SvmExitTaskSwitch(pVCpu, pCtx, pSvmTransient);
     5509                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5510                    return hmR0SvmExitTaskSwitch(pVCpu, pSvmTransient);
    55545511                }
    55555512
     
    55575514                {
    55585515                    if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_IRET))
    5559                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5560                     return hmR0SvmExitIret(pVCpu, pCtx, pSvmTransient);
     5516                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5517                    return hmR0SvmExitIret(pVCpu, pSvmTransient);
    55615518                }
    55625519
     
    55645521                {
    55655522                    if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_SHUTDOWN))
    5566                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5567                     return hmR0SvmExitShutdown(pVCpu, pCtx, pSvmTransient);
     5523                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5524                    return hmR0SvmExitShutdown(pVCpu, pSvmTransient);
    55685525                }
    55695526
     
    55715528                {
    55725529                    if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_VMMCALL))
    5573                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5574                     return hmR0SvmExitVmmCall(pVCpu, pCtx, pSvmTransient);
     5530                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5531                    return hmR0SvmExitVmmCall(pVCpu, pSvmTransient);
    55755532                }
    55765533
     
    55785535                {
    55795536                    if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_CLGI))
    5580                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5581                      return hmR0SvmExitClgi(pVCpu, pCtx, pSvmTransient);
     5537                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5538                     return hmR0SvmExitClgi(pVCpu, pSvmTransient);
    55825539                }
    55835540
     
    55855542                {
    55865543                    if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_STGI))
    5587                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5588                      return hmR0SvmExitStgi(pVCpu, pCtx, pSvmTransient);
     5544                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5545                     return hmR0SvmExitStgi(pVCpu, pSvmTransient);
    55895546                }
    55905547
     
    55925549                {
    55935550                    if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_VMLOAD))
    5594                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5595                     return hmR0SvmExitVmload(pVCpu, pCtx, pSvmTransient);
     5551                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5552                    return hmR0SvmExitVmload(pVCpu, pSvmTransient);
    55965553                }
    55975554
     
    55995556                {
    56005557                    if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_VMSAVE))
    5601                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5602                     return hmR0SvmExitVmsave(pVCpu, pCtx, pSvmTransient);
     5558                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5559                    return hmR0SvmExitVmsave(pVCpu, pSvmTransient);
    56035560                }
    56045561
     
    56065563                {
    56075564                    if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_INVLPGA))
    5608                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5609                     return hmR0SvmExitInvlpga(pVCpu, pCtx, pSvmTransient);
     5565                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5566                    return hmR0SvmExitInvlpga(pVCpu, pSvmTransient);
    56105567                }
    56115568
     
    56135570                {
    56145571                    if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_VMRUN))
    5615                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
    5616                     return hmR0SvmExitVmrun(pVCpu, pCtx, pSvmTransient);
     5572                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
     5573                    return hmR0SvmExitVmrun(pVCpu, pSvmTransient);
    56175574                }
    56185575
     
    56205577                {
    56215578                    if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_RSM))
    5622                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
     5579                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
    56235580                    hmR0SvmSetPendingXcptUD(pVCpu);
    56245581                    return VINF_SUCCESS;
     
    56285585                {
    56295586                    if (HMIsGuestSvmCtrlInterceptSet(pVCpu, SVM_CTRL_INTERCEPT_SKINIT))
    5630                         NST_GST_VMEXIT_CALL_RET(pVCpu, pCtx, uExitCode, uExitInfo1, uExitInfo2);
     5587                        NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2);
    56315588                    hmR0SvmSetPendingXcptUD(pVCpu);
    56325589                    return VINF_SUCCESS;
     
    56365593                {
    56375594                    Assert(pVCpu->CTX_SUFF(pVM)->hm.s.fNestedPaging);
    5638                     return hmR0SvmExitNestedPF(pVCpu, pCtx, pSvmTransient);
     5595                    return hmR0SvmExitNestedPF(pVCpu, pSvmTransient);
    56395596                }
    56405597
    56415598                case SVM_EXIT_INIT:  /* We shouldn't get INIT signals while executing a nested-guest. */
    5642                     return hmR0SvmExitUnexpected(pVCpu, pCtx, pSvmTransient);
     5599                    return hmR0SvmExitUnexpected(pVCpu, pSvmTransient);
    56435600
    56445601                default:
     
    56635620 * @returns VBox status code (informational status codes included).
    56645621 * @param   pVCpu           The cross context virtual CPU structure.
    5665  * @param   pCtx            Pointer to the guest-CPU context.
    56665622 * @param   pSvmTransient   Pointer to the SVM transient structure.
    56675623 */
    5668 static int hmR0SvmHandleExit(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
     5624static int hmR0SvmHandleExit(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
    56695625{
    56705626    Assert(pSvmTransient->u64ExitCode != SVM_EXIT_INVALID);
     
    56925648    switch (uExitCode)
    56935649    {
    5694         case SVM_EXIT_NPF:          VMEXIT_CALL_RET(0, hmR0SvmExitNestedPF(pVCpu, pCtx, pSvmTransient));
    5695         case SVM_EXIT_IOIO:         VMEXIT_CALL_RET(0, hmR0SvmExitIOInstr(pVCpu, pCtx, pSvmTransient));
    5696         case SVM_EXIT_RDTSC:        VMEXIT_CALL_RET(0, hmR0SvmExitRdtsc(pVCpu, pCtx, pSvmTransient));
    5697         case SVM_EXIT_RDTSCP:       VMEXIT_CALL_RET(0, hmR0SvmExitRdtscp(pVCpu, pCtx, pSvmTransient));
    5698         case SVM_EXIT_CPUID:        VMEXIT_CALL_RET(0, hmR0SvmExitCpuid(pVCpu, pCtx, pSvmTransient));
    5699         case SVM_EXIT_XCPT_PF:      VMEXIT_CALL_RET(0, hmR0SvmExitXcptPF(pVCpu, pCtx, pSvmTransient));
    5700         case SVM_EXIT_MSR:          VMEXIT_CALL_RET(0, hmR0SvmExitMsr(pVCpu, pCtx, pSvmTransient));
    5701         case SVM_EXIT_MONITOR:      VMEXIT_CALL_RET(0, hmR0SvmExitMonitor(pVCpu, pCtx, pSvmTransient));
    5702         case SVM_EXIT_MWAIT:        VMEXIT_CALL_RET(0, hmR0SvmExitMwait(pVCpu, pCtx, pSvmTransient));
    5703         case SVM_EXIT_HLT:          VMEXIT_CALL_RET(0, hmR0SvmExitHlt(pVCpu, pCtx, pSvmTransient));
     5650        case SVM_EXIT_NPF:          VMEXIT_CALL_RET(0, hmR0SvmExitNestedPF(pVCpu, pSvmTransient));
     5651        case SVM_EXIT_IOIO:         VMEXIT_CALL_RET(0, hmR0SvmExitIOInstr(pVCpu, pSvmTransient));
     5652        case SVM_EXIT_RDTSC:        VMEXIT_CALL_RET(0, hmR0SvmExitRdtsc(pVCpu, pSvmTransient));
     5653        case SVM_EXIT_RDTSCP:       VMEXIT_CALL_RET(0, hmR0SvmExitRdtscp(pVCpu, pSvmTransient));
     5654        case SVM_EXIT_CPUID:        VMEXIT_CALL_RET(0, hmR0SvmExitCpuid(pVCpu, pSvmTransient));
     5655        case SVM_EXIT_XCPT_PF:      VMEXIT_CALL_RET(0, hmR0SvmExitXcptPF(pVCpu, pSvmTransient));
     5656        case SVM_EXIT_MSR:          VMEXIT_CALL_RET(0, hmR0SvmExitMsr(pVCpu, pSvmTransient));
     5657        case SVM_EXIT_MONITOR:      VMEXIT_CALL_RET(0, hmR0SvmExitMonitor(pVCpu, pSvmTransient));
     5658        case SVM_EXIT_MWAIT:        VMEXIT_CALL_RET(0, hmR0SvmExitMwait(pVCpu, pSvmTransient));
     5659        case SVM_EXIT_HLT:          VMEXIT_CALL_RET(0, hmR0SvmExitHlt(pVCpu, pSvmTransient));
    57045660
    57055661        case SVM_EXIT_XCPT_NMI:     /* Should not occur, SVM_EXIT_NMI is used instead. */
    57065662        case SVM_EXIT_INTR:
    5707         case SVM_EXIT_NMI:          VMEXIT_CALL_RET(0, hmR0SvmExitIntr(pVCpu, pCtx, pSvmTransient));
     5663        case SVM_EXIT_NMI:          VMEXIT_CALL_RET(0, hmR0SvmExitIntr(pVCpu, pSvmTransient));
    57085664
    57095665        case SVM_EXIT_READ_CR0:
    57105666        case SVM_EXIT_READ_CR3:
    5711         case SVM_EXIT_READ_CR4:     VMEXIT_CALL_RET(0, hmR0SvmExitReadCRx(pVCpu, pCtx, pSvmTransient));
     5667        case SVM_EXIT_READ_CR4:     VMEXIT_CALL_RET(0, hmR0SvmExitReadCRx(pVCpu, pSvmTransient));
    57125668
    57135669        case SVM_EXIT_CR0_SEL_WRITE:
     
    57155671        case SVM_EXIT_WRITE_CR3:
    57165672        case SVM_EXIT_WRITE_CR4:
    5717         case SVM_EXIT_WRITE_CR8:    VMEXIT_CALL_RET(0, hmR0SvmExitWriteCRx(pVCpu, pCtx, pSvmTransient));
    5718 
    5719         case SVM_EXIT_VINTR:        VMEXIT_CALL_RET(0, hmR0SvmExitVIntr(pVCpu, pCtx, pSvmTransient));
    5720         case SVM_EXIT_PAUSE:        VMEXIT_CALL_RET(0, hmR0SvmExitPause(pVCpu, pCtx, pSvmTransient));
    5721         case SVM_EXIT_VMMCALL:      VMEXIT_CALL_RET(0, hmR0SvmExitVmmCall(pVCpu, pCtx, pSvmTransient));
    5722         case SVM_EXIT_INVLPG:       VMEXIT_CALL_RET(0, hmR0SvmExitInvlpg(pVCpu, pCtx, pSvmTransient));
    5723         case SVM_EXIT_WBINVD:       VMEXIT_CALL_RET(0, hmR0SvmExitWbinvd(pVCpu, pCtx, pSvmTransient));
    5724         case SVM_EXIT_INVD:         VMEXIT_CALL_RET(0, hmR0SvmExitInvd(pVCpu, pCtx, pSvmTransient));
    5725         case SVM_EXIT_RDPMC:        VMEXIT_CALL_RET(0, hmR0SvmExitRdpmc(pVCpu, pCtx, pSvmTransient));
    5726         case SVM_EXIT_IRET:         VMEXIT_CALL_RET(0, hmR0SvmExitIret(pVCpu, pCtx, pSvmTransient));
    5727         case SVM_EXIT_XCPT_UD:      VMEXIT_CALL_RET(0, hmR0SvmExitXcptUD(pVCpu, pCtx, pSvmTransient));
    5728         case SVM_EXIT_XCPT_MF:      VMEXIT_CALL_RET(0, hmR0SvmExitXcptMF(pVCpu, pCtx, pSvmTransient));
    5729         case SVM_EXIT_XCPT_DB:      VMEXIT_CALL_RET(0, hmR0SvmExitXcptDB(pVCpu, pCtx, pSvmTransient));
    5730         case SVM_EXIT_XCPT_AC:      VMEXIT_CALL_RET(0, hmR0SvmExitXcptAC(pVCpu, pCtx, pSvmTransient));
    5731         case SVM_EXIT_XCPT_BP:      VMEXIT_CALL_RET(0, hmR0SvmExitXcptBP(pVCpu, pCtx, pSvmTransient));
    5732         case SVM_EXIT_XSETBV:       VMEXIT_CALL_RET(0, hmR0SvmExitXsetbv(pVCpu, pCtx, pSvmTransient));
    5733         case SVM_EXIT_FERR_FREEZE:  VMEXIT_CALL_RET(0, hmR0SvmExitFerrFreeze(pVCpu, pCtx, pSvmTransient));
     5673        case SVM_EXIT_WRITE_CR8:    VMEXIT_CALL_RET(0, hmR0SvmExitWriteCRx(pVCpu, pSvmTransient));
     5674
     5675        case SVM_EXIT_VINTR:        VMEXIT_CALL_RET(0, hmR0SvmExitVIntr(pVCpu, pSvmTransient));
     5676        case SVM_EXIT_PAUSE:        VMEXIT_CALL_RET(0, hmR0SvmExitPause(pVCpu, pSvmTransient));
     5677        case SVM_EXIT_VMMCALL:      VMEXIT_CALL_RET(0, hmR0SvmExitVmmCall(pVCpu, pSvmTransient));
     5678        case SVM_EXIT_INVLPG:       VMEXIT_CALL_RET(0, hmR0SvmExitInvlpg(pVCpu, pSvmTransient));
     5679        case SVM_EXIT_WBINVD:       VMEXIT_CALL_RET(0, hmR0SvmExitWbinvd(pVCpu, pSvmTransient));
     5680        case SVM_EXIT_INVD:         VMEXIT_CALL_RET(0, hmR0SvmExitInvd(pVCpu, pSvmTransient));
     5681        case SVM_EXIT_RDPMC:        VMEXIT_CALL_RET(0, hmR0SvmExitRdpmc(pVCpu, pSvmTransient));
     5682        case SVM_EXIT_IRET:         VMEXIT_CALL_RET(0, hmR0SvmExitIret(pVCpu, pSvmTransient));
     5683        case SVM_EXIT_XCPT_UD:      VMEXIT_CALL_RET(0, hmR0SvmExitXcptUD(pVCpu, pSvmTransient));
     5684        case SVM_EXIT_XCPT_MF:      VMEXIT_CALL_RET(0, hmR0SvmExitXcptMF(pVCpu, pSvmTransient));
     5685        case SVM_EXIT_XCPT_DB:      VMEXIT_CALL_RET(0, hmR0SvmExitXcptDB(pVCpu, pSvmTransient));
     5686        case SVM_EXIT_XCPT_AC:      VMEXIT_CALL_RET(0, hmR0SvmExitXcptAC(pVCpu, pSvmTransient));
     5687        case SVM_EXIT_XCPT_BP:      VMEXIT_CALL_RET(0, hmR0SvmExitXcptBP(pVCpu, pSvmTransient));
     5688        case SVM_EXIT_XSETBV:       VMEXIT_CALL_RET(0, hmR0SvmExitXsetbv(pVCpu, pSvmTransient));
     5689        case SVM_EXIT_FERR_FREEZE:  VMEXIT_CALL_RET(0, hmR0SvmExitFerrFreeze(pVCpu, pSvmTransient));
    57345690
    57355691        default:
     
    57415697                case SVM_EXIT_READ_DR10:    case SVM_EXIT_READ_DR11:    case SVM_EXIT_READ_DR12:    case SVM_EXIT_READ_DR13:
    57425698                case SVM_EXIT_READ_DR14:    case SVM_EXIT_READ_DR15:
    5743                     VMEXIT_CALL_RET(0, hmR0SvmExitReadDRx(pVCpu, pCtx, pSvmTransient));
     5699                    VMEXIT_CALL_RET(0, hmR0SvmExitReadDRx(pVCpu, pSvmTransient));
    57445700
    57455701                case SVM_EXIT_WRITE_DR0:    case SVM_EXIT_WRITE_DR1:    case SVM_EXIT_WRITE_DR2:    case SVM_EXIT_WRITE_DR3:
     
    57475703                case SVM_EXIT_WRITE_DR10:   case SVM_EXIT_WRITE_DR11:   case SVM_EXIT_WRITE_DR12:   case SVM_EXIT_WRITE_DR13:
    57485704                case SVM_EXIT_WRITE_DR14:   case SVM_EXIT_WRITE_DR15:
    5749                     VMEXIT_CALL_RET(0, hmR0SvmExitWriteDRx(pVCpu, pCtx, pSvmTransient));
    5750 
    5751                 case SVM_EXIT_TASK_SWITCH:  VMEXIT_CALL_RET(0, hmR0SvmExitTaskSwitch(pVCpu, pCtx, pSvmTransient));
    5752                 case SVM_EXIT_SHUTDOWN:     VMEXIT_CALL_RET(0, hmR0SvmExitShutdown(pVCpu, pCtx, pSvmTransient));
     5705                    VMEXIT_CALL_RET(0, hmR0SvmExitWriteDRx(pVCpu, pSvmTransient));
     5706
     5707                case SVM_EXIT_TASK_SWITCH:  VMEXIT_CALL_RET(0, hmR0SvmExitTaskSwitch(pVCpu, pSvmTransient));
     5708                case SVM_EXIT_SHUTDOWN:     VMEXIT_CALL_RET(0, hmR0SvmExitShutdown(pVCpu, pSvmTransient));
    57535709
    57545710                case SVM_EXIT_SMI:
     
    57595715                     * If it ever does, we want to know about it so log the exit code and bail.
    57605716                     */
    5761                     VMEXIT_CALL_RET(0, hmR0SvmExitUnexpected(pVCpu, pCtx, pSvmTransient));
     5717                    VMEXIT_CALL_RET(0, hmR0SvmExitUnexpected(pVCpu, pSvmTransient));
    57625718                }
    57635719
    57645720#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
    5765                 case SVM_EXIT_CLGI:     VMEXIT_CALL_RET(0, hmR0SvmExitClgi(pVCpu, pCtx, pSvmTransient));
    5766                 case SVM_EXIT_STGI:     VMEXIT_CALL_RET(0, hmR0SvmExitStgi(pVCpu, pCtx, pSvmTransient));
    5767                 case SVM_EXIT_VMLOAD:   VMEXIT_CALL_RET(0, hmR0SvmExitVmload(pVCpu, pCtx, pSvmTransient));
    5768                 case SVM_EXIT_VMSAVE:   VMEXIT_CALL_RET(0, hmR0SvmExitVmsave(pVCpu, pCtx, pSvmTransient));
    5769                 case SVM_EXIT_INVLPGA:  VMEXIT_CALL_RET(0, hmR0SvmExitInvlpga(pVCpu, pCtx, pSvmTransient));
    5770                 case SVM_EXIT_VMRUN:    VMEXIT_CALL_RET(0, hmR0SvmExitVmrun(pVCpu, pCtx, pSvmTransient));
     5721                case SVM_EXIT_CLGI:     VMEXIT_CALL_RET(0, hmR0SvmExitClgi(pVCpu, pSvmTransient));
     5722                case SVM_EXIT_STGI:     VMEXIT_CALL_RET(0, hmR0SvmExitStgi(pVCpu, pSvmTransient));
     5723                case SVM_EXIT_VMLOAD:   VMEXIT_CALL_RET(0, hmR0SvmExitVmload(pVCpu, pSvmTransient));
     5724                case SVM_EXIT_VMSAVE:   VMEXIT_CALL_RET(0, hmR0SvmExitVmsave(pVCpu, pSvmTransient));
     5725                case SVM_EXIT_INVLPGA:  VMEXIT_CALL_RET(0, hmR0SvmExitInvlpga(pVCpu, pSvmTransient));
     5726                case SVM_EXIT_VMRUN:    VMEXIT_CALL_RET(0, hmR0SvmExitVmrun(pVCpu, pSvmTransient));
    57715727#else
    57725728                case SVM_EXIT_CLGI:
     
    58085764                case SVM_EXIT_XCPT_24: case SVM_EXIT_XCPT_25: case SVM_EXIT_XCPT_26: case SVM_EXIT_XCPT_27:
    58095765                case SVM_EXIT_XCPT_28: case SVM_EXIT_XCPT_29: case SVM_EXIT_XCPT_30: case SVM_EXIT_XCPT_31:
    5810                     VMEXIT_CALL_RET(0, hmR0SvmExitXcptGeneric(pVCpu, pCtx, pSvmTransient));
     5766                    VMEXIT_CALL_RET(0, hmR0SvmExitXcptGeneric(pVCpu, pSvmTransient));
    58115767#endif  /* HMSVM_ALWAYS_TRAP_ALL_XCPTS */
    58125768
     
    58255781
    58265782
    5827 #ifdef DEBUG
     5783#ifdef VBOX_STRICT
    58285784/* Is there some generic IPRT define for this that are not in Runtime/internal/\* ?? */
    58295785# define HMSVM_ASSERT_PREEMPT_CPUID_VAR() \
     
    58375793    } while (0)
    58385794
    5839 # define HMSVM_VALIDATE_EXIT_HANDLER_PARAMS() \
     5795# define HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(a_pVCpu, a_pSvmTransient) \
    58405796    do { \
    5841         AssertPtr(pVCpu); \
    5842         AssertPtr(pCtx); \
    5843         AssertPtr(pSvmTransient); \
     5797        AssertPtr((a_pVCpu)); \
     5798        AssertPtr((a_pSvmTransient)); \
    58445799        Assert(ASMIntAreEnabled()); \
    5845         HMSVM_ASSERT_PREEMPT_SAFE(pVCpu); \
     5800        HMSVM_ASSERT_PREEMPT_SAFE((a_pVCpu)); \
    58465801        HMSVM_ASSERT_PREEMPT_CPUID_VAR(); \
    5847         Log4Func(("vcpu[%u] -v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-\n", (uint32_t)pVCpu->idCpu)); \
    5848         HMSVM_ASSERT_PREEMPT_SAFE(pVCpu); \
    5849         if (VMMR0IsLogFlushDisabled(pVCpu)) \
     5802        Log4Func(("vcpu[%u] -v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-v-\n", (a_pVCpu)->idCpu)); \
     5803        HMSVM_ASSERT_PREEMPT_SAFE((a_pVCpu)); \
     5804        if (VMMR0IsLogFlushDisabled((a_pVCpu))) \
    58505805            HMSVM_ASSERT_PREEMPT_CPUID(); \
    58515806    } while (0)
    5852 #else   /* Release builds */
    5853 # define HMSVM_VALIDATE_EXIT_HANDLER_PARAMS() do { NOREF(pVCpu); NOREF(pCtx); NOREF(pSvmTransient); } while (0)
     5807#else
     5808# define HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(a_pVCpu, a_pSvmTransient) \
     5809    do { \
     5810        RT_NOREF2(a_pVCpu, a_pSvmTransient); \
     5811    } while (0)
    58545812#endif
    58555813
     
    59215879 *
    59225880 * @param   pVCpu           The cross context virtual CPU structure.
    5923  * @param   pCtx            Pointer to the guest-CPU context.
    59245881 * @param   pSvmTransient   Pointer to the SVM transient structure.
    59255882 *
    59265883 * @remarks No-long-jump zone!!!
    59275884 */
    5928 static int hmR0SvmCheckExitDueToEventDelivery(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
     5885static int hmR0SvmCheckExitDueToEventDelivery(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
    59295886{
    59305887    int rc = VINF_SUCCESS;
    5931     PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     5888    PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
    59325889    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_CR2);
    59335890
     
    59925949                    {
    59935950                        pSvmTransient->fVectoringPF = true;
    5994                         Log4Func(("IDT: Pending vectoring #PF due to delivery of Ext-Int/NMI. uCR2=%#RX64\n", pCtx->cr2));
     5951                        Log4Func(("IDT: Pending vectoring #PF due to delivery of Ext-Int/NMI. uCR2=%#RX64\n",
     5952                                  pVCpu->cpum.GstCtx.cr2));
    59955953                    }
    59965954                    else if (   pVmcb->ctrl.ExitIntInfo.n.u3Type == SVM_EVENT_EXCEPTION
     
    60015959                         * This can't happen with shadow paging.
    60025960                         */
    6003                         GCPtrFaultAddress = pCtx->cr2;
     5961                        GCPtrFaultAddress = pVCpu->cpum.GstCtx.cr2;
    60045962                    }
    60055963
     
    60345992                if (fRaiseInfo & IEMXCPTRAISEINFO_PF_PF)
    60355993                {
    6036                     Log4Func(("IDT: Pending vectoring double #PF uCR2=%#RX64\n", pCtx->cr2));
     5994                    Log4Func(("IDT: Pending vectoring double #PF uCR2=%#RX64\n", pVCpu->cpum.GstCtx.cr2));
    60375995                    pSvmTransient->fVectoringDoublePF = true;
    60385996                    Assert(rc == VINF_SUCCESS);
     
    60646022    }
    60656023    Assert(rc == VINF_SUCCESS || rc == VINF_HM_DOUBLE_FAULT || rc == VINF_EM_RESET || rc == VERR_EM_GUEST_CPU_HANG);
    6066     NOREF(pCtx);
    60676024    return rc;
    60686025}
     
    60756032 *
    60766033 * @param   pVCpu       The cross context virtual CPU structure.
    6077  * @param   pCtx        Pointer to the guest-CPU context.
    60786034 * @param   cb          RIP increment value in bytes.
    60796035 *
     
    60826038 *          hmR0SvmAdvanceRipDumb!
    60836039 */
    6084 DECLINLINE(void) hmR0SvmAdvanceRipHwAssist(PVMCPU pVCpu, PCPUMCTX pCtx, uint32_t cb)
    6085 {
    6086     bool const fSupportsNextRipSave = hmR0SvmSupportsNextRipSave(pVCpu, pCtx);
     6040DECLINLINE(void) hmR0SvmAdvanceRipHwAssist(PVMCPU pVCpu, uint32_t cb)
     6041{
     6042    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
     6043    bool const fSupportsNextRipSave = hmR0SvmSupportsNextRipSave(pVCpu);
    60876044    if (fSupportsNextRipSave)
    60886045    {
    6089         PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     6046        PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
    60906047        Assert(pVmcb);
    60916048        Assert(pVmcb->ctrl.u64NextRIP);
     
    60976054        pCtx->rip += cb;
    60986055
    6099     HMSVM_UPDATE_INTR_SHADOW(pVCpu, pCtx);
     6056    HMSVM_UPDATE_INTR_SHADOW(pVCpu);
    61006057}
    61016058
     
    61066063 *
    61076064 * @param   pVCpu       The cross context virtual CPU structure.
    6108  * @param   pCtx        Pointer to the guest-CPU context.
    61096065 * @param   cbLikely    The likely instruction length.
    61106066 */
    6111 DECLINLINE(uint8_t) hmR0SvmGetInstrLengthHwAssist(PVMCPU pVCpu, PCPUMCTX pCtx, uint8_t cbLikely)
     6067DECLINLINE(uint8_t) hmR0SvmGetInstrLengthHwAssist(PVMCPU pVCpu, uint8_t cbLikely)
    61126068{
    61136069    Assert(cbLikely <= 15);   /* See Intel spec. 2.3.11 "AVX Instruction Length" */
    6114     bool const fSupportsNextRipSave = hmR0SvmSupportsNextRipSave(pVCpu, pCtx);
     6070    bool const fSupportsNextRipSave = hmR0SvmSupportsNextRipSave(pVCpu);
    61156071    if (fSupportsNextRipSave)
    61166072    {
    6117         PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
    6118         uint8_t const cbInstr = pVmcb->ctrl.u64NextRIP - pCtx->rip;
     6073        PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
     6074        uint8_t const cbInstr = pVmcb->ctrl.u64NextRIP - pVCpu->cpum.GstCtx.rip;
    61196075        Assert(cbInstr == cbLikely);
    61206076        return cbInstr;
     
    61296085 *
    61306086 * @param   pVCpu       The cross context virtual CPU structure.
    6131  * @param   pCtx        Pointer to the guest-CPU context.
    61326087 * @param   cb          RIP increment value in bytes.
    61336088 */
    6134 DECLINLINE(void) hmR0SvmAdvanceRipDumb(PVMCPU pVCpu, PCPUMCTX pCtx, uint32_t cb)
    6135 {
    6136     pCtx->rip += cb;
    6137     HMSVM_UPDATE_INTR_SHADOW(pVCpu, pCtx);
     6089DECLINLINE(void) hmR0SvmAdvanceRipDumb(PVMCPU pVCpu, uint32_t cb)
     6090{
     6091    pVCpu->cpum.GstCtx.rip += cb;
     6092    HMSVM_UPDATE_INTR_SHADOW(pVCpu);
    61386093}
    61396094#undef HMSVM_UPDATE_INTR_SHADOW
     
    61526107 * signals (SVM_EXIT_INTR, SVM_EXIT_NMI, SVM_EXIT_FERR_FREEZE, SVM_EXIT_INIT).
    61536108 */
    6154 HMSVM_EXIT_DECL hmR0SvmExitIntr(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6155 {
    6156     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     6109HMSVM_EXIT_DECL hmR0SvmExitIntr(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6110{
     6111    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    61576112
    61586113    if (pSvmTransient->u64ExitCode == SVM_EXIT_NMI)
     
    61776132 * \#VMEXIT handler for WBINVD (SVM_EXIT_WBINVD). Conditional \#VMEXIT.
    61786133 */
    6179 HMSVM_EXIT_DECL hmR0SvmExitWbinvd(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6180 {
    6181     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
    6182 
    6183     hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 2);
     6134HMSVM_EXIT_DECL hmR0SvmExitWbinvd(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6135{
     6136    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     6137
     6138    hmR0SvmAdvanceRipHwAssist(pVCpu, 2);
    61846139    int rc = VINF_SUCCESS;
    61856140    HMSVM_CHECK_SINGLE_STEP(pVCpu, rc);
     
    61916146 * \#VMEXIT handler for INVD (SVM_EXIT_INVD). Unconditional \#VMEXIT.
    61926147 */
    6193 HMSVM_EXIT_DECL hmR0SvmExitInvd(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6194 {
    6195     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
    6196 
    6197     hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 2);
     6148HMSVM_EXIT_DECL hmR0SvmExitInvd(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6149{
     6150    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     6151
     6152    hmR0SvmAdvanceRipHwAssist(pVCpu, 2);
    61986153    int rc = VINF_SUCCESS;
    61996154    HMSVM_CHECK_SINGLE_STEP(pVCpu, rc);
     
    62056160 * \#VMEXIT handler for INVD (SVM_EXIT_CPUID). Conditional \#VMEXIT.
    62066161 */
    6207 HMSVM_EXIT_DECL hmR0SvmExitCpuid(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6208 {
    6209     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     6162HMSVM_EXIT_DECL hmR0SvmExitCpuid(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6163{
     6164    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    62106165
    62116166    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_EXEC_DECODED_NO_MEM_MASK | CPUMCTX_EXTRN_RAX | CPUMCTX_EXTRN_RCX);
     
    62166171    if (!pExitRec)
    62176172    {
    6218         rcStrict = IEMExecDecodedCpuid(pVCpu, hmR0SvmGetInstrLengthHwAssist(pVCpu, pCtx, 2));
     6173        rcStrict = IEMExecDecodedCpuid(pVCpu, hmR0SvmGetInstrLengthHwAssist(pVCpu, 2));
    62196174        if (rcStrict == VINF_IEM_RAISED_XCPT)
    62206175            rcStrict = VINF_SUCCESS;
     
    62266181         * Frequent exit or something needing probing.  Get state and call EMHistoryExec.
    62276182         */
    6228         Assert(pCtx == &pVCpu->cpum.GstCtx);
    62296183        HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK);
    62306184
     
    62456199 * \#VMEXIT handler for RDTSC (SVM_EXIT_RDTSC). Conditional \#VMEXIT.
    62466200 */
    6247 HMSVM_EXIT_DECL hmR0SvmExitRdtsc(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6248 {
    6249     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     6201HMSVM_EXIT_DECL hmR0SvmExitRdtsc(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6202{
     6203    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    62506204    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK);
    6251     VBOXSTRICTRC rcStrict = IEMExecDecodedRdtsc(pVCpu, hmR0SvmGetInstrLengthHwAssist(pVCpu, pCtx, 2));
     6205    VBOXSTRICTRC rcStrict = IEMExecDecodedRdtsc(pVCpu, hmR0SvmGetInstrLengthHwAssist(pVCpu, 2));
    62526206    if (rcStrict == VINF_SUCCESS)
    62536207        pSvmTransient->fUpdateTscOffsetting = true;
     
    62626216 * \#VMEXIT handler for RDTSCP (SVM_EXIT_RDTSCP). Conditional \#VMEXIT.
    62636217 */
    6264 HMSVM_EXIT_DECL hmR0SvmExitRdtscp(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6265 {
    6266     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
    6267     VBOXSTRICTRC rcStrict = IEMExecDecodedRdtscp(pVCpu, hmR0SvmGetInstrLengthHwAssist(pVCpu, pCtx, 3));
     6218HMSVM_EXIT_DECL hmR0SvmExitRdtscp(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6219{
     6220    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     6221    VBOXSTRICTRC rcStrict = IEMExecDecodedRdtscp(pVCpu, hmR0SvmGetInstrLengthHwAssist(pVCpu, 3));
    62686222    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK);
    62696223    if (rcStrict == VINF_SUCCESS)
     
    62796233 * \#VMEXIT handler for RDPMC (SVM_EXIT_RDPMC). Conditional \#VMEXIT.
    62806234 */
    6281 HMSVM_EXIT_DECL hmR0SvmExitRdpmc(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6282 {
    6283     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     6235HMSVM_EXIT_DECL hmR0SvmExitRdpmc(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6236{
     6237    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    62846238    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_CR4 | CPUMCTX_EXTRN_SS);
    62856239
     6240    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    62866241    int rc = EMInterpretRdpmc(pVCpu->CTX_SUFF(pVM), pVCpu, CPUMCTX2CORE(pCtx));
    62876242    if (RT_LIKELY(rc == VINF_SUCCESS))
    62886243    {
    6289         hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 2);
     6244        hmR0SvmAdvanceRipHwAssist(pVCpu, 2);
    62906245        HMSVM_CHECK_SINGLE_STEP(pVCpu, rc);
    62916246    }
     
    63026257 * \#VMEXIT handler for INVLPG (SVM_EXIT_INVLPG). Conditional \#VMEXIT.
    63036258 */
    6304 HMSVM_EXIT_DECL hmR0SvmExitInvlpg(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6305 {
    6306     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     6259HMSVM_EXIT_DECL hmR0SvmExitInvlpg(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6260{
     6261    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    63076262    Assert(!pVCpu->CTX_SUFF(pVM)->hm.s.fNestedPaging);
    63086263
    63096264    VBOXSTRICTRC rcStrict;
    6310     bool const fSupportsDecodeAssists = hmR0SvmSupportsDecodeAssists(pVCpu, pCtx);
    6311     bool const fSupportsNextRipSave   = hmR0SvmSupportsNextRipSave(pVCpu, pCtx);
     6265    bool const fSupportsDecodeAssists = hmR0SvmSupportsDecodeAssists(pVCpu);
     6266    bool const fSupportsNextRipSave   = hmR0SvmSupportsNextRipSave(pVCpu);
    63126267    if (   fSupportsDecodeAssists
    63136268        && fSupportsNextRipSave)
    63146269    {
    63156270        HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK);
    6316         PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
    6317         uint8_t const cbInstr   = pVmcb->ctrl.u64NextRIP - pCtx->rip;
     6271        PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
     6272        uint8_t const cbInstr   = pVmcb->ctrl.u64NextRIP - pVCpu->cpum.GstCtx.rip;
    63186273        RTGCPTR const GCPtrPage = pVmcb->ctrl.u64ExitInfo1;
    63196274        rcStrict = IEMExecDecodedInvlpg(pVCpu, cbInstr, GCPtrPage);
     
    63336288 * \#VMEXIT handler for HLT (SVM_EXIT_HLT). Conditional \#VMEXIT.
    63346289 */
    6335 HMSVM_EXIT_DECL hmR0SvmExitHlt(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6336 {
    6337     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
    6338 
    6339     hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 1);
    6340     int rc = EMShouldContinueAfterHalt(pVCpu, pCtx) ? VINF_SUCCESS : VINF_EM_HALT;
     6290HMSVM_EXIT_DECL hmR0SvmExitHlt(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6291{
     6292    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     6293
     6294    hmR0SvmAdvanceRipHwAssist(pVCpu, 1);
     6295    int rc = EMShouldContinueAfterHalt(pVCpu, &pVCpu->cpum.GstCtx) ? VINF_SUCCESS : VINF_EM_HALT;
    63416296    HMSVM_CHECK_SINGLE_STEP(pVCpu, rc);
    63426297
     
    63516306 * \#VMEXIT handler for MONITOR (SVM_EXIT_MONITOR). Conditional \#VMEXIT.
    63526307 */
    6353 HMSVM_EXIT_DECL hmR0SvmExitMonitor(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6354 {
    6355     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     6308HMSVM_EXIT_DECL hmR0SvmExitMonitor(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6309{
     6310    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    63566311    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_SS);
    63576312
     6313    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    63586314    int rc = EMInterpretMonitor(pVCpu->CTX_SUFF(pVM), pVCpu, CPUMCTX2CORE(pCtx));
    63596315    if (RT_LIKELY(rc == VINF_SUCCESS))
    63606316    {
    6361         hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 3);
     6317        hmR0SvmAdvanceRipHwAssist(pVCpu, 3);
    63626318        HMSVM_CHECK_SINGLE_STEP(pVCpu, rc);
    63636319    }
     
    63756331 * \#VMEXIT handler for MWAIT (SVM_EXIT_MWAIT). Conditional \#VMEXIT.
    63766332 */
    6377 HMSVM_EXIT_DECL hmR0SvmExitMwait(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6378 {
    6379     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     6333HMSVM_EXIT_DECL hmR0SvmExitMwait(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6334{
     6335    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    63806336    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_CR0 | CPUMCTX_EXTRN_SS);
    63816337
     6338    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    63826339    VBOXSTRICTRC rc2 = EMInterpretMWait(pVCpu->CTX_SUFF(pVM), pVCpu, CPUMCTX2CORE(pCtx));
    63836340    int rc = VBOXSTRICTRC_VAL(rc2);
     
    63856342        ||  rc == VINF_SUCCESS)
    63866343    {
    6387         hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 3);
     6344        hmR0SvmAdvanceRipHwAssist(pVCpu, 3);
    63886345
    63896346        if (   rc == VINF_EM_HALT
     
    64106367 * \#VMEXIT.
    64116368 */
    6412 HMSVM_EXIT_DECL hmR0SvmExitShutdown(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6413 {
    6414     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     6369HMSVM_EXIT_DECL hmR0SvmExitShutdown(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6370{
     6371    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    64156372    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    64166373    return VINF_EM_RESET;
     
    64216378 * \#VMEXIT handler for unexpected exits. Conditional \#VMEXIT.
    64226379 */
    6423 HMSVM_EXIT_DECL hmR0SvmExitUnexpected(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6424 {
    6425     RT_NOREF(pCtx);
    6426     PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     6380HMSVM_EXIT_DECL hmR0SvmExitUnexpected(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6381{
     6382    PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
    64276383    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    64286384    AssertMsgFailed(("hmR0SvmExitUnexpected: ExitCode=%#RX64 uExitInfo1=%#RX64 uExitInfo2=%#RX64\n", pSvmTransient->u64ExitCode,
     
    64376393 * \#VMEXIT handler for CRx reads (SVM_EXIT_READ_CR*). Conditional \#VMEXIT.
    64386394 */
    6439 HMSVM_EXIT_DECL hmR0SvmExitReadCRx(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6440 {
    6441     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
    6442 
     6395HMSVM_EXIT_DECL hmR0SvmExitReadCRx(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6396{
     6397    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     6398
     6399    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    64436400    Log4Func(("CS:RIP=%04x:%#RX64\n", pCtx->cs.Sel, pCtx->rip));
    64446401#ifdef VBOX_WITH_STATISTICS
     
    64536410#endif
    64546411
    6455     bool const fSupportsDecodeAssists = hmR0SvmSupportsDecodeAssists(pVCpu, pCtx);
    6456     bool const fSupportsNextRipSave   = hmR0SvmSupportsNextRipSave(pVCpu, pCtx);
     6412    bool const fSupportsDecodeAssists = hmR0SvmSupportsDecodeAssists(pVCpu);
     6413    bool const fSupportsNextRipSave   = hmR0SvmSupportsNextRipSave(pVCpu);
    64576414    if (   fSupportsDecodeAssists
    64586415        && fSupportsNextRipSave)
    64596416    {
    6460         PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     6417        PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
    64616418        bool const fMovCRx = RT_BOOL(pVmcb->ctrl.u64ExitInfo1 & SVM_EXIT1_MOV_CRX_MASK);
    64626419        if (fMovCRx)
     
    64876444 * \#VMEXIT handler for CRx writes (SVM_EXIT_WRITE_CR*). Conditional \#VMEXIT.
    64886445 */
    6489 HMSVM_EXIT_DECL hmR0SvmExitWriteCRx(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6490 {
    6491     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     6446HMSVM_EXIT_DECL hmR0SvmExitWriteCRx(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6447{
     6448    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    64926449
    64936450    uint64_t const uExitCode = pSvmTransient->u64ExitCode;
     
    64966453
    64976454    VBOXSTRICTRC rcStrict = VERR_SVM_IPE_5;
     6455    PCPUMCTX     pCtx = &pVCpu->cpum.GstCtx;
    64986456    bool         fDecodedInstr = false;
    6499     bool const   fSupportsDecodeAssists = hmR0SvmSupportsDecodeAssists(pVCpu, pCtx);
    6500     bool const   fSupportsNextRipSave   = hmR0SvmSupportsNextRipSave(pVCpu, pCtx);
     6457    bool const   fSupportsDecodeAssists = hmR0SvmSupportsDecodeAssists(pVCpu);
     6458    bool const   fSupportsNextRipSave   = hmR0SvmSupportsNextRipSave(pVCpu);
    65016459    if (   fSupportsDecodeAssists
    65026460        && fSupportsNextRipSave)
    65036461    {
    6504         PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     6462        PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
    65056463        bool const fMovCRx = RT_BOOL(pVmcb->ctrl.u64ExitInfo1 & SVM_EXIT1_MOV_CRX_MASK);
    65066464        if (fMovCRx)
     
    65846542
    65856543    VBOXSTRICTRC rcStrict;
    6586     bool const fSupportsNextRipSave = hmR0SvmSupportsNextRipSave(pVCpu, pCtx);
     6544    bool const fSupportsNextRipSave = hmR0SvmSupportsNextRipSave(pVCpu);
    65876545    if (fSupportsNextRipSave)
    65886546    {
     
    66436601
    66446602        int rc = VINF_SUCCESS;
    6645         hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 2);
     6603        hmR0SvmAdvanceRipHwAssist(pVCpu, 2);
    66466604        HMSVM_CHECK_SINGLE_STEP(pVCpu, rc);
    66476605        return rc;
     
    66526610     */
    66536611    VBOXSTRICTRC rcStrict;
    6654     bool const fSupportsNextRipSave = hmR0SvmSupportsNextRipSave(pVCpu, pCtx);
     6612    bool const fSupportsNextRipSave = hmR0SvmSupportsNextRipSave(pVCpu);
    66556613    if (fSupportsNextRipSave)
    66566614    {
     
    67146672 * \#VMEXIT.
    67156673 */
    6716 HMSVM_EXIT_DECL hmR0SvmExitMsr(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6717 {
    6718     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
    6719 
    6720     PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     6674HMSVM_EXIT_DECL hmR0SvmExitMsr(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6675{
     6676    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     6677
     6678    PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
    67216679    if (pVmcb->ctrl.u64ExitInfo1 == SVM_EXIT1_MSR_READ)
    67226680        return VBOXSTRICTRC_TODO(hmR0SvmExitReadMsr(pVCpu, pVmcb));
     
    67306688 * \#VMEXIT handler for DRx read (SVM_EXIT_READ_DRx). Conditional \#VMEXIT.
    67316689 */
    6732 HMSVM_EXIT_DECL hmR0SvmExitReadDRx(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6733 {
    6734     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     6690HMSVM_EXIT_DECL hmR0SvmExitReadDRx(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6691{
     6692    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    67356693    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    67366694
     
    67386696
    67396697    /** @todo Stepping with nested-guest. */
     6698    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    67406699    if (!CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
    67416700    {
     
    68006759 * \#VMEXIT handler for DRx write (SVM_EXIT_WRITE_DRx). Conditional \#VMEXIT.
    68016760 */
    6802 HMSVM_EXIT_DECL hmR0SvmExitWriteDRx(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6803 {
    6804     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     6761HMSVM_EXIT_DECL hmR0SvmExitWriteDRx(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6762{
     6763    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    68056764    /* For now it's the same since we interpret the instruction anyway. Will change when using of Decode Assist is implemented. */
    6806     int rc = hmR0SvmExitReadDRx(pVCpu, pCtx, pSvmTransient);
     6765    int rc = hmR0SvmExitReadDRx(pVCpu, pSvmTransient);
    68076766    STAM_COUNTER_INC(&pVCpu->hm.s.StatExitDRxWrite);
    68086767    STAM_COUNTER_DEC(&pVCpu->hm.s.StatExitDRxRead);
     
    68146773 * \#VMEXIT handler for XCRx write (SVM_EXIT_XSETBV). Conditional \#VMEXIT.
    68156774 */
    6816 HMSVM_EXIT_DECL hmR0SvmExitXsetbv(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6817 {
    6818     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     6775HMSVM_EXIT_DECL hmR0SvmExitXsetbv(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6776{
     6777    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    68196778    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK);
    68206779
     
    68246783        ASMAtomicUoOrU64(&pVCpu->hm.s.fCtxChanged, HM_CHANGED_XCPT_RAISED_MASK);
    68256784
     6785    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    68266786    pVCpu->hm.s.fLoadSaveGuestXcr0 = (pCtx->cr4 & X86_CR4_OSXSAVE) && pCtx->aXcr[0] != ASMGetXcr0();
    68276787    Log4Func(("New XCR0=%#RX64 fLoadSaveGuestXcr0=%d (cr4=%RX64) rcStrict=%Rrc\n", pCtx->aXcr[0], pVCpu->hm.s.fLoadSaveGuestXcr0,
     
    68366796 * \#VMEXIT handler for I/O instructions (SVM_EXIT_IOIO). Conditional \#VMEXIT.
    68376797 */
    6838 HMSVM_EXIT_DECL hmR0SvmExitIOInstr(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    6839 {
    6840     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     6798HMSVM_EXIT_DECL hmR0SvmExitIOInstr(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     6799{
     6800    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    68416801    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK | CPUMCTX_EXTRN_SREG_MASK);
    68426802
     
    68456805    static uint32_t const s_aIOOpAnd[8] = { 0, 0xff, 0xffff, 0, 0xffffffff, 0, 0, 0 };  /* AND masks for saving
    68466806                                                                                           the result (in AL/AX/EAX). */
     6807    PVM      pVM   = pVCpu->CTX_SUFF(pVM);
     6808    PCPUMCTX pCtx  = &pVCpu->cpum.GstCtx;
     6809    PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
     6810
    68476811    Log4Func(("CS:RIP=%04x:%#RX64\n", pCtx->cs.Sel, pCtx->rip));
    6848 
    6849     PVM      pVM   = pVCpu->CTX_SUFF(pVM);
    6850     PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
    68516812
    68526813    /* Refer AMD spec. 15.10.2 "IN and OUT Behaviour" and Figure 15-2. "EXITINFO1 for IOIO Intercept" for the format. */
     
    69046865                           only enabling it for Bulldozer and later with NRIP.  OS/2 broke on
    69056866                           2384 Opterons when only checking NRIP. */
    6906                         bool const fSupportsNextRipSave = hmR0SvmSupportsNextRipSave(pVCpu, pCtx);
     6867                        bool const fSupportsNextRipSave = hmR0SvmSupportsNextRipSave(pVCpu);
    69076868                        if (   fSupportsNextRipSave
    69086869                            && pVM->cpum.ro.GuestFeatures.enmMicroarch >= kCpumMicroarch_AMD_15h_First)
     
    69626923                }
    69636924                else if (rcStrict == VINF_IOM_R3_IOPORT_READ)
    6964                     HMR0SavePendingIOPortRead(pVCpu, pCtx->rip, pVmcb->ctrl.u64ExitInfo2, IoExitInfo.n.u16Port, uAndVal, cbValue);
     6925                {
     6926                    HMR0SavePendingIOPortRead(pVCpu, pVCpu->cpum.GstCtx.rip, pVmcb->ctrl.u64ExitInfo2, IoExitInfo.n.u16Port,
     6927                                              uAndVal, cbValue);
     6928                }
    69656929
    69666930                STAM_COUNTER_INC(&pVCpu->hm.s.StatExitIORead);
     
    69956959                CPUMR0DebugStateMaybeSaveGuest(pVCpu, false /*fDr6*/);
    69966960
    6997                 VBOXSTRICTRC rcStrict2 = DBGFBpCheckIo(pVM, pVCpu, pCtx, IoExitInfo.n.u16Port, cbValue);
     6961                VBOXSTRICTRC rcStrict2 = DBGFBpCheckIo(pVM, pVCpu, &pVCpu->cpum.GstCtx, IoExitInfo.n.u16Port, cbValue);
    69986962                if (rcStrict2 == VINF_EM_RAW_GUEST_TRAP)
    69996963                {
     
    70667030 * \#VMEXIT handler for Nested Page-faults (SVM_EXIT_NPF). Conditional \#VMEXIT.
    70677031 */
    7068 HMSVM_EXIT_DECL hmR0SvmExitNestedPF(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7069 {
    7070     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7032HMSVM_EXIT_DECL hmR0SvmExitNestedPF(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7033{
     7034    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    70717035    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    7072     HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY();
    7073 
    7074     PVM pVM = pVCpu->CTX_SUFF(pVM);
     7036    HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(pVCpu, pSvmTransient);
     7037
     7038    PVM      pVM  = pVCpu->CTX_SUFF(pVM);
     7039    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    70757040    Assert(pVM->hm.s.fNestedPaging);
    70767041
    70777042    /* See AMD spec. 15.25.6 "Nested versus Guest Page Faults, Fault Ordering" for VMCB details for #NPF. */
    7078     PSVMVMCB pVmcb           = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     7043    PSVMVMCB pVmcb           = hmR0SvmGetCurrentVmcb(pVCpu);
    70797044    RTGCPHYS GCPhysFaultAddr = pVmcb->ctrl.u64ExitInfo2;
    70807045    uint32_t u32ErrCode      = pVmcb->ctrl.u64ExitInfo1;    /* Note! High bits in EXITINFO1 may contain additional info and are
     
    72087173 * \#VMEXIT.
    72097174 */
    7210 HMSVM_EXIT_DECL hmR0SvmExitVIntr(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7211 {
    7212     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
    7213     HMSVM_ASSERT_NOT_IN_NESTED_GUEST(pCtx);
     7175HMSVM_EXIT_DECL hmR0SvmExitVIntr(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7176{
     7177    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     7178    HMSVM_ASSERT_NOT_IN_NESTED_GUEST(&pVCpu->cpum.GstCtx);
    72147179
    72157180    /* Indicate that we no longer need to #VMEXIT when the guest is ready to receive NMIs, it is now ready. */
    7216     PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
    7217     hmR0SvmClearIntWindowExiting(pVCpu, pVmcb, pCtx);
     7181    PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
     7182    hmR0SvmClearIntWindowExiting(pVCpu, pVmcb);
    72187183
    72197184    /* Deliver the pending interrupt via hmR0SvmEvaluatePendingEvent() and resume guest execution. */
     
    72277192 * \#VMEXIT.
    72287193 */
    7229 HMSVM_EXIT_DECL hmR0SvmExitTaskSwitch(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7230 {
    7231     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
    7232     HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY();
     7194HMSVM_EXIT_DECL hmR0SvmExitTaskSwitch(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7195{
     7196    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     7197    HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(pVCpu, pSvmTransient);
    72337198
    72347199#ifndef HMSVM_ALWAYS_TRAP_TASK_SWITCH
     
    72587223 * \#VMEXIT handler for VMMCALL (SVM_EXIT_VMMCALL). Conditional \#VMEXIT.
    72597224 */
    7260 HMSVM_EXIT_DECL hmR0SvmExitVmmCall(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7261 {
    7262     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7225HMSVM_EXIT_DECL hmR0SvmExitVmmCall(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7226{
     7227    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    72637228    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    72647229
    72657230    if (pVCpu->CTX_SUFF(pVM)->hm.s.fTprPatchingAllowed)
    72667231    {
    7267         int rc = hmSvmEmulateMovTpr(pVCpu, pCtx);
     7232        int rc = hmSvmEmulateMovTpr(pVCpu);
    72687233        if (rc != VERR_NOT_FOUND)
    72697234        {
     
    72757240    if (EMAreHypercallInstructionsEnabled(pVCpu))
    72767241    {
    7277         VBOXSTRICTRC rcStrict = GIMHypercall(pVCpu, pCtx);
     7242        VBOXSTRICTRC rcStrict = GIMHypercall(pVCpu, &pVCpu->cpum.GstCtx);
    72787243        if (RT_SUCCESS(rcStrict))
    72797244        {
     
    72817246               of say VINF_GIM_R3_HYPERCALL. */
    72827247            if (rcStrict == VINF_SUCCESS)
    7283                 hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 3 /* cbInstr */);
     7248                hmR0SvmAdvanceRipHwAssist(pVCpu, 3 /* cbInstr */);
    72847249
    72857250            return VBOXSTRICTRC_VAL(rcStrict);
     
    72977262 * \#VMEXIT handler for VMMCALL (SVM_EXIT_VMMCALL). Conditional \#VMEXIT.
    72987263 */
    7299 HMSVM_EXIT_DECL hmR0SvmExitPause(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7300 {
    7301     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
    7302     hmR0SvmAdvanceRipHwAssist(pVCpu, pCtx, 2);
     7264HMSVM_EXIT_DECL hmR0SvmExitPause(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7265{
     7266    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     7267    hmR0SvmAdvanceRipHwAssist(pVCpu, 2);
    73037268    /** @todo The guest has likely hit a contended spinlock. We might want to
    73047269     *        poke a schedule different guest VCPU. */
     
    73117276 * \#VMEXIT.
    73127277 */
    7313 HMSVM_EXIT_DECL hmR0SvmExitFerrFreeze(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7314 {
    7315     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7278HMSVM_EXIT_DECL hmR0SvmExitFerrFreeze(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7279{
     7280    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    73167281    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, CPUMCTX_EXTRN_CR0);
    7317     Assert(!(pCtx->cr0 & X86_CR0_NE));
     7282    Assert(!(pVCpu->cpum.GstCtx.cr0 & X86_CR0_NE));
    73187283
    73197284    Log4Func(("Raising IRQ 13 in response to #FERR\n"));
     
    73257290 * \#VMEXIT handler for IRET (SVM_EXIT_IRET). Conditional \#VMEXIT.
    73267291 */
    7327 HMSVM_EXIT_DECL hmR0SvmExitIret(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7328 {
    7329     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7292HMSVM_EXIT_DECL hmR0SvmExitIret(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7293{
     7294    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    73307295
    73317296    /* Clear NMI blocking. */
     
    73347299
    73357300    /* Indicate that we no longer need to #VMEXIT when the guest is ready to receive NMIs, it is now ready. */
    7336     PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
    7337     hmR0SvmClearCtrlIntercept(pVCpu, pCtx, pVmcb, SVM_CTRL_INTERCEPT_IRET);
     7301    PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
     7302    hmR0SvmClearCtrlIntercept(pVCpu, pVmcb, SVM_CTRL_INTERCEPT_IRET);
    73387303
    73397304    /* Deliver the pending NMI via hmR0SvmEvaluatePendingEvent() and resume guest execution. */
     
    73467311 * Conditional \#VMEXIT.
    73477312 */
    7348 HMSVM_EXIT_DECL hmR0SvmExitXcptPF(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7349 {
    7350     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7313HMSVM_EXIT_DECL hmR0SvmExitXcptPF(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7314{
     7315    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    73517316    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    7352     HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY();
     7317    HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(pVCpu, pSvmTransient);
    73537318
    73547319    /* See AMD spec. 15.12.15 "#PF (Page Fault)". */
    73557320    PVM             pVM           = pVCpu->CTX_SUFF(pVM);
    7356     PSVMVMCB        pVmcb         = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     7321    PCPUMCTX        pCtx          = &pVCpu->cpum.GstCtx;
     7322    PSVMVMCB        pVmcb         = hmR0SvmGetCurrentVmcb(pVCpu);
    73577323    uint32_t        uErrCode      = pVmcb->ctrl.u64ExitInfo1;
    73587324    uint64_t const  uFaultAddress = pVmcb->ctrl.u64ExitInfo2;
     
    73667332        {
    73677333            /* A genuine guest #PF, reflect it to the guest. */
    7368             hmR0SvmSetPendingXcptPF(pVCpu, pCtx, uErrCode, uFaultAddress);
     7334            hmR0SvmSetPendingXcptPF(pVCpu, uErrCode, uFaultAddress);
    73697335            Log4Func(("#PF: Guest page fault at %04X:%RGv FaultAddr=%RX64 ErrCode=%#x\n", pCtx->cs.Sel, (RTGCPTR)pCtx->rip,
    73707336                      uFaultAddress, uErrCode));
     
    74627428#endif
    74637429
    7464             hmR0SvmSetPendingXcptPF(pVCpu, pCtx, uErrCode, uFaultAddress);
     7430            hmR0SvmSetPendingXcptPF(pVCpu, uErrCode, uFaultAddress);
    74657431        }
    74667432        else
     
    74867452 * Conditional \#VMEXIT.
    74877453 */
    7488 HMSVM_EXIT_DECL hmR0SvmExitXcptUD(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7489 {
    7490     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
    7491     HMSVM_ASSERT_NOT_IN_NESTED_GUEST(pCtx);
     7454HMSVM_EXIT_DECL hmR0SvmExitXcptUD(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7455{
     7456    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     7457    HMSVM_ASSERT_NOT_IN_NESTED_GUEST(&pVCpu->cpum.GstCtx);
    74927458
    74937459    /* Paranoia; Ensure we cannot be called as a result of event delivery. */
     
    75007466        HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    75017467        uint8_t cbInstr = 0;
    7502         VBOXSTRICTRC rcStrict = GIMXcptUD(pVCpu, pCtx, NULL /* pDis */, &cbInstr);
     7468        VBOXSTRICTRC rcStrict = GIMXcptUD(pVCpu, &pVCpu->cpum.GstCtx, NULL /* pDis */, &cbInstr);
    75037469        if (rcStrict == VINF_SUCCESS)
    75047470        {
    75057471            /* #UD #VMEXIT does not have valid NRIP information, manually advance RIP. See @bugref{7270#c170}. */
    7506             hmR0SvmAdvanceRipDumb(pVCpu, pCtx, cbInstr);
     7472            hmR0SvmAdvanceRipDumb(pVCpu, cbInstr);
    75077473            rc = VINF_SUCCESS;
    75087474            HMSVM_CHECK_SINGLE_STEP(pVCpu, rc);
     
    75327498 * Conditional \#VMEXIT.
    75337499 */
    7534 HMSVM_EXIT_DECL hmR0SvmExitXcptMF(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7535 {
    7536     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7500HMSVM_EXIT_DECL hmR0SvmExitXcptMF(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7501{
     7502    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    75377503    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    75387504
     7505    PCPUMCTX pCtx  = &pVCpu->cpum.GstCtx;
     7506    PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
     7507
    75397508    /* Paranoia; Ensure we cannot be called as a result of event delivery. */
    7540     PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
    75417509    Assert(!pVmcb->ctrl.ExitIntInfo.n.u1Valid); NOREF(pVmcb);
    75427510
     
    75707538 * \#VMEXIT.
    75717539 */
    7572 HMSVM_EXIT_DECL hmR0SvmExitXcptDB(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7573 {
    7574     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7540HMSVM_EXIT_DECL hmR0SvmExitXcptDB(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7541{
     7542    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    75757543    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    7576     HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY();
     7544    HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(pVCpu, pSvmTransient);
    75777545
    75787546    if (RT_UNLIKELY(pVCpu->hm.s.Event.fPending))
     
    75917559    PVM      pVM   = pVCpu->CTX_SUFF(pVM);
    75927560    PSVMVMCB pVmcb = pVCpu->hm.s.svm.pVmcb;
     7561    PCPUMCTX pCtx  = &pVCpu->cpum.GstCtx;
    75937562    int rc = DBGFRZTrap01Handler(pVM, pVCpu, CPUMCTX2CORE(pCtx), pVmcb->guest.u64DR6, pVCpu->hm.s.fSingleInstruction);
    75947563    if (rc == VINF_EM_RAW_GUEST_TRAP)
     
    76267595 * Conditional \#VMEXIT.
    76277596 */
    7628 HMSVM_EXIT_DECL hmR0SvmExitXcptAC(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7629 {
    7630     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
    7631     HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY();
     7597HMSVM_EXIT_DECL hmR0SvmExitXcptAC(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7598{
     7599    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     7600    HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(pVCpu, pSvmTransient);
    76327601
    76337602    SVMEVENT Event;
     
    76467615 * Conditional \#VMEXIT.
    76477616 */
    7648 HMSVM_EXIT_DECL hmR0SvmExitXcptBP(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7649 {
    7650     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7617HMSVM_EXIT_DECL hmR0SvmExitXcptBP(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7618{
     7619    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    76517620    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
    7652     HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY();
    7653 
     7621    HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(pVCpu, pSvmTransient);
     7622
     7623    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    76547624    int rc = DBGFRZTrap03Handler(pVCpu->CTX_SUFF(pVM), pVCpu, CPUMCTX2CORE(pCtx));
    76557625    if (rc == VINF_EM_RAW_GUEST_TRAP)
     
    76727642 * \#VMEXIT handler for generic exceptions. Conditional \#VMEXIT.
    76737643 */
    7674 HMSVM_EXIT_DECL hmR0SvmExitXcptGeneric(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7675 {
    7676     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
    7677     HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY();
    7678 
    7679     PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     7644HMSVM_EXIT_DECL hmR0SvmExitXcptGeneric(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7645{
     7646    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     7647    HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(pVCpu, pSvmTransient);
     7648
     7649    PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
    76807650    uint8_t const  uVector  = pVmcb->ctrl.u64ExitCode - SVM_EXIT_XCPT_0;
    76817651    uint32_t const uErrCode = pVmcb->ctrl.u64ExitInfo1;
     
    77157685 * \#VMEXIT handler for CLGI (SVM_EXIT_CLGI). Conditional \#VMEXIT.
    77167686 */
    7717 HMSVM_EXIT_DECL hmR0SvmExitClgi(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7718 {
    7719     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7687HMSVM_EXIT_DECL hmR0SvmExitClgi(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7688{
     7689    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    77207690    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK | CPUMCTX_EXTRN_HWVIRT);
    77217691
    77227692#ifdef VBOX_STRICT
    7723     PCSVMVMCB pVmcbTmp = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     7693    PCSVMVMCB pVmcbTmp = hmR0SvmGetCurrentVmcb(pVCpu);
    77247694    Assert(pVmcbTmp);
    77257695    Assert(!pVmcbTmp->ctrl.IntCtrl.n.u1VGifEnable);
     
    77277697#endif
    77287698
    7729     uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, pCtx, 3);
     7699    uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, 3);
    77307700    VBOXSTRICTRC rcStrict = IEMExecDecodedClgi(pVCpu, cbInstr);
    77317701    if (rcStrict == VINF_SUCCESS)
     
    77387708 * \#VMEXIT handler for STGI (SVM_EXIT_STGI). Conditional \#VMEXIT.
    77397709 */
    7740 HMSVM_EXIT_DECL hmR0SvmExitStgi(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7741 {
    7742     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7710HMSVM_EXIT_DECL hmR0SvmExitStgi(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7711{
     7712    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    77437713    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK | CPUMCTX_EXTRN_HWVIRT);
    77447714
     
    77477717     * we only intercept STGI when events are pending for GIF to become 1.
    77487718     */
    7749     PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     7719    PSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
    77507720    if (pVmcb->ctrl.IntCtrl.n.u1VGifEnable)
    7751         hmR0SvmClearCtrlIntercept(pVCpu, pCtx, pVmcb, SVM_CTRL_INTERCEPT_STGI);
    7752 
    7753     uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, pCtx, 3);
     7721        hmR0SvmClearCtrlIntercept(pVCpu, pVmcb, SVM_CTRL_INTERCEPT_STGI);
     7722
     7723    uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, 3);
    77547724    VBOXSTRICTRC rcStrict = IEMExecDecodedStgi(pVCpu, cbInstr);
    77557725    if (rcStrict == VINF_SUCCESS)
     
    77627732 * \#VMEXIT handler for VMLOAD (SVM_EXIT_VMLOAD). Conditional \#VMEXIT.
    77637733 */
    7764 HMSVM_EXIT_DECL hmR0SvmExitVmload(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7765 {
    7766     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7734HMSVM_EXIT_DECL hmR0SvmExitVmload(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7735{
     7736    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    77677737    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK
    77687738                                    | CPUMCTX_EXTRN_FS   | CPUMCTX_EXTRN_GS             | CPUMCTX_EXTRN_TR
     
    77717741
    77727742#ifdef VBOX_STRICT
    7773     PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     7743    PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
    77747744    Assert(pVmcb);
    77757745    Assert(!pVmcb->ctrl.LbrVirt.n.u1VirtVmsaveVmload);
     
    77777747#endif
    77787748
    7779     uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, pCtx, 3);
     7749    uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, 3);
    77807750    VBOXSTRICTRC rcStrict = IEMExecDecodedVmload(pVCpu, cbInstr);
    77817751    if (rcStrict == VINF_SUCCESS)
     
    77937763 * \#VMEXIT handler for VMSAVE (SVM_EXIT_VMSAVE). Conditional \#VMEXIT.
    77947764 */
    7795 HMSVM_EXIT_DECL hmR0SvmExitVmsave(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7796 {
    7797     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7765HMSVM_EXIT_DECL hmR0SvmExitVmsave(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7766{
     7767    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    77987768    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK);
    77997769
    78007770#ifdef VBOX_STRICT
    7801     PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu, pCtx);
     7771    PCSVMVMCB pVmcb = hmR0SvmGetCurrentVmcb(pVCpu);
    78027772    Assert(pVmcb);
    78037773    Assert(!pVmcb->ctrl.LbrVirt.n.u1VirtVmsaveVmload);
     
    78057775#endif
    78067776
    7807     uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, pCtx, 3);
     7777    uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, 3);
    78087778    VBOXSTRICTRC rcStrict = IEMExecDecodedVmsave(pVCpu, cbInstr);
    78097779    return VBOXSTRICTRC_VAL(rcStrict);
     
    78147784 * \#VMEXIT handler for INVLPGA (SVM_EXIT_INVLPGA). Conditional \#VMEXIT.
    78157785 */
    7816 HMSVM_EXIT_DECL hmR0SvmExitInvlpga(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7817 {
    7818     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7786HMSVM_EXIT_DECL hmR0SvmExitInvlpga(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7787{
     7788    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    78197789    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK);
    78207790
    7821     uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, pCtx, 3);
     7791    uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, 3);
    78227792    VBOXSTRICTRC rcStrict = IEMExecDecodedInvlpga(pVCpu, cbInstr);
    78237793    return VBOXSTRICTRC_VAL(rcStrict);
     
    78287798 * \#VMEXIT handler for STGI (SVM_EXIT_VMRUN). Conditional \#VMEXIT.
    78297799 */
    7830 HMSVM_EXIT_DECL hmR0SvmExitVmrun(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7831 {
    7832     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
     7800HMSVM_EXIT_DECL hmR0SvmExitVmrun(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7801{
     7802    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
    78337803    HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, IEM_CPUMCTX_EXTRN_MUST_MASK | IEM_CPUMCTX_EXTRN_SVM_VMRUN_MASK);
    78347804    VBOXSTRICTRC rcStrict;
    7835     uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, pCtx, 3);
     7805    uint8_t const cbInstr = hmR0SvmGetInstrLengthHwAssist(pVCpu, 3);
    78367806    rcStrict = IEMExecDecodedVmrun(pVCpu, cbInstr);
    78377807    Log4Func(("IEMExecDecodedVmrun returns %Rrc\n", VBOXSTRICTRC_VAL(rcStrict)));
     
    78497819 * Unconditional \#VMEXIT.
    78507820 */
    7851 HMSVM_EXIT_DECL hmR0SvmNestedExitXcptDB(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7852 {
    7853     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
    7854     HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY();
     7821HMSVM_EXIT_DECL hmR0SvmNestedExitXcptDB(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7822{
     7823    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     7824    HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(pVCpu, pSvmTransient);
    78557825
    78567826    if (pVCpu->hm.s.Event.fPending)
     
    78697839 * Conditional \#VMEXIT.
    78707840 */
    7871 HMSVM_EXIT_DECL hmR0SvmNestedExitXcptBP(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
    7872 {
    7873     HMSVM_VALIDATE_EXIT_HANDLER_PARAMS();
    7874     HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY();
     7841HMSVM_EXIT_DECL hmR0SvmNestedExitXcptBP(PVMCPU pVCpu, PSVMTRANSIENT pSvmTransient)
     7842{
     7843    HMSVM_VALIDATE_EXIT_HANDLER_PARAMS(pVCpu, pSvmTransient);
     7844    HMSVM_CHECK_EXIT_DUE_TO_EVENT_DELIVERY(pVCpu, pSvmTransient);
    78757845
    78767846    SVMEVENT Event;
  • trunk/src/VBox/VMM/VMMR0/HMSVMR0.h

    r72805 r72967  
    4848VMMR0DECL(int)          SVMR0TermVM(PVM pVM);
    4949VMMR0DECL(int)          SVMR0SetupVM(PVM pVM);
    50 VMMR0DECL(VBOXSTRICTRC) SVMR0RunGuestCode(PVMCPU pVCpu, PCPUMCTX pCtx);
     50VMMR0DECL(VBOXSTRICTRC) SVMR0RunGuestCode(PVMCPU pVCpu);
    5151VMMR0DECL(int)          SVMR0ExportHostState(PVMCPU pVCpu);
    5252VMMR0DECL(int)          SVMR0ImportStateOnDemand(PVMCPU pVCpu, uint64_t fWhat);
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r72966 r72967  
    1016210162 * @returns Strict VBox status code (i.e. informational status codes too).
    1016310163 * @param   pVCpu       The cross context virtual CPU structure.
    10164  * @param   pCtx        Pointer to the guest-CPU context.
    10165  */
    10166 VMMR0DECL(VBOXSTRICTRC) VMXR0RunGuestCode(PVMCPU pVCpu, PCPUMCTX pCtx)
    10167 {
     10164 */
     10165VMMR0DECL(VBOXSTRICTRC) VMXR0RunGuestCode(PVMCPU pVCpu)
     10166{
     10167    PCPUMCTX pCtx = &pVCpu->cpum.GstCtx;
    1016810168    Assert(VMMRZCallRing3IsEnabled(pVCpu));
    1016910169    Assert(!ASMAtomicUoReadU64(&pCtx->fExtrn));
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.h

    r72805 r72967  
    4242VMMR0DECL(int)          VMXR0InvalidatePage(PVMCPU pVCpu, RTGCPTR GCVirt);
    4343VMMR0DECL(int)          VMXR0ImportStateOnDemand(PVMCPU pVCpu, uint64_t fWhat);
    44 VMMR0DECL(VBOXSTRICTRC) VMXR0RunGuestCode(PVMCPU pVCpu, PCPUMCTX pCtx);
     44VMMR0DECL(VBOXSTRICTRC) VMXR0RunGuestCode(PVMCPU pVCpu);
    4545DECLASM(int)            VMXR0StartVM32(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM, PVMCPU pVCpu);
    4646DECLASM(int)            VMXR0StartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM, PVMCPU pVCpu);
  • trunk/src/VBox/VMM/include/HMInternal.h

    r72966 r72967  
    11271127#endif /* IN_RING0 */
    11281128
    1129 int hmSvmEmulateMovTpr(PVMCPU pVCpu, PCPUMCTX pCtx);
     1129int hmSvmEmulateMovTpr(PVMCPU pVCpu);
    11301130
    11311131/** @} */
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