VirtualBox

Changeset 47437 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Jul 27, 2013 7:24:42 PM (11 years ago)
Author:
vboxsync
Message:

VMXRESTOREHOST: drop the #pragma pack(1) and correctly align the members instead. It appears (the #AC test) that X86XDTR64 should be aligned by it's 64-bit member and not by the start of the structure, not unexpected.

Location:
trunk/include/VBox/vmm
Files:
2 edited

Legend:

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

    r47436 r47437  
    6969/**
    7070 * Host-state restoration structure.
    71  * This holds host-state fields that require manual restoration. The layout is
    72  * critical as it's used from assembly code.
    73  */
    74 #pragma pack(1)
     71 * This holds host-state fields that require manual restoration.
     72 * Assembly version found in hm_vmx.mac (should be automatically verified).
     73 */
    7574typedef struct VMXRESTOREHOST
    7675{
     
    8079    RTSEL       uHostSelGS;     /* 0x06 */
    8180    RTSEL       uHostSelTR;     /* 0x08 */
    82     uint16_t    u16Padding;     /* 0x0a */
    83     uint64_t    uHostFSBase;    /* 0x0c */
    84     uint64_t    uHostGSBase;    /* 0x14 */
    85     X86XDTR64   HostGdtr;       /* 0x1c */
    86     X86XDTR64   HostIdtr;       /* 0x26 */
     81    uint8_t     abPadding0[4];
     82    X86XDTR64   HostGdtr;       /**< 0x0e - should be aligned by it's 64-bit member.  */
     83    uint8_t     abPadding1[6];
     84    X86XDTR64   HostIdtr;       /**< 0x1e - should be aligned by it's 64-bit member. */
     85    uint64_t    uHostFSBase;    /* 0x28 */
     86    uint64_t    uHostGSBase;    /* 0x30 */
    8787} VMXRESTOREHOST;
    88 #pragma pack()
    8988/** Pointer to VMXRESTOREHOST. */
    9089typedef VMXRESTOREHOST *PVMXRESTOREHOST;
    9190AssertCompileSize(X86XDTR64, 10);
    92 AssertCompileMemberOffset(VMXRESTOREHOST, uHostSelDS,    0);
    93 AssertCompileMemberOffset(VMXRESTOREHOST, uHostSelES,    2);
    94 AssertCompileMemberOffset(VMXRESTOREHOST, uHostSelFS,    4);
    95 AssertCompileMemberOffset(VMXRESTOREHOST, uHostSelGS,    6);
    96 AssertCompileMemberOffset(VMXRESTOREHOST, uHostSelTR,    8);
    97 AssertCompileMemberOffset(VMXRESTOREHOST, uHostFSBase,  12);
    98 AssertCompileMemberOffset(VMXRESTOREHOST, uHostGSBase,  20);
    99 AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtr,     28);
    100 AssertCompileMemberOffset(VMXRESTOREHOST, HostIdtr,     38);
    101 AssertCompileSize(VMXRESTOREHOST, 48);
     91AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtr.uAddr, 16);
     92AssertCompileMemberOffset(VMXRESTOREHOST, HostIdtr.uAddr, 32);
     93AssertCompileMemberOffset(VMXRESTOREHOST, uHostFSBase,    40);
     94AssertCompileSize(VMXRESTOREHOST, 56);
    10295
    10396/** @name VMX VMCS-Read cache indices.
  • trunk/include/VBox/vmm/hm_vmx.mac

    r46942 r47437  
    160160%define VMX_RESTORE_HOST_IDTR                                   40h   ;RT_BIT(6)
    161161
     162;; C version hm_vmx.h
    162163struc VMXRESTOREHOST
    163164    .uHostSelDS         resw    1
     
    166167    .uHostSelGS         resw    1
    167168    .uHostSelTR         resw    1
    168     .u16Padding         resw    1
     169    .abPadding0         resb    4
     170    .HostGdtr           resb    10
     171    .abPadding1         resb    6
     172    .HostIdtr           resb    10
    169173    .uHostFSBase        resq    1
    170174    .uHostGSBase        resq    1
    171     .HostGdtr           resb    10
    172     .HostIdtr           resb    10
    173175endstruc
     176AssertCompileMemberOffset(VMXRESTOREHOST, HostGdtr,     16-2)
     177AssertCompileMemberOffset(VMXRESTOREHOST, HostIdtr,     32-2)
     178AssertCompileMemberOffset(VMXRESTOREHOST, uHostFSBase,    40)
     179AssertCompileSize(VMXRESTOREHOST, 56)
    174180
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