Index: trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp	(revision 72965)
+++ trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp	(revision 72966)
@@ -116,7 +116,32 @@
 
 /** Assert that the required state bits are fetched. */
-#define HMSVM_CPUMCTX_ASSERT(a_pVCpu, a_fExtrnMbz)          AssertMsg(!((a_pVCpu)->cpum.GstCtx.fExtrn & (a_fExtrnMbz)), \
-                                                                      ("fExtrn=%#RX64 fExtrnMbz=%#RX64\n", \
-                                                                      (a_pVCpu)->cpum.GstCtx.fExtrn, (a_fExtrnMbz)))
+#define HMSVM_CPUMCTX_ASSERT(a_pVCpu, a_fExtrnMbz)      AssertMsg(!((a_pVCpu)->cpum.GstCtx.fExtrn & (a_fExtrnMbz)), \
+                                                                  ("fExtrn=%#RX64 fExtrnMbz=%#RX64\n", \
+                                                                  (a_pVCpu)->cpum.GstCtx.fExtrn, (a_fExtrnMbz)))
+
+/** Assert that preemption is disabled or covered by thread-context hooks. */
+#define HMSVM_ASSERT_PREEMPT_SAFE(a_pVCpu)              Assert(   VMMR0ThreadCtxHookIsEnabled((a_pVCpu)) \
+                                                               || !RTThreadPreemptIsEnabled(NIL_RTTHREAD));
+
+/** Assert that we haven't migrated CPUs when thread-context hooks are not
+ *  used. */
+#define HMSVM_ASSERT_CPU_SAFE(a_pVCpu)                  AssertMsg(   VMMR0ThreadCtxHookIsEnabled((a_pVCpu)) \
+                                                                  || (a_pVCpu)->hm.s.idEnteredCpu == RTMpCpuId(), \
+                                                                  ("Illegal migration! Entered on CPU %u Current %u\n", \
+                                                                   (a_pVCpu)->hm.s.idEnteredCpu, RTMpCpuId()));
+
+/** Assert that we're not executing a nested-guest. */
+#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
+# define HMSVM_ASSERT_NOT_IN_NESTED_GUEST(a_pCtx)       Assert(!CPUMIsGuestInSvmNestedHwVirtMode((a_pCtx)))
+#else
+# define HMSVM_ASSERT_NOT_IN_NESTED_GUEST(a_pCtx)       do { NOREF((a_pCtx)); } while (0)
+#endif
+
+/** Assert that we're executing a nested-guest. */
+#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
+# define HMSVM_ASSERT_IN_NESTED_GUEST(a_pCtx)           Assert(CPUMIsGuestInSvmNestedHwVirtMode((a_pCtx)))
+#else
+# define HMSVM_ASSERT_IN_NESTED_GUEST(a_pCtx)           do { NOREF((a_pCtx)); } while (0)
+#endif
 
 /** Macro for checking and returning from the using function for
@@ -167,29 +192,4 @@
             (a_rc) = VINF_EM_DBG_STEPPED; \
     } while (0)
-
-/** Assert that preemption is disabled or covered by thread-context hooks. */
-#define HMSVM_ASSERT_PREEMPT_SAFE()           Assert(   VMMR0ThreadCtxHookIsEnabled(pVCpu) \
-                                                     || !RTThreadPreemptIsEnabled(NIL_RTTHREAD));
-
-/** Assert that we haven't migrated CPUs when thread-context hooks are not
- *  used. */
-#define HMSVM_ASSERT_CPU_SAFE()               AssertMsg(   VMMR0ThreadCtxHookIsEnabled(pVCpu) \
-                                                        || pVCpu->hm.s.idEnteredCpu == RTMpCpuId(), \
-                                                        ("Illegal migration! Entered on CPU %u Current %u\n", \
-                                                        pVCpu->hm.s.idEnteredCpu, RTMpCpuId()));
-
-/** Assert that we're not executing a nested-guest. */
-#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
-# define HMSVM_ASSERT_NOT_IN_NESTED_GUEST(a_pCtx)       Assert(!CPUMIsGuestInSvmNestedHwVirtMode((a_pCtx)))
-#else
-# define HMSVM_ASSERT_NOT_IN_NESTED_GUEST(a_pCtx)       do { NOREF((a_pCtx)); } while (0)
-#endif
-
-/** Assert that we're executing a nested-guest. */
-#ifdef VBOX_WITH_NESTED_HWVIRT_SVM
-# define HMSVM_ASSERT_IN_NESTED_GUEST(a_pCtx)           Assert(CPUMIsGuestInSvmNestedHwVirtMode((a_pCtx)))
-#else
-# define HMSVM_ASSERT_IN_NESTED_GUEST(a_pCtx)           do { NOREF((a_pCtx)); } while (0)
-#endif
 
 /** Validate segment descriptor granularity bit. */
@@ -816,6 +816,6 @@
     if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     {
-        return    (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_VMCB_CLEAN)
-               && pVM->cpum.ro.GuestFeatures.fSvmVmcbClean;
+        return (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_VMCB_CLEAN)
+            &&  pVM->cpum.ro.GuestFeatures.fSvmVmcbClean;
     }
 #else
@@ -839,6 +839,6 @@
     if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     {
-        return    (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSISTS)
-               &&  pVM->cpum.ro.GuestFeatures.fSvmDecodeAssists;
+        return (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSISTS)
+            &&  pVM->cpum.ro.GuestFeatures.fSvmDecodeAssists;
     }
 #else
@@ -862,6 +862,6 @@
     if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))
     {
-        return    (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE)
-               &&  pVM->cpum.ro.GuestFeatures.fSvmNextRipSave;
+        return (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE)
+            &&  pVM->cpum.ro.GuestFeatures.fSvmNextRipSave;
     }
 #else
@@ -3232,5 +3232,5 @@
     Assert(pvUser);
     Assert(VMMRZCallRing3IsEnabled(pVCpu));
-    HMSVM_ASSERT_PREEMPT_SAFE();
+    HMSVM_ASSERT_PREEMPT_SAFE(pVCpu);
 
     VMMRZCallRing3Disable(pVCpu);
@@ -3263,5 +3263,5 @@
     Assert(pVCpu);
     Assert(pCtx);
-    HMSVM_ASSERT_PREEMPT_SAFE();
+    HMSVM_ASSERT_PREEMPT_SAFE(pVCpu);
 
     /* Please, no longjumps here (any logging shouldn't flush jump back to ring-3). NO LOGGING BEFORE THIS POINT! */
@@ -4084,5 +4084,5 @@
 static void hmR0SvmReportWorldSwitchError(PVMCPU pVCpu, int rcVMRun, PCPUMCTX pCtx)
 {
-    HMSVM_ASSERT_PREEMPT_SAFE();
+    HMSVM_ASSERT_PREEMPT_SAFE(pVCpu);
     HMSVM_ASSERT_NOT_IN_NESTED_GUEST(pCtx);
     HMSVM_CPUMCTX_IMPORT_STATE(pVCpu, HMSVM_CPUMCTX_EXTRN_ALL);
@@ -4328,5 +4328,5 @@
 static int hmR0SvmPreRunGuestNested(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
 {
-    HMSVM_ASSERT_PREEMPT_SAFE();
+    HMSVM_ASSERT_PREEMPT_SAFE(pVCpu);
     HMSVM_ASSERT_IN_NESTED_GUEST(pCtx);
 
@@ -4447,5 +4447,5 @@
 static int hmR0SvmPreRunGuest(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient)
 {
-    HMSVM_ASSERT_PREEMPT_SAFE();
+    HMSVM_ASSERT_PREEMPT_SAFE(pVCpu);
     HMSVM_ASSERT_NOT_IN_NESTED_GUEST(pCtx);
 
@@ -4877,5 +4877,5 @@
     {
         Assert(!HMR0SuspendPending());
-        HMSVM_ASSERT_CPU_SAFE();
+        HMSVM_ASSERT_CPU_SAFE(pVCpu);
 
         /* Preparatory work for running nested-guest code, this may force us to return to
@@ -5061,5 +5061,5 @@
     {
         Assert(!HMR0SuspendPending());
-        HMSVM_ASSERT_CPU_SAFE();
+        HMSVM_ASSERT_CPU_SAFE(pVCpu);
 
         /* Preparatory work for running nested-guest code, this may force us to return to
@@ -5138,5 +5138,5 @@
 {
     Assert(VMMRZCallRing3IsEnabled(pVCpu));
-    HMSVM_ASSERT_PREEMPT_SAFE();
+    HMSVM_ASSERT_PREEMPT_SAFE(pVCpu);
     VMMRZCallRing3SetNotification(pVCpu, hmR0SvmCallRing3Callback, pCtx);
 
@@ -5843,8 +5843,8 @@
         AssertPtr(pSvmTransient); \
         Assert(ASMIntAreEnabled()); \
-        HMSVM_ASSERT_PREEMPT_SAFE(); \
+        HMSVM_ASSERT_PREEMPT_SAFE(pVCpu); \
         HMSVM_ASSERT_PREEMPT_CPUID_VAR(); \
         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)); \
-        HMSVM_ASSERT_PREEMPT_SAFE(); \
+        HMSVM_ASSERT_PREEMPT_SAFE(pVCpu); \
         if (VMMR0IsLogFlushDisabled(pVCpu)) \
             HMSVM_ASSERT_PREEMPT_CPUID(); \
