Index: trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp	(revision 48328)
+++ trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp	(revision 48329)
@@ -57,5 +57,4 @@
 #define HMSVM_EXIT_DECL                 static int
 
-
 /** @name Segment attribute conversion between CPU and AMD-V VMCB format.
  *
@@ -70,5 +69,4 @@
 #define HMSVM_VMCB_2_CPU_SEG_ATTR(a)       ( ((a) & 0xff) | (((a) & 0x0f00) << 4) )
 /** @} */
-
 
 /** @name Macros for loading, storing segment registers to/from the VMCB.
@@ -97,5 +95,4 @@
 /** @} */
 
-
 /** Macro for checking and returning from the using function for
  * \#VMEXIT intercepts that maybe caused during delivering of another
@@ -137,5 +134,4 @@
 #define HMSVM_CONTRIBUTORY_XCPT_MASK  (  RT_BIT(X86_XCPT_GP) | RT_BIT(X86_XCPT_NP) | RT_BIT(X86_XCPT_SS) | RT_BIT(X86_XCPT_TS) \
                                        | RT_BIT(X86_XCPT_DE))
-
 
 /** @name VMCB Clean Bits.
@@ -220,5 +216,4 @@
 /** @}  */
 
-
 /**
  * MSRPM (MSR permission bitmap) read permissions (for guest RDMSR).
@@ -243,4 +238,13 @@
 } SVMMSREXITWRITE;
 
+/**
+ * SVM VM-exit handler.
+ *
+ * @returns VBox status code.
+ * @param   pVCpu           Pointer to the VMCPU.
+ * @param   pMixedCtx       Pointer to the guest-CPU context.
+ * @param   pSvmTransient   Pointer to the SVM-transient structure.
+ */
+typedef int FNSVMEXITHANDLER(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
 
 /*******************************************************************************
@@ -251,34 +255,37 @@
 static void hmR0SvmLeave(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
 
-HMSVM_EXIT_DECL hmR0SvmExitIntr(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitWbinvd(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitInvd(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitCpuid(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitRdtsc(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitRdtscp(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitRdpmc(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitInvlpg(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitHlt(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitMonitor(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitMwait(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitShutdown(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitReadCRx(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitWriteCRx(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitSetPendingXcptUD(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitMsr(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitReadDRx(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitWriteDRx(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitIOInstr(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitNestedPF(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitVIntr(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitTaskSwitch(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitVmmCall(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitXcptPF(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitXcptNM(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitXcptMF(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
-HMSVM_EXIT_DECL hmR0SvmExitXcptDB(PVMCPU pVCpu, PCPUMCTX pCtx, PSVMTRANSIENT pSvmTransient);
+/** @name VM-exit handlers.
+ * @{
+ */
+static FNSVMEXITHANDLER hmR0SvmExitIntr;
+static FNSVMEXITHANDLER hmR0SvmExitWbinvd;
+static FNSVMEXITHANDLER hmR0SvmExitInvd;
+static FNSVMEXITHANDLER hmR0SvmExitCpuid;
+static FNSVMEXITHANDLER hmR0SvmExitRdtsc;
+static FNSVMEXITHANDLER hmR0SvmExitRdtscp;
+static FNSVMEXITHANDLER hmR0SvmExitRdpmc;
+static FNSVMEXITHANDLER hmR0SvmExitInvlpg;
+static FNSVMEXITHANDLER hmR0SvmExitHlt;
+static FNSVMEXITHANDLER hmR0SvmExitMonitor;
+static FNSVMEXITHANDLER hmR0SvmExitMwait;
+static FNSVMEXITHANDLER hmR0SvmExitShutdown;
+static FNSVMEXITHANDLER hmR0SvmExitReadCRx;
+static FNSVMEXITHANDLER hmR0SvmExitWriteCRx;
+static FNSVMEXITHANDLER hmR0SvmExitSetPendingXcptUD;
+static FNSVMEXITHANDLER hmR0SvmExitMsr;
+static FNSVMEXITHANDLER hmR0SvmExitReadDRx;
+static FNSVMEXITHANDLER hmR0SvmExitWriteDRx;
+static FNSVMEXITHANDLER hmR0SvmExitIOInstr;
+static FNSVMEXITHANDLER hmR0SvmExitNestedPF;
+static FNSVMEXITHANDLER hmR0SvmExitVIntr;
+static FNSVMEXITHANDLER hmR0SvmExitTaskSwitch;
+static FNSVMEXITHANDLER hmR0SvmExitVmmCall;
+static FNSVMEXITHANDLER hmR0SvmExitXcptPF;
+static FNSVMEXITHANDLER hmR0SvmExitXcptNM;
+static FNSVMEXITHANDLER hmR0SvmExitXcptMF;
+static FNSVMEXITHANDLER hmR0SvmExitXcptDB;
+/** @} */
 
 DECLINLINE(int) hmR0SvmHandleExit(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PSVMTRANSIENT pSvmTransient);
-
 
 /*******************************************************************************
@@ -1085,6 +1092,6 @@
         if (!pVM->hm.s.fNestedPaging)
         {
-            u64GuestCR0 |= X86_CR0_PG;  /* When Nested Paging is not available, use shadow page tables. */
-            u64GuestCR0 |= X86_CR0_WP;  /* Guest CPL 0 writes to its read-only pages should cause a #PF VM-exit. */
+            u64GuestCR0 |= X86_CR0_PG;     /* When Nested Paging is not available, use shadow page tables. */
+            u64GuestCR0 |= X86_CR0_WP;     /* Guest CPL 0 writes to its read-only pages should cause a #PF VM-exit. */
         }
 
@@ -1497,6 +1504,6 @@
     AssertRCReturn(rc, rc);
 
-    /** Assume that we need to trap all TPR accesses and thus need not check on
-     *  every #VMEXIT if we should update the TPR. */
+    /* Assume that we need to trap all TPR accesses and thus need not check on
+       every #VMEXIT if we should update the TPR. */
     Assert(pVmcb->ctrl.IntCtrl.n.u1VIrqMasking);
     pVCpu->hm.s.svm.fSyncVTpr = false;
@@ -1615,5 +1622,7 @@
             PVM         pVM  = pVCpu->CTX_SUFF(pVM);
             PCPUMCTX    pCtx = CPUMQueryGuestCtxPtr(pVCpu);
-            VMMRZCallRing3Disable(pVCpu);                        /* No longjmps (log-flush, locks) in this fragile context. */
+
+            /* No longjmps (log-flush, locks) in this fragile context. */
+            VMMRZCallRing3Disable(pVCpu);
 
             if (!pVCpu->hm.s.fLeaveDone)
@@ -1623,8 +1632,10 @@
             }
 
-            int rc = HMR0LeaveCpu(pVCpu);                         /* Leave HM context, takes care of local init (term). */
+            /* Leave HM context, takes care of local init (term). */
+            int rc = HMR0LeaveCpu(pVCpu);
             AssertRC(rc); NOREF(rc);
 
-            VMMRZCallRing3Enable(pVCpu);                         /* Restore longjmp state. */
+            /* Restore longjmp state. */
+            VMMRZCallRing3Enable(pVCpu);
             STAM_COUNTER_INC(&pVCpu->hm.s.StatPreemptPreempting);
             break;
@@ -1637,5 +1648,6 @@
             VMCPU_ASSERT_EMT(pVCpu);
 
-            VMMRZCallRing3Disable(pVCpu);                        /* No longjmps (log-flush, locks) in this fragile context. */
+            /* No longjmps (log-flush, locks) in this fragile context. */
+            VMMRZCallRing3Disable(pVCpu);
 
             /*
@@ -1648,5 +1660,7 @@
 
             pVCpu->hm.s.fLeaveDone = false;
-            VMMRZCallRing3Enable(pVCpu);                        /* Restore longjmp state. */
+
+            /* Restore longjmp state. */
+            VMMRZCallRing3Enable(pVCpu);
             break;
         }
Index: trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp	(revision 48328)
+++ trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp	(revision 48329)
@@ -293,5 +293,5 @@
 
 /**
- * VM-exit handler.
+ * VMX VM-exit handler.
  *
  * @returns VBox status code.
@@ -303,9 +303,9 @@
  */
 #ifndef HMVMX_USE_FUNCTION_TABLE
-typedef int FNVMEXITHANDLER(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
+typedef int FNVMXEXITHANDLER(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
 #else
-typedef DECLCALLBACK(int) FNVMEXITHANDLER(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
+typedef DECLCALLBACK(int) FNVMXEXITHANDLER(PVMCPU pVCpu, PCPUMCTX pMixedCtx, PVMXTRANSIENT pVmxTransient);
 /** Pointer to VM-exit handler. */
-typedef FNVMEXITHANDLER *PFNVMEXITHANDLER;
+typedef FNVMXEXITHANDLER *PFNVMXEXITHANDLER;
 #endif
 
@@ -332,48 +332,48 @@
  * @{
  */
-static FNVMEXITHANDLER hmR0VmxExitXcptOrNmi;
-static FNVMEXITHANDLER hmR0VmxExitExtInt;
-static FNVMEXITHANDLER hmR0VmxExitTripleFault;
-static FNVMEXITHANDLER hmR0VmxExitInitSignal;
-static FNVMEXITHANDLER hmR0VmxExitSipi;
-static FNVMEXITHANDLER hmR0VmxExitIoSmi;
-static FNVMEXITHANDLER hmR0VmxExitSmi;
-static FNVMEXITHANDLER hmR0VmxExitIntWindow;
-static FNVMEXITHANDLER hmR0VmxExitNmiWindow;
-static FNVMEXITHANDLER hmR0VmxExitTaskSwitch;
-static FNVMEXITHANDLER hmR0VmxExitCpuid;
-static FNVMEXITHANDLER hmR0VmxExitGetsec;
-static FNVMEXITHANDLER hmR0VmxExitHlt;
-static FNVMEXITHANDLER hmR0VmxExitInvd;
-static FNVMEXITHANDLER hmR0VmxExitInvlpg;
-static FNVMEXITHANDLER hmR0VmxExitRdpmc;
-static FNVMEXITHANDLER hmR0VmxExitRdtsc;
-static FNVMEXITHANDLER hmR0VmxExitRsm;
-static FNVMEXITHANDLER hmR0VmxExitSetPendingXcptUD;
-static FNVMEXITHANDLER hmR0VmxExitMovCRx;
-static FNVMEXITHANDLER hmR0VmxExitMovDRx;
-static FNVMEXITHANDLER hmR0VmxExitIoInstr;
-static FNVMEXITHANDLER hmR0VmxExitRdmsr;
-static FNVMEXITHANDLER hmR0VmxExitWrmsr;
-static FNVMEXITHANDLER hmR0VmxExitErrInvalidGuestState;
-static FNVMEXITHANDLER hmR0VmxExitErrMsrLoad;
-static FNVMEXITHANDLER hmR0VmxExitErrUndefined;
-static FNVMEXITHANDLER hmR0VmxExitMwait;
-static FNVMEXITHANDLER hmR0VmxExitMtf;
-static FNVMEXITHANDLER hmR0VmxExitMonitor;
-static FNVMEXITHANDLER hmR0VmxExitPause;
-static FNVMEXITHANDLER hmR0VmxExitErrMachineCheck;
-static FNVMEXITHANDLER hmR0VmxExitTprBelowThreshold;
-static FNVMEXITHANDLER hmR0VmxExitApicAccess;
-static FNVMEXITHANDLER hmR0VmxExitXdtrAccess;
-static FNVMEXITHANDLER hmR0VmxExitXdtrAccess;
-static FNVMEXITHANDLER hmR0VmxExitEptViolation;
-static FNVMEXITHANDLER hmR0VmxExitEptMisconfig;
-static FNVMEXITHANDLER hmR0VmxExitRdtscp;
-static FNVMEXITHANDLER hmR0VmxExitPreemptTimer;
-static FNVMEXITHANDLER hmR0VmxExitWbinvd;
-static FNVMEXITHANDLER hmR0VmxExitXsetbv;
-static FNVMEXITHANDLER hmR0VmxExitRdrand;
-static FNVMEXITHANDLER hmR0VmxExitInvpcid;
+static FNVMXEXITHANDLER hmR0VmxExitXcptOrNmi;
+static FNVMXEXITHANDLER hmR0VmxExitExtInt;
+static FNVMXEXITHANDLER hmR0VmxExitTripleFault;
+static FNVMXEXITHANDLER hmR0VmxExitInitSignal;
+static FNVMXEXITHANDLER hmR0VmxExitSipi;
+static FNVMXEXITHANDLER hmR0VmxExitIoSmi;
+static FNVMXEXITHANDLER hmR0VmxExitSmi;
+static FNVMXEXITHANDLER hmR0VmxExitIntWindow;
+static FNVMXEXITHANDLER hmR0VmxExitNmiWindow;
+static FNVMXEXITHANDLER hmR0VmxExitTaskSwitch;
+static FNVMXEXITHANDLER hmR0VmxExitCpuid;
+static FNVMXEXITHANDLER hmR0VmxExitGetsec;
+static FNVMXEXITHANDLER hmR0VmxExitHlt;
+static FNVMXEXITHANDLER hmR0VmxExitInvd;
+static FNVMXEXITHANDLER hmR0VmxExitInvlpg;
+static FNVMXEXITHANDLER hmR0VmxExitRdpmc;
+static FNVMXEXITHANDLER hmR0VmxExitRdtsc;
+static FNVMXEXITHANDLER hmR0VmxExitRsm;
+static FNVMXEXITHANDLER hmR0VmxExitSetPendingXcptUD;
+static FNVMXEXITHANDLER hmR0VmxExitMovCRx;
+static FNVMXEXITHANDLER hmR0VmxExitMovDRx;
+static FNVMXEXITHANDLER hmR0VmxExitIoInstr;
+static FNVMXEXITHANDLER hmR0VmxExitRdmsr;
+static FNVMXEXITHANDLER hmR0VmxExitWrmsr;
+static FNVMXEXITHANDLER hmR0VmxExitErrInvalidGuestState;
+static FNVMXEXITHANDLER hmR0VmxExitErrMsrLoad;
+static FNVMXEXITHANDLER hmR0VmxExitErrUndefined;
+static FNVMXEXITHANDLER hmR0VmxExitMwait;
+static FNVMXEXITHANDLER hmR0VmxExitMtf;
+static FNVMXEXITHANDLER hmR0VmxExitMonitor;
+static FNVMXEXITHANDLER hmR0VmxExitPause;
+static FNVMXEXITHANDLER hmR0VmxExitErrMachineCheck;
+static FNVMXEXITHANDLER hmR0VmxExitTprBelowThreshold;
+static FNVMXEXITHANDLER hmR0VmxExitApicAccess;
+static FNVMXEXITHANDLER hmR0VmxExitXdtrAccess;
+static FNVMXEXITHANDLER hmR0VmxExitXdtrAccess;
+static FNVMXEXITHANDLER hmR0VmxExitEptViolation;
+static FNVMXEXITHANDLER hmR0VmxExitEptMisconfig;
+static FNVMXEXITHANDLER hmR0VmxExitRdtscp;
+static FNVMXEXITHANDLER hmR0VmxExitPreemptTimer;
+static FNVMXEXITHANDLER hmR0VmxExitWbinvd;
+static FNVMXEXITHANDLER hmR0VmxExitXsetbv;
+static FNVMXEXITHANDLER hmR0VmxExitRdrand;
+static FNVMXEXITHANDLER hmR0VmxExitInvpcid;
 /** @} */
 
@@ -395,5 +395,5 @@
  * VMX_EXIT dispatch table.
  */
-static const PFNVMEXITHANDLER g_apfnVMExitHandlers[VMX_EXIT_MAX + 1] =
+static const PFNVMXEXITHANDLER g_apfnVMExitHandlers[VMX_EXIT_MAX + 1] =
 {
  /* 00  VMX_EXIT_XCPT_OR_NMI             */  hmR0VmxExitXcptOrNmi,
