VirtualBox

Changeset 79077 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Jun 11, 2019 6:35:31 AM (6 years ago)
Author:
vboxsync
Message:

hm_vmx.h: Nested VMX: bugref:9180 Rename VMXVMCSFIELDENC to VMXVMCSFIELD, other comment fixes and re-ordering some defines.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/hm_vmx.h

    r79076 r79077  
    760760/**
    761761 * VMX VPID flush types.
    762  * @note Valid enum members are in accordance to the VT-x spec.
     762 * Valid enum members are in accordance with the VT-x spec.
    763763 */
    764764typedef enum
     
    781781/**
    782782 * VMX EPT flush types.
    783  * @note Valid enums values are in accordance to the VT-x spec.
     783 * @note Valid enums values are in accordance with the VT-x spec.
    784784 */
    785785typedef enum
     
    798798/**
    799799 * VMX Posted Interrupt Descriptor.
    800  * In accordance to the VT-x spec.
     800 * In accordance with the VT-x spec.
    801801 */
    802802typedef struct VMXPOSTEDINTRDESC
     
    10591059
    10601060/** @name VMXMSRPM_XXX - VMX MSR-bitmap permissions.
    1061  * These are not in accordance to the Intel spec. but used internally by VirtualBox.
     1061 * These are -not- specified by Intel but used internally by VirtualBox.
    10621062 * @{ */
    10631063/** Guest software reads of this MSR must not cause a VM-exit. */
     
    10891089/**
    10901090 * VMX MSR autoload/store slot.
    1091  * In accordance to the VT-x spec.
     1091 * In accordance with the VT-x spec.
    10921092 */
    10931093typedef struct VMXAUTOMSR
     
    19791979} VMXVMCSFIELDACCESS;
    19801980AssertCompileSize(VMXVMCSFIELDACCESS, 4);
     1981
     1982/** VMCS field encoding type: Full. */
     1983#define VMX_VMCS_ENC_ACCESS_TYPE_FULL                           0
     1984/** VMCS field encoding type: High. */
     1985#define VMX_VMCS_ENC_ACCESS_TYPE_HIGH                           1
    19811986/** @} */
    19821987
     
    19921997} VMXVMCSFIELDTYPE;
    19931998AssertCompileSize(VMXVMCSFIELDTYPE, 4);
     1999
     2000/** VMCS field encoding type: Control. */
     2001#define VMX_VMCS_ENC_TYPE_CONTROL                               0
     2002/** VMCS field encoding type: VM-exit information / read-only fields. */
     2003#define VMX_VMCS_ENC_TYPE_VMEXIT_INFO                           1
     2004/** VMCS field encoding type: Guest-state. */
     2005#define VMX_VMCS_ENC_TYPE_GUEST_STATE                           2
     2006/** VMCS field encoding type: Host-state. */
     2007#define VMX_VMCS_ENC_TYPE_HOST_STATE                            3
    19942008/** @} */
    19952009
     
    20052019} VMXVMCSFIELDWIDTH;
    20062020AssertCompileSize(VMXVMCSFIELDWIDTH, 4);
    2007 /** @} */
     2021
     2022/** VMCS field encoding width: 16-bit. */
     2023#define VMX_VMCS_ENC_WIDTH_16BIT                                0
     2024/** VMCS field encoding width: 64-bit. */
     2025#define VMX_VMCS_ENC_WIDTH_64BIT                                1
     2026/** VMCS field encoding width: 32-bit. */
     2027#define VMX_VMCS_ENC_WIDTH_32BIT                                2
     2028/** VMCS field encoding width: Natural width. */
     2029#define VMX_VMCS_ENC_WIDTH_NATURAL                              3
     2030/** @} */
     2031
     2032
     2033/** @name VMCS field.
     2034 * @{ */
     2035typedef union
     2036{
     2037    struct
     2038    {
     2039        /** The access type; 0=full, 1=high of 64-bit fields. */
     2040        uint32_t    fAccessType  : 1;
     2041        /** The index. */
     2042        uint32_t    u8Index      : 8;
     2043        /** The type; 0=control, 1=VM-exit info, 2=guest-state, 3=host-state. */
     2044        uint32_t    u2Type       : 2;
     2045        /** Reserved (MBZ). */
     2046        uint32_t    u1Reserved0  : 1;
     2047        /** The width; 0=16-bit, 1=64-bit, 2=32-bit, 3=natural-width. */
     2048        uint32_t    u2Width      : 2;
     2049        /** Reserved (MBZ). */
     2050        uint32_t    u18Reserved0 : 18;
     2051    } n;
     2052
     2053    /* The unsigned integer view. */
     2054    uint32_t    u;
     2055} VMXVMCSFIELD;
     2056AssertCompileSize(VMXVMCSFIELD, 4);
     2057/** Pointer to a VMCS field encoding. */
     2058typedef VMXVMCSFIELD *PVMXVMCSFIELD;
     2059/** Pointer to a const VMCS field encoding. */
     2060typedef const VMXVMCSFIELD *PCVMXVMCSFIELD;
     2061
     2062/** VMCS field encoding: Mask of reserved bits (bits 63:15 MBZ), bit 12 is
     2063 *  not included! */
     2064#define VMX_VMCS_ENC_RSVD_MASK                                  UINT64_C(0xffffffffffff8000)
     2065
     2066/** Bits fields for VMCS field encoding. */
     2067#define VMX_BF_VMCS_ENC_ACCESS_TYPE_SHIFT                       0
     2068#define VMX_BF_VMCS_ENC_ACCESS_TYPE_MASK                        UINT32_C(0x00000001)
     2069#define VMX_BF_VMCS_ENC_INDEX_SHIFT                             1
     2070#define VMX_BF_VMCS_ENC_INDEX_MASK                              UINT32_C(0x000003fe)
     2071#define VMX_BF_VMCS_ENC_TYPE_SHIFT                              10
     2072#define VMX_BF_VMCS_ENC_TYPE_MASK                               UINT32_C(0x00000c00)
     2073#define VMX_BF_VMCS_ENC_RSVD_12_SHIFT                           12
     2074#define VMX_BF_VMCS_ENC_RSVD_12_MASK                            UINT32_C(0x00001000)
     2075#define VMX_BF_VMCS_ENC_WIDTH_SHIFT                             13
     2076#define VMX_BF_VMCS_ENC_WIDTH_MASK                              UINT32_C(0x00006000)
     2077#define VMX_BF_VMCS_ENC_RSVD_15_31_SHIFT                        15
     2078#define VMX_BF_VMCS_ENC_RSVD_15_31_MASK                         UINT32_C(0xffff8000)
     2079RT_BF_ASSERT_COMPILE_CHECKS(VMX_BF_VMCS_ENC_, UINT32_C(0), UINT32_MAX,
     2080                            (ACCESS_TYPE, INDEX, TYPE, RSVD_12, WIDTH, RSVD_15_31));
     2081/** @} */
     2082
    20082083
    20092084/** @name VM-entry instruction length.
     
    25282603/** @} */
    25292604
     2605
    25302606/** @name VM-entry exception error code.
    25312607 * @{ */
     
    32123288
    32133289
    3214 /** @name VMCS field encoding.
    3215  * @{ */
    3216 typedef union
    3217 {
    3218     struct
    3219     {
    3220         /** The access type; 0=full, 1=high of 64-bit fields. */
    3221         uint32_t    fAccessType  : 1;
    3222         /** The index. */
    3223         uint32_t    u8Index      : 8;
    3224         /** The type; 0=control, 1=VM-exit info, 2=guest-state, 3=host-state. */
    3225         uint32_t    u2Type       : 2;
    3226         /** Reserved (MBZ). */
    3227         uint32_t    u1Reserved0  : 1;
    3228         /** The width; 0=16-bit, 1=64-bit, 2=32-bit, 3=natural-width. */
    3229         uint32_t    u2Width      : 2;
    3230         /** Reserved (MBZ). */
    3231         uint32_t    u18Reserved0 : 18;
    3232     } n;
    3233     /* The unsigned integer view. */
    3234     uint32_t    u;
    3235 } VMXVMCSFIELDENC;
    3236 AssertCompileSize(VMXVMCSFIELDENC, 4);
    3237 /** Pointer to a VMCS field encoding. */
    3238 typedef VMXVMCSFIELDENC *PVMXVMCSFIELDENC;
    3239 /** Pointer to a const VMCS field encoding. */
    3240 typedef const VMXVMCSFIELDENC *PCVMXVMCSFIELDENC;
    3241 
    3242 /** VMCS field encoding type: Full. */
    3243 #define VMX_VMCS_ENC_ACCESS_TYPE_FULL                           0
    3244 /** VMCS field encoding type: High. */
    3245 #define VMX_VMCS_ENC_ACCESS_TYPE_HIGH                           1
    3246 
    3247 /** VMCS field encoding type: Control. */
    3248 #define VMX_VMCS_ENC_TYPE_CONTROL                               0
    3249 /** VMCS field encoding type: VM-exit information / read-only fields. */
    3250 #define VMX_VMCS_ENC_TYPE_VMEXIT_INFO                           1
    3251 /** VMCS field encoding type: Guest-state. */
    3252 #define VMX_VMCS_ENC_TYPE_GUEST_STATE                           2
    3253 /** VMCS field encoding type: Host-state. */
    3254 #define VMX_VMCS_ENC_TYPE_HOST_STATE                            3
    3255 
    3256 /** VMCS field encoding width: 16-bit. */
    3257 #define VMX_VMCS_ENC_WIDTH_16BIT                                0
    3258 /** VMCS field encoding width: 64-bit. */
    3259 #define VMX_VMCS_ENC_WIDTH_64BIT                                1
    3260 /** VMCS field encoding width: 32-bit. */
    3261 #define VMX_VMCS_ENC_WIDTH_32BIT                                2
    3262 /** VMCS field encoding width: Natural width. */
    3263 #define VMX_VMCS_ENC_WIDTH_NATURAL                              3
    3264 
    3265 /** VMCS field encoding: Mask of reserved bits (bits 63:15 MBZ), bit 12 is
    3266  *  not included! */
    3267 #define VMX_VMCS_ENC_RSVD_MASK                                  UINT64_C(0xffffffffffff8000)
    3268 
    3269 /** Bits fields for VMCS field encoding. */
    3270 #define VMX_BF_VMCS_ENC_ACCESS_TYPE_SHIFT                       0
    3271 #define VMX_BF_VMCS_ENC_ACCESS_TYPE_MASK                        UINT32_C(0x00000001)
    3272 #define VMX_BF_VMCS_ENC_INDEX_SHIFT                             1
    3273 #define VMX_BF_VMCS_ENC_INDEX_MASK                              UINT32_C(0x000003fe)
    3274 #define VMX_BF_VMCS_ENC_TYPE_SHIFT                              10
    3275 #define VMX_BF_VMCS_ENC_TYPE_MASK                               UINT32_C(0x00000c00)
    3276 #define VMX_BF_VMCS_ENC_RSVD_12_SHIFT                           12
    3277 #define VMX_BF_VMCS_ENC_RSVD_12_MASK                            UINT32_C(0x00001000)
    3278 #define VMX_BF_VMCS_ENC_WIDTH_SHIFT                             13
    3279 #define VMX_BF_VMCS_ENC_WIDTH_MASK                              UINT32_C(0x00006000)
    3280 #define VMX_BF_VMCS_ENC_RSVD_15_31_SHIFT                        15
    3281 #define VMX_BF_VMCS_ENC_RSVD_15_31_MASK                         UINT32_C(0xffff8000)
    3282 RT_BF_ASSERT_COMPILE_CHECKS(VMX_BF_VMCS_ENC_, UINT32_C(0), UINT32_MAX,
    3283                             (ACCESS_TYPE, INDEX, TYPE, RSVD_12, WIDTH, RSVD_15_31));
    3284 /** @} */
    3285 
    3286 
    32873290/** @defgroup grp_hm_vmx_virt    VMX virtualization.
    32883291 * @{
     
    34423445 *
    34433446 * This is our custom format. Relevant fields from this VMCS will be merged into the
    3444  * actual VMCS (/shadow) when we execute nested-guest code using hardware-assisted
     3447 * actual/shadow VMCS when we execute nested-guest code using hardware-assisted
    34453448 * VMX.
    34463449 *
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