Index: /trunk/include/VBox/vmm/hmvmxinline.h
===================================================================
--- /trunk/include/VBox/vmm/hmvmxinline.h	(revision 82683)
+++ /trunk/include/VBox/vmm/hmvmxinline.h	(revision 82684)
@@ -457,66 +457,4 @@
 
 
-#if 0
-#if ((RT_INLINE_ASM_EXTERNAL || !defined(RT_ARCH_X86)) && !VMX_USE_MSC_INTRINSICS)
-DECLASM(int) VMXEnable(RTHCPHYS HCPhysVmxOn);
-#else
-DECLINLINE(int) VMXEnable(RTHCPHYS HCPhysVmxOn)
-{
-# if RT_INLINE_ASM_GNU_STYLE
-    int rc = VINF_SUCCESS;
-    __asm__ __volatile__ (
-       "push     %3                                             \n\t"
-       "push     %2                                             \n\t"
-       ".byte    0xf3, 0x0f, 0xc7, 0x34, 0x24  # VMXON [esp]    \n\t"
-       "ja       2f                                             \n\t"
-       "je       1f                                             \n\t"
-       "movl     $" RT_XSTR(VERR_VMX_INVALID_VMXON_PTR)", %0    \n\t"
-       "jmp      2f                                             \n\t"
-       "1:                                                      \n\t"
-       "movl     $" RT_XSTR(VERR_VMX_VMXON_FAILED)", %0         \n\t"
-       "2:                                                      \n\t"
-       "add      $8, %%esp                                      \n\t"
-       :"=rm"(rc)
-       :"0"(VINF_SUCCESS),
-        "ir"((uint32_t)HCPhysVmxOn),        /* don't allow direct memory reference here, */
-        "ir"((uint32_t)(HCPhysVmxOn >> 32)) /* this would not work with -fomit-frame-pointer */
-       :"memory"
-       );
-    return rc;
-
-# elif VMX_USE_MSC_INTRINSICS
-    unsigned char rcMsc = __vmx_on(&HCPhysVmxOn);
-    if (RT_LIKELY(rcMsc == 0))
-        return VINF_SUCCESS;
-    return rcMsc == 2 ? VERR_VMX_INVALID_VMXON_PTR : VERR_VMX_VMXON_FAILED;
-
-# else
-    int rc = VINF_SUCCESS;
-    __asm
-    {
-        push    dword ptr [HCPhysVmxOn + 4]
-        push    dword ptr [HCPhysVmxOn]
-        _emit   0xf3
-        _emit   0x0f
-        _emit   0xc7
-        _emit   0x34
-        _emit   0x24     /* VMXON [esp] */
-        jnc     vmxon_good
-        mov     dword ptr [rc], VERR_VMX_INVALID_VMXON_PTR
-        jmp     the_end
-
-vmxon_good:
-        jnz     the_end
-        mov     dword ptr [rc], VERR_VMX_VMXON_FAILED
-the_end:
-        add     esp, 8
-    }
-    return rc;
-# endif
-}
-#endif
-#endif
-
-
 /**
  * Executes VMXOFF.
@@ -547,31 +485,4 @@
 # endif
 }
-#endif
-
-
-#if 0
-#if ((RT_INLINE_ASM_EXTERNAL || !defined(RT_ARCH_X86)) && !VMX_USE_MSC_INTRINSICS)
-DECLASM(void) VMXDisable(void);
-#else
-DECLINLINE(void) VMXDisable(void)
-{
-# if RT_INLINE_ASM_GNU_STYLE
-    __asm__ __volatile__ (
-       ".byte 0x0f, 0x01, 0xc4  # VMXOFF                        \n\t"
-       );
-
-# elif VMX_USE_MSC_INTRINSICS
-    __vmx_off();
-
-# else
-    __asm
-    {
-        _emit   0x0f
-        _emit   0x01
-        _emit   0xc4   /* VMXOFF */
-    }
-# endif
-}
-#endif
 #endif
 
@@ -655,57 +566,4 @@
 
 
-#if 0
-#if ((RT_INLINE_ASM_EXTERNAL || !defined(RT_ARCH_X86)) && !VMX_USE_MSC_INTRINSICS)
-DECLASM(int) VMXClearVmcs(RTHCPHYS HCPhysVmcs);
-#else
-DECLINLINE(int) VMXClearVmcs(RTHCPHYS HCPhysVmcs)
-{
-# if RT_INLINE_ASM_GNU_STYLE
-    int rc = VINF_SUCCESS;
-    __asm__ __volatile__ (
-       "push    %3                                              \n\t"
-       "push    %2                                              \n\t"
-       ".byte   0x66, 0x0f, 0xc7, 0x34, 0x24  # VMCLEAR [esp]   \n\t"
-       "jnc     1f                                              \n\t"
-       "movl    $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0      \n\t"
-       "1:                                                      \n\t"
-       "add     $8, %%esp                                       \n\t"
-       :"=rm"(rc)
-       :"0"(VINF_SUCCESS),
-        "ir"((uint32_t)HCPhysVmcs),        /* don't allow direct memory reference here, */
-        "ir"((uint32_t)(HCPhysVmcs >> 32)) /* this would not work with -fomit-frame-pointer */
-       :"memory"
-       );
-    return rc;
-
-# elif VMX_USE_MSC_INTRINSICS
-    unsigned char rcMsc = __vmx_vmclear(&HCPhysVmcs);
-    if (RT_LIKELY(rcMsc == 0))
-        return VINF_SUCCESS;
-    return VERR_VMX_INVALID_VMCS_PTR;
-
-# else
-    int rc = VINF_SUCCESS;
-    __asm
-    {
-        push    dword ptr [HCPhysVmcs + 4]
-        push    dword ptr [HCPhysVmcs]
-        _emit   0x66
-        _emit   0x0f
-        _emit   0xc7
-        _emit   0x34
-        _emit   0x24     /* VMCLEAR [esp] */
-        jnc     success
-        mov     dword ptr [rc], VERR_VMX_INVALID_VMCS_PTR
-success:
-        add     esp, 8
-    }
-    return rc;
-# endif
-}
-#endif
-#endif
-
-
 /**
  * Executes VMPTRLD.
@@ -782,55 +640,4 @@
 # endif
 }
-#endif
-
-#if 0
-#if ((RT_INLINE_ASM_EXTERNAL || !defined(RT_ARCH_X86)) && !VMX_USE_MSC_INTRINSICS)
-DECLASM(int) VMXLoadVmcs(RTHCPHYS HCPhysVmcs);
-#else
-DECLINLINE(int) VMXLoadVmcs(RTHCPHYS HCPhysVmcs)
-{
-# if RT_INLINE_ASM_GNU_STYLE
-    int rc = VINF_SUCCESS;
-    __asm__ __volatile__ (
-       "push    %3                                              \n\t"
-       "push    %2                                              \n\t"
-       ".byte   0x0f, 0xc7, 0x34, 0x24  # VMPTRLD [esp]         \n\t"
-       "jnc     1f                                              \n\t"
-       "movl    $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0      \n\t"
-       "1:                                                      \n\t"
-       "add     $8, %%esp                                       \n\t"
-       :"=rm"(rc)
-       :"0"(VINF_SUCCESS),
-        "ir"((uint32_t)HCPhysVmcs),        /* don't allow direct memory reference here, */
-        "ir"((uint32_t)(HCPhysVmcs >> 32)) /* this will not work with -fomit-frame-pointer */
-       );
-    return rc;
-
-# elif VMX_USE_MSC_INTRINSICS
-    unsigned char rcMsc = __vmx_vmptrld(&HCPhysVmcs);
-    if (RT_LIKELY(rcMsc == 0))
-        return VINF_SUCCESS;
-    return VERR_VMX_INVALID_VMCS_PTR;
-
-# else
-    int rc = VINF_SUCCESS;
-    __asm
-    {
-        push    dword ptr [HCPhysVmcs + 4]
-        push    dword ptr [HCPhysVmcs]
-        _emit   0x0f
-        _emit   0xc7
-        _emit   0x34
-        _emit   0x24     /* VMPTRLD [esp] */
-        jnc     success
-        mov     dword ptr [rc], VERR_VMX_INVALID_VMCS_PTR
-
-success:
-        add     esp, 8
-    }
-    return rc;
-# endif
-}
-#endif
 #endif
 
@@ -932,61 +739,4 @@
 
 
-#if 0
-#if ((RT_INLINE_ASM_EXTERNAL || !defined(RT_ARCH_X86)) && !VMX_USE_MSC_INTRINSICS)
-DECLASM(int) VMXWriteVmcs32(uint32_t uFieldEnc, uint32_t u32Val);
-#else
-DECLINLINE(int) VMXWriteVmcs32(uint32_t uFieldEnc, uint32_t u32Val)
-{
-# if RT_INLINE_ASM_GNU_STYLE
-    int rc = VINF_SUCCESS;
-    __asm__ __volatile__ (
-       ".byte  0x0f, 0x79, 0xc2        # VMWRITE eax, edx       \n\t"
-       "ja     2f                                               \n\t"
-       "je     1f                                               \n\t"
-       "movl   $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0       \n\t"
-       "jmp    2f                                               \n\t"
-       "1:                                                      \n\t"
-       "movl   $" RT_XSTR(VERR_VMX_INVALID_VMCS_FIELD)", %0     \n\t"
-       "2:                                                      \n\t"
-       :"=rm"(rc)
-       :"0"(VINF_SUCCESS),
-        "a"(uFieldEnc),
-        "d"(u32Val)
-       );
-    return rc;
-
-# elif VMX_USE_MSC_INTRINSICS
-     unsigned char rcMsc = __vmx_vmwrite(uFieldEnc, u32Val);
-     if (RT_LIKELY(rcMsc == 0))
-         return VINF_SUCCESS;
-     return rcMsc == 2 ? VERR_VMX_INVALID_VMCS_PTR : VERR_VMX_INVALID_VMCS_FIELD;
-
-#else
-    int rc = VINF_SUCCESS;
-    __asm
-    {
-        push   dword ptr [u32Val]
-        mov    eax, [uFieldEnc]
-        _emit  0x0f
-        _emit  0x79
-        _emit  0x04
-        _emit  0x24     /* VMWRITE eax, [esp] */
-        jnc    valid_vmcs
-        mov    dword ptr [rc], VERR_VMX_INVALID_VMCS_PTR
-        jmp    the_end
-
-valid_vmcs:
-        jnz    the_end
-        mov    dword ptr [rc], VERR_VMX_INVALID_VMCS_FIELD
-the_end:
-        add    esp, 4
-    }
-    return rc;
-# endif
-}
-#endif
-#endif
-
-
 /**
  * Executes VMWRITE for a 64-bit field.
@@ -1051,19 +801,4 @@
 # endif
 }
-#endif
-
-
-#if 0
-#if (defined(RT_ARCH_AMD64) && VMX_USE_MSC_INTRINSICS)
-DECLINLINE(int) VMXWriteVmcs64(uint32_t uFieldEnc, uint64_t u64Val)
-{
-    unsigned char rcMsc = __vmx_vmwrite(uFieldEnc, u64Val);
-    if (RT_LIKELY(rcMsc == 0))
-        return VINF_SUCCESS;
-    return rcMsc == 2 ? VERR_VMX_INVALID_VMCS_PTR : VERR_VMX_INVALID_VMCS_FIELD;
-}
-#else
-DECLASM(int) VMXWriteVmcs64(uint32_t uFieldEnc, uint64_t u64Val);
-#endif
 #endif
 
@@ -1213,12 +948,47 @@
 #endif
 
-#if 0
-#if ((RT_INLINE_ASM_EXTERNAL || !defined(RT_ARCH_X86)) && !VMX_USE_MSC_INTRINSICS)
-DECLASM(int) VMXReadVmcs32(uint32_t uFieldEnc, uint32_t *pData);
+
+/**
+ * Executes VMREAD for a 64-bit field.
+ *
+ * @returns VBox status code.
+ * @retval  VINF_SUCCESS.
+ * @retval  VERR_VMX_INVALID_VMCS_PTR.
+ * @retval  VERR_VMX_INVALID_VMCS_FIELD.
+ *
+ * @param   uFieldEnc       The VMCS field encoding.
+ * @param   pData           Where to store VMCS field value.
+ *
+ * @remarks The values of the two status codes can be OR'ed together, the result
+ *          will be VERR_VMX_INVALID_VMCS_PTR.
+ */
+#if defined(RT_ARCH_X86) || (RT_INLINE_ASM_EXTERNAL && !VMX_USE_MSC_INTRINSICS)
+DECLASM(int) VMXReadVmcs64(uint32_t uFieldEnc, uint64_t *pData);
 #else
-DECLINLINE(int) VMXReadVmcs32(uint32_t uFieldEnc, uint32_t *pData)
-{
-# if RT_INLINE_ASM_GNU_STYLE
-    int rc = VINF_SUCCESS;
+DECLINLINE(int) VMXReadVmcs64(uint32_t uFieldEnc, uint64_t *pData)
+{
+# if VMX_USE_MSC_INTRINSICS
+#  ifdef VBOX_WITH_VMREAD_VMWRITE_NOCHECK
+    __vmx_vmread(uFieldEnc, pData);
+    return VINF_SUCCESS;
+#  else
+    unsigned char rcMsc;
+    rcMsc = __vmx_vmread(uFieldEnc, pData);
+    if (RT_LIKELY(rcMsc == 0))
+        return VINF_SUCCESS;
+    return rcMsc == 2 ? VERR_VMX_INVALID_VMCS_PTR : VERR_VMX_INVALID_VMCS_FIELD;
+#  endif
+
+# elif RT_INLINE_ASM_GNU_STYLE
+#  ifdef VBOX_WITH_VMREAD_VMWRITE_NOCHECK
+    __asm__ __volatile__ (
+       ".byte  0x0f, 0x78, 0xc2        # VMREAD eax, edx         \n\t"
+       :"=d"(*pData)
+       :"a"(uFieldEnc),
+        "d"(0)
+       );
+    return VINF_SUCCESS;
+#  else
+    int rc;
     __asm__ __volatile__ (
        "movl   $" RT_XSTR(VINF_SUCCESS)", %0                     \n\t"
@@ -1237,105 +1007,4 @@
        );
     return rc;
-
-# elif VMX_USE_MSC_INTRINSICS
-    unsigned char rcMsc;
-#  ifdef RT_ARCH_X86
-    rcMsc = __vmx_vmread(uFieldEnc, pData);
-#  else
-    uint64_t u64Tmp;
-    rcMsc = __vmx_vmread(uFieldEnc, &u64Tmp);
-    *pData = (uint32_t)u64Tmp;
-#  endif
-    if (RT_LIKELY(rcMsc == 0))
-        return VINF_SUCCESS;
-    return rcMsc == 2 ? VERR_VMX_INVALID_VMCS_PTR : VERR_VMX_INVALID_VMCS_FIELD;
-
-#else
-    int rc = VINF_SUCCESS;
-    __asm
-    {
-        sub     esp, 4
-        mov     dword ptr [esp], 0
-        mov     eax, [uFieldEnc]
-        _emit   0x0f
-        _emit   0x78
-        _emit   0x04
-        _emit   0x24     /* VMREAD eax, [esp] */
-        mov     edx, pData
-        pop     dword ptr [edx]
-        jnc     valid_vmcs
-        mov     dword ptr [rc], VERR_VMX_INVALID_VMCS_PTR
-        jmp     the_end
-
-valid_vmcs:
-        jnz     the_end
-        mov     dword ptr [rc], VERR_VMX_INVALID_VMCS_FIELD
-the_end:
-    }
-    return rc;
-# endif
-}
-#endif
-#endif
-
-
-/**
- * Executes VMREAD for a 64-bit field.
- *
- * @returns VBox status code.
- * @retval  VINF_SUCCESS.
- * @retval  VERR_VMX_INVALID_VMCS_PTR.
- * @retval  VERR_VMX_INVALID_VMCS_FIELD.
- *
- * @param   uFieldEnc       The VMCS field encoding.
- * @param   pData           Where to store VMCS field value.
- *
- * @remarks The values of the two status codes can be OR'ed together, the result
- *          will be VERR_VMX_INVALID_VMCS_PTR.
- */
-#if defined(RT_ARCH_X86) || (RT_INLINE_ASM_EXTERNAL && !VMX_USE_MSC_INTRINSICS)
-DECLASM(int) VMXReadVmcs64(uint32_t uFieldEnc, uint64_t *pData);
-#else
-DECLINLINE(int) VMXReadVmcs64(uint32_t uFieldEnc, uint64_t *pData)
-{
-# if VMX_USE_MSC_INTRINSICS
-#  ifdef VBOX_WITH_VMREAD_VMWRITE_NOCHECK
-    __vmx_vmread(uFieldEnc, pData);
-    return VINF_SUCCESS;
-#  else
-    unsigned char rcMsc;
-    rcMsc = __vmx_vmread(uFieldEnc, pData);
-    if (RT_LIKELY(rcMsc == 0))
-        return VINF_SUCCESS;
-    return rcMsc == 2 ? VERR_VMX_INVALID_VMCS_PTR : VERR_VMX_INVALID_VMCS_FIELD;
-#  endif
-
-# elif RT_INLINE_ASM_GNU_STYLE
-#  ifdef VBOX_WITH_VMREAD_VMWRITE_NOCHECK
-    __asm__ __volatile__ (
-       ".byte  0x0f, 0x78, 0xc2        # VMREAD eax, edx         \n\t"
-       :"=d"(*pData)
-       :"a"(uFieldEnc),
-        "d"(0)
-       );
-    return VINF_SUCCESS;
-#  else
-    int rc;
-    __asm__ __volatile__ (
-       "movl   $" RT_XSTR(VINF_SUCCESS)", %0                     \n\t"
-       ".byte  0x0f, 0x78, 0xc2        # VMREAD eax, edx         \n\t"
-       "ja     2f                                                \n\t"
-       "je     1f                                                \n\t"
-       "movl   $" RT_XSTR(VERR_VMX_INVALID_VMCS_PTR)", %0        \n\t"
-       "jmp    2f                                                \n\t"
-       "1:                                                       \n\t"
-       "movl   $" RT_XSTR(VERR_VMX_INVALID_VMCS_FIELD)", %0      \n\t"
-       "2:                                                       \n\t"
-       :"=&r"(rc),
-        "=d"(*pData)
-       :"a"(uFieldEnc),
-        "d"(0)
-       );
-    return rc;
 #  endif
 # else
@@ -1343,42 +1012,4 @@
 # endif
 }
-#endif
-
-
-#if 0
-#if (!defined(RT_ARCH_X86) && !VMX_USE_MSC_INTRINSICS)
-DECLASM(int) VMXReadVmcs64(uint32_t uFieldEnc, uint64_t *pData);
-#else
-DECLINLINE(int) VMXReadVmcs64(uint32_t uFieldEnc, uint64_t *pData)
-{
-# if VMX_USE_MSC_INTRINSICS
-    unsigned char rcMsc;
-#  ifdef RT_ARCH_X86
-    size_t        uLow;
-    size_t        uHigh;
-    rcMsc  = __vmx_vmread(uFieldEnc, &uLow);
-    rcMsc |= __vmx_vmread(uFieldEnc + 1, &uHigh);
-    *pData = RT_MAKE_U64(uLow, uHigh);
-# else
-    rcMsc = __vmx_vmread(uFieldEnc, pData);
-# endif
-    if (RT_LIKELY(rcMsc == 0))
-        return VINF_SUCCESS;
-    return rcMsc == 2 ? VERR_VMX_INVALID_VMCS_PTR : VERR_VMX_INVALID_VMCS_FIELD;
-
-# elif defined(RT_ARCH_X86)
-    int rc;
-    uint32_t val_hi, val;
-    rc  = VMXReadVmcs32(uFieldEnc, &val);
-    rc |= VMXReadVmcs32(uFieldEnc + 1, &val_hi);
-    AssertRC(rc);
-    *pData = RT_MAKE_U64(val, val_hi);
-    return rc;
-
-# else
-#  error "Shouldn't be here..."
-# endif
-}
-#endif
 #endif
 
