VirtualBox

Changeset 48995 in vbox for trunk


Ignore:
Timestamp:
Oct 9, 2013 11:15:00 AM (11 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Make sure host segments are present in the LDT if we're going to try restore it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp

    r48936 r48995  
    22472247
    22482248
     2249#if HC_ARCH_BITS == 64
     2250/**
     2251 * Macro for adjusting host segment selectors to satisfy VT-x's VM-entry
     2252 * requirements. See hmR0VmxSaveHostSegmentRegs().
     2253 */
     2254# define VMXLOCAL_ADJUST_HOST_SEG(seg, selValue)  \
     2255    if ((selValue) & (X86_SEL_RPL | X86_SEL_LDT)) \
     2256    { \
     2257        bool fValidSelector = true; \
     2258        if ((selValue) & X86_SEL_LDT) \
     2259        { \
     2260            uint32_t uAttr = ASMGetSegAttr((selValue)); \
     2261            fValidSelector = RT_BOOL(uAttr != ~0U && (uAttr & X86_DESC_P)); \
     2262        } \
     2263        if (fValidSelector) \
     2264        { \
     2265            pVCpu->hm.s.vmx.fRestoreHostFlags |= VMX_RESTORE_HOST_SEL_##seg; \
     2266            pVCpu->hm.s.vmx.RestoreHost.uHostSel##seg = (selValue); \
     2267        } \
     2268        (selValue) = 0; \
     2269    }
     2270#endif
     2271
     2272
    22492273/**
    22502274 * Saves the host segment registers and GDTR, IDTR, (TR, GS and FS bases) into
     
    23092333     * before we get preempted. See Intel spec. 26.2.3 "Checks on Host Segment and Descriptor-Table Registers".
    23102334     */
    2311     if (uSelDS & (X86_SEL_RPL | X86_SEL_LDT))
    2312     {
    2313         pVCpu->hm.s.vmx.fRestoreHostFlags |= VMX_RESTORE_HOST_SEL_DS;
    2314         pVCpu->hm.s.vmx.RestoreHost.uHostSelDS = uSelDS;
    2315         uSelDS = 0;
    2316     }
    2317     if (uSelES & (X86_SEL_RPL | X86_SEL_LDT))
    2318     {
    2319         pVCpu->hm.s.vmx.fRestoreHostFlags |= VMX_RESTORE_HOST_SEL_ES;
    2320         pVCpu->hm.s.vmx.RestoreHost.uHostSelES = uSelES;
    2321         uSelES = 0;
    2322     }
    2323     if (uSelFS & (X86_SEL_RPL | X86_SEL_LDT))
    2324     {
    2325         pVCpu->hm.s.vmx.fRestoreHostFlags |= VMX_RESTORE_HOST_SEL_FS;
    2326         pVCpu->hm.s.vmx.RestoreHost.uHostSelFS = uSelFS;
    2327         uSelFS = 0;
    2328     }
    2329     if (uSelGS & (X86_SEL_RPL | X86_SEL_LDT))
    2330     {
    2331         pVCpu->hm.s.vmx.fRestoreHostFlags |= VMX_RESTORE_HOST_SEL_GS;
    2332         pVCpu->hm.s.vmx.RestoreHost.uHostSelGS = uSelGS;
    2333         uSelGS = 0;
    2334     }
     2335    VMXLOCAL_ADJUST_HOST_SEG(DS, uSelDS);
     2336    VMXLOCAL_ADJUST_HOST_SEG(ES, uSelES);
     2337    VMXLOCAL_ADJUST_HOST_SEG(FS, uSelFS);
     2338    VMXLOCAL_ADJUST_HOST_SEG(GS, uSelGS);
     2339# undef VMXLOCAL_ADJUST_HOST_SEG
    23352340#endif
    23362341
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