VirtualBox

vbox的更動 55312 路徑 trunk/src/VBox/VMM/VMMAll


忽略:
時間撮記:
2015-4-16 下午03:29:17 (10 年 以前)
作者:
vboxsync
訊息:

CPUM: Must load additional extended CPU state when added to (guest) XCR0.

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/VMM/VMMAll/CPUMAllRegs.cpp

    r55292 r55312  
    21432143 * Set the guest XCR0 register.
    21442144 *
     2145 * Will load additional state if the FPU state is already loaded (in ring-0 &
     2146 * raw-mode context).
     2147 *
    21452148 * @returns VINF_SUCCESS on success, VERR_CPUM_RAISE_GP_0 on invalid input
    21462149 *          value.
     
    21642167    {
    21652168        pVCpu->cpum.s.Guest.aXcr[0] = uNewValue;
    2166         pVCpu->cpum.s.Guest.fXStateMask |= uNewValue;
     2169
     2170        /* If more state components are enabled, we need to take care to load
     2171           them if the FPU/SSE state is already loaded.  May otherwise leak
     2172           host state to the guest. */
     2173        uint64_t fNewComponents = ~pVCpu->cpum.s.Guest.fXStateMask & uNewValue;
     2174        if (fNewComponents)
     2175        {
     2176#if defined(IN_RING0) || defined(IN_RC)
     2177            if (pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU)
     2178            {
     2179                if (pVCpu->cpum.s.Guest.fXStateMask != 0)
     2180                    /* Adding more components. */
     2181                    ASMXRstor(pVCpu->cpum.s.Guest.CTX_SUFF(pXState), fNewComponents);
     2182                else
     2183                {
     2184                    /* We're switching from FXSAVE/FXRSTOR to XSAVE/XRSTOR. */
     2185                    pVCpu->cpum.s.Guest.fXStateMask |= XSAVE_C_X87 | XSAVE_C_SSE;
     2186                    if (uNewValue & ~(XSAVE_C_X87 | XSAVE_C_SSE))
     2187                        ASMXRstor(pVCpu->cpum.s.Guest.CTX_SUFF(pXState), uNewValue & ~(XSAVE_C_X87 | XSAVE_C_SSE));
     2188                }
     2189            }
     2190#endif
     2191            pVCpu->cpum.s.Guest.fXStateMask |= uNewValue;
     2192        }
    21672193        return VINF_SUCCESS;
    21682194    }
     
    26232649{
    26242650    return RT_BOOL(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU);
    2625 }
    2626 
    2627 
    2628 /**
    2629  * Deactivate the FPU/XMM state of the guest OS.
    2630  * @param   pVCpu       Pointer to the VMCPU.
    2631  *
    2632  * @todo    r=bird: Why is this needed? Looks like a workaround for mishandled
    2633  *          FPU state management.
    2634  */
    2635 VMMDECL(void) CPUMDeactivateGuestFPUState(PVMCPU pVCpu)
    2636 {
    2637     Assert(!(pVCpu->cpum.s.fUseFlags & CPUM_USED_FPU));
    2638     pVCpu->cpum.s.fUseFlags &= ~CPUM_USED_FPU;
    26392651}
    26402652
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette