Index: trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h
===================================================================
--- trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h	(revision 79232)
+++ trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h	(revision 79233)
@@ -808,5 +808,5 @@
  * Implements VMSucceed for VMX instruction success.
  *
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 DECL_FORCE_INLINE(void) iemVmxVmSucceed(PVMCPU pVCpu)
@@ -819,5 +819,5 @@
  * Implements VMFailInvalid for VMX instruction failure.
  *
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 DECL_FORCE_INLINE(void) iemVmxVmFailInvalid(PVMCPU pVCpu)
@@ -844,6 +844,6 @@
  *
  * @returns @c true if it's within the valid limit, @c false otherwise.
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   uMsrCount       The MSR area count to check.
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   uMsrCount   The MSR area count to check.
  */
 DECL_FORCE_INLINE(bool) iemVmxIsAutoMsrCountValid(PCVMCPU pVCpu, uint32_t uMsrCount)
@@ -862,9 +862,10 @@
  *
  * @returns VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 DECL_FORCE_INLINE(int) iemVmxCommitCurrentVmcsToMemory(PVMCPU pVCpu)
 {
     Assert(IEM_VMX_HAS_CURRENT_VMCS(pVCpu));
+    Assert(pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs));
     int rc = PGMPhysSimpleWriteGCPhys(pVCpu->CTX_SUFF(pVM), IEM_VMX_GET_CURRENT_VMCS(pVCpu),
                                       pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs), sizeof(VMXVVMCS));
@@ -877,5 +878,5 @@
  * Implements VMSucceed for the VMREAD instruction and increments the guest RIP.
  *
- * @param   pVCpu           The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 DECL_FORCE_INLINE(void) iemVmxVmreadSuccess(PVMCPU pVCpu, uint8_t cbInstr)
@@ -1139,5 +1140,5 @@
  * VM-exit.
  *
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC void iemVmxVmexitSaveGuestControlRegsMsrs(PVMCPU pVCpu)
@@ -1192,5 +1193,5 @@
  * Saves the guest force-flags in preparation of entering the nested-guest.
  *
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC void iemVmxVmentrySaveNmiBlockingFF(PVMCPU pVCpu)
@@ -1233,5 +1234,5 @@
  * Restores the guest force-flags in preparation of exiting the nested-guest.
  *
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC void iemVmxVmexitRestoreNmiBlockingFF(PVMCPU pVCpu)
@@ -1248,5 +1249,5 @@
  * Perform a VMX transition updated PGM, IEM and CPUM.
  *
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC int iemVmxWorldSwitch(PVMCPU pVCpu)
@@ -1285,5 +1286,6 @@
  * Calculates the current VMX-preemption timer value.
  *
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @returns The current VMX-preemption timer value.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC uint32_t iemVmxCalcPreemptTimer(PVMCPU pVCpu)
@@ -1332,5 +1334,5 @@
  * Saves guest segment registers, GDTR, IDTR, LDTR, TR as part of VM-exit.
  *
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC void iemVmxVmexitSaveGuestSegRegs(PVMCPU pVCpu)
@@ -2772,7 +2774,7 @@
  *
  * @returns Strict VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   GCPtrPage       The guest-linear address of the page being invalidated.
- * @param   cbInstr         The instruction length in bytes.
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   GCPtrPage   The guest-linear address of the page being invalidated.
+ * @param   cbInstr     The instruction length in bytes.
  */
 IEM_STATIC VBOXSTRICTRC iemVmxVmexitInstrInvlpg(PVMCPU pVCpu, RTGCPTR GCPtrPage, uint8_t cbInstr)
@@ -2908,12 +2910,12 @@
  *
  * @returns Strict VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   iCrReg          The control register (either CR0 or CR4).
- * @param   uGuestCrX       The current guest CR0/CR4.
- * @param   puNewCrX        Pointer to the new CR0/CR4 value. Will be updated
- *                          if no VM-exit is caused.
- * @param   iGReg           The general register from which the CR0/CR4 value is
- *                          being loaded.
- * @param   cbInstr         The instruction length in bytes.
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   iCrReg      The control register (either CR0 or CR4).
+ * @param   uGuestCrX   The current guest CR0/CR4.
+ * @param   puNewCrX    Pointer to the new CR0/CR4 value. Will be updated if no
+ *                      VM-exit is caused.
+ * @param   iGReg       The general register from which the CR0/CR4 value is being
+ *                      loaded.
+ * @param   cbInstr     The instruction length in bytes.
  */
 IEM_STATIC VBOXSTRICTRC iemVmxVmexitInstrMovToCr0Cr4(PVMCPU pVCpu, uint8_t iCrReg, uint64_t *puNewCrX, uint8_t iGReg,
@@ -3316,6 +3318,6 @@
  *
  * @returns VBox strict status code.
- * @param   pVCpu               The cross context virtual CPU structure.
- * @param   cbInstr             The instruction length in bytes.
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   cbInstr     The instruction length in bytes.
  */
 IEM_STATIC VBOXSTRICTRC iemVmxVmexitInstrPause(PVMCPU pVCpu, uint8_t cbInstr)
@@ -3487,5 +3489,5 @@
  *
  * @returns VBox strict status code.
- * @param   pVCpu           The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC VBOXSTRICTRC iemVmxVmexitPreemptTimer(PVMCPU pVCpu)
@@ -3595,5 +3597,5 @@
  *
  * @returns VBox strict status code.
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC VBOXSTRICTRC iemVmxVmexitEventDoubleFault(PVMCPU pVCpu)
@@ -3641,7 +3643,7 @@
  *
  * @returns VBox strict status code.
- * @param   pVCpu               The cross context virtual CPU structure.
- * @param   pExitInfo           Pointer to the VM-exit information.
- * @param   pExitEventInfo      Pointer to the VM-exit event information.
+ * @param   pVCpu           The cross context virtual CPU structure.
+ * @param   pExitInfo       Pointer to the VM-exit information.
+ * @param   pExitEventInfo  Pointer to the VM-exit event information.
  */
 IEM_STATIC VBOXSTRICTRC iemVmxVmexitEventWithInfo(PVMCPU pVCpu, PCVMXVEXITINFO pExitInfo, PCVMXVEXITEVENTINFO pExitEventInfo)
@@ -3789,5 +3791,5 @@
  *
  * @returns VBox strict status code.
- * @param   pVCpu               The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC VBOXSTRICTRC iemVmxVmexitTripleFault(PVMCPU pVCpu)
@@ -3845,7 +3847,7 @@
  *
  * @returns VBox strict status code.
- * @param   pVCpu               The cross context virtual CPU structure.
- * @param   pExitInfo           Pointer to the VM-exit information.
- * @param   pExitEventInfo      Pointer to the VM-exit event information.
+ * @param   pVCpu           The cross context virtual CPU structure.
+ * @param   pExitInfo       Pointer to the VM-exit information.
+ * @param   pExitEventInfo  Pointer to the VM-exit event information.
  */
 IEM_STATIC VBOXSTRICTRC iemVmxVmexitApicAccessWithInfo(PVMCPU pVCpu, PCVMXVEXITINFO pExitInfo,
@@ -3908,5 +3910,5 @@
  *
  * @returns The virtual-APIC offset that was written before clearing it.
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 DECLINLINE(uint16_t) iemVmxVirtApicClearPendingWrite(PVMCPU pVCpu)
@@ -3925,6 +3927,6 @@
  *
  * @returns The register from the virtual-APIC page.
- * @param   pVCpu       The cross context virtual CPU structure.
- * @param   offReg      The offset of the register being read.
+ * @param   pVCpu   The cross context virtual CPU structure.
+ * @param   offReg  The offset of the register being read.
  */
 IEM_STATIC uint32_t iemVmxVirtApicReadRaw32(PVMCPU pVCpu, uint16_t offReg)
@@ -3951,6 +3953,6 @@
  *
  * @returns The register from the virtual-APIC page.
- * @param   pVCpu       The cross context virtual CPU structure.
- * @param   offReg      The offset of the register being read.
+ * @param   pVCpu   The cross context virtual CPU structure.
+ * @param   offReg  The offset of the register being read.
  */
 IEM_STATIC uint64_t iemVmxVirtApicReadRaw64(PVMCPU pVCpu, uint16_t offReg)
@@ -3976,7 +3978,7 @@
  * Writes a 32-bit register to the virtual-APIC page at the given offset.
  *
- * @param   pVCpu       The cross context virtual CPU structure.
- * @param   offReg      The offset of the register being written.
- * @param   uReg        The register value to write.
+ * @param   pVCpu   The cross context virtual CPU structure.
+ * @param   offReg  The offset of the register being written.
+ * @param   uReg    The register value to write.
  */
 IEM_STATIC void iemVmxVirtApicWriteRaw32(PVMCPU pVCpu, uint16_t offReg, uint32_t uReg)
@@ -3998,7 +4000,7 @@
  * Writes a 64-bit register to the virtual-APIC page at the given offset.
  *
- * @param   pVCpu       The cross context virtual CPU structure.
- * @param   offReg      The offset of the register being written.
- * @param   uReg        The register value to write.
+ * @param   pVCpu   The cross context virtual CPU structure.
+ * @param   offReg  The offset of the register being written.
+ * @param   uReg    The register value to write.
  */
 IEM_STATIC void iemVmxVirtApicWriteRaw64(PVMCPU pVCpu, uint16_t offReg, uint64_t uReg)
@@ -4541,5 +4543,5 @@
  * Evaluates pending virtual interrupts.
  *
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC void iemVmxEvalPendingVirtIntrs(PVMCPU pVCpu)
@@ -4569,5 +4571,5 @@
  *
  * @returns VBox strict status code.
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC void iemVmxPprVirtualization(PVMCPU pVCpu)
@@ -4602,5 +4604,5 @@
  *
  * @returns VBox strict status code.
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC VBOXSTRICTRC iemVmxTprVirtualization(PVMCPU pVCpu)
@@ -4713,5 +4715,5 @@
  *
  * @returns VBox strict status code.
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC VBOXSTRICTRC iemVmxSelfIpiVirtualization(PVMCPU pVCpu)
@@ -4743,5 +4745,5 @@
  *
  * @returns VBox strict status code.
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC VBOXSTRICTRC iemVmxApicWriteEmulation(PVMCPU pVCpu)
@@ -4980,6 +4982,6 @@
  * Checks guest segment registers, LDTR and TR as part of VM-entry.
  *
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   pszInstr        The VMX instruction name (for logging purposes).
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pszInstr    The VMX instruction name (for logging purposes).
  */
 IEM_STATIC int iemVmxVmentryCheckGuestSegRegs(PVMCPU pVCpu, const char *pszInstr)
@@ -5368,6 +5370,6 @@
  * Checks guest GDTR and IDTR as part of VM-entry.
  *
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   pszInstr        The VMX instruction name (for logging purposes).
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pszInstr    The VMX instruction name (for logging purposes).
  */
 IEM_STATIC int iemVmxVmentryCheckGuestGdtrIdtr(PVMCPU pVCpu,  const char *pszInstr)
@@ -5414,6 +5416,6 @@
  * Checks guest RIP and RFLAGS as part of VM-entry.
  *
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   pszInstr        The VMX instruction name (for logging purposes).
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pszInstr    The VMX instruction name (for logging purposes).
  */
 IEM_STATIC int iemVmxVmentryCheckGuestRipRFlags(PVMCPU pVCpu, const char *pszInstr)
@@ -5488,6 +5490,6 @@
  * Checks guest non-register state as part of VM-entry.
  *
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   pszInstr        The VMX instruction name (for logging purposes).
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pszInstr    The VMX instruction name (for logging purposes).
  */
 IEM_STATIC int iemVmxVmentryCheckGuestNonRegState(PVMCPU pVCpu,  const char *pszInstr)
@@ -5780,6 +5782,6 @@
  * Checks guest PDPTEs as part of VM-entry.
  *
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   pszInstr        The VMX instruction name (for logging purposes).
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pszInstr    The VMX instruction name (for logging purposes).
  */
 IEM_STATIC int iemVmxVmentryCheckGuestPdptes(PVMCPU pVCpu, const char *pszInstr)
@@ -5816,6 +5818,6 @@
  *
  * @returns VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   pszInstr        The VMX instruction name (for logging purposes).
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pszInstr    The VMX instruction name (for logging purposes).
  */
 IEM_STATIC int iemVmxVmentryCheckGuestState(PVMCPU pVCpu, const char *pszInstr)
@@ -5848,6 +5850,6 @@
  *
  * @returns VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   pszInstr        The VMX instruction name (for logging purposes).
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pszInstr    The VMX instruction name (for logging purposes).
  */
 IEM_STATIC int iemVmxVmentryCheckHostState(PVMCPU pVCpu, const char *pszInstr)
@@ -6052,6 +6054,6 @@
  *
  * @returns VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   pszInstr        The VMX instruction name (for logging purposes).
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pszInstr    The VMX instruction name (for logging purposes).
  */
 IEM_STATIC int iemVmxVmentryCheckEntryCtls(PVMCPU pVCpu, const char *pszInstr)
@@ -6160,6 +6162,6 @@
  *
  * @returns VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   pszInstr        The VMX instruction name (for logging purposes).
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pszInstr    The VMX instruction name (for logging purposes).
  */
 IEM_STATIC int iemVmxVmentryCheckExitCtls(PVMCPU pVCpu, const char *pszInstr)
@@ -6220,6 +6222,6 @@
  *
  * @returns VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   pszInstr        The VMX instruction name (for logging purposes).
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pszInstr    The VMX instruction name (for logging purposes).
  *
  * @remarks This may update secondary-processor based VM-execution control fields
@@ -6788,5 +6790,5 @@
  *
  * @returns VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  *
  * @remarks This must be called only after loading the nested-guest register state
@@ -6845,6 +6847,6 @@
  *
  * @returns VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   pszInstr        The VMX instruction name (for logging purposes).
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pszInstr    The VMX instruction name (for logging purposes).
  *
  * @remarks This must be done after all the necessary steps prior to loading of
@@ -7184,5 +7186,5 @@
  * Initializes all read-only VMCS fields as part of VM-entry.
  *
- * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   pVCpu   The cross context virtual CPU structure.
  */
 IEM_STATIC void iemVmxVmentryInitReadOnlyFields(PVMCPU pVCpu)
@@ -7229,8 +7231,8 @@
  *
  * @returns Strict VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   cbInstr         The instruction length in bytes.
- * @param   uInstrId        The instruction identity (VMXINSTRID_VMLAUNCH or
- *                          VMXINSTRID_VMRESUME).
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   cbInstr     The instruction length in bytes.
+ * @param   uInstrId    The instruction identity (VMXINSTRID_VMLAUNCH or
+ *                      VMXINSTRID_VMRESUME).
  *
  * @remarks Common VMX instruction checks are already expected to by the caller,
@@ -7886,10 +7888,9 @@
  *
  * @returns Strict VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   cbInstr         The instruction length in bytes.
- * @param   iEffSeg         The effective segment register to use with @a GCPtrVmcs.
- * @param   GCPtrVmcs       The linear address of the VMCS pointer.
- * @param   pExitInfo       Pointer to the VM-exit information. Optional, can be
- *                          NULL.
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   cbInstr     The instruction length in bytes.
+ * @param   iEffSeg     The effective segment register to use with @a GCPtrVmcs.
+ * @param   GCPtrVmcs   The linear address of the VMCS pointer.
+ * @param   pExitInfo   Pointer to the VM-exit information. Optional, can be NULL.
  *
  * @remarks Common VMX instruction checks are already expected to by the caller,
@@ -7991,6 +7992,4 @@
         && IEM_VMX_GET_CURRENT_VMCS(pVCpu) == GCPhysVmcs)
     {
-        Assert(GCPhysVmcs != NIL_RTGCPHYS);                     /* Paranoia. */
-        Assert(pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs));
         pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pVmcs)->fVmcsState = fVmcsLaunchStateClear;
         iemVmxCommitCurrentVmcsToMemory(pVCpu);
@@ -8016,11 +8015,10 @@
  *
  * @returns Strict VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   cbInstr         The instruction length in bytes.
- * @param   iEffSeg         The effective segment register to use with @a GCPtrVmcs.
- * @param   GCPtrVmcs       The linear address of where to store the current VMCS
- *                          pointer.
- * @param   pExitInfo       Pointer to the VM-exit information. Optional, can be
- *                          NULL.
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   cbInstr     The instruction length in bytes.
+ * @param   iEffSeg     The effective segment register to use with @a GCPtrVmcs.
+ * @param   GCPtrVmcs   The linear address of where to store the current VMCS
+ *                      pointer.
+ * @param   pExitInfo   Pointer to the VM-exit information. Optional, can be NULL.
  *
  * @remarks Common VMX instruction checks are already expected to by the caller,
@@ -8070,9 +8068,8 @@
  *
  * @returns Strict VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   cbInstr         The instruction length in bytes.
- * @param   GCPtrVmcs       The linear address of the current VMCS pointer.
- * @param   pExitInfo       Pointer to the VM-exit information. Optional, can be
- *                          NULL.
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   cbInstr     The instruction length in bytes.
+ * @param   GCPtrVmcs   The linear address of the current VMCS pointer.
+ * @param   pExitInfo   Pointer to the VM-exit information. Optional, can be NULL.
  *
  * @remarks Common VMX instruction checks are already expected to by the caller,
@@ -8410,11 +8407,10 @@
  *
  * @returns Strict VBox status code.
- * @param   pVCpu           The cross context virtual CPU structure.
- * @param   cbInstr         The instruction length in bytes.
- * @param   iEffSeg         The effective segment register to use with @a
- *                          GCPtrVmxon.
- * @param   GCPtrVmxon      The linear address of the VMXON pointer.
- * @param   pExitInfo       Pointer to the VM-exit information. Optional, can be
- *                          NULL.
+ * @param   pVCpu       The cross context virtual CPU structure.
+ * @param   cbInstr     The instruction length in bytes.
+ * @param   iEffSeg     The effective segment register to use with @a
+ *                      GCPtrVmxon.
+ * @param   GCPtrVmxon  The linear address of the VMXON pointer.
+ * @param   pExitInfo   Pointer to the VM-exit information. Optional, can be NULL.
  *
  * @remarks Common VMX instruction checks are already expected to by the caller,
