VirtualBox

Changeset 55054 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Mar 31, 2015 7:29:50 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
99343
Message:

Removed support for host CPUs without FXSAVE/FXRSTOR support.

Location:
trunk/src/VBox/VMM
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/CPUM.cpp

    r55050 r55054  
    612612
    613613    /*
    614      * Check that the CPU supports the minimum features we require.
     614     * Gather info about the host CPU.
    615615     */
    616616    if (!ASMHasCpuId())
     
    619619        return VERR_UNSUPPORTED_CPU;
    620620    }
    621     ASMCpuId_ECX_EDX(1, &pVM->cpum.s.CPUFeatures.ecx, &pVM->cpum.s.CPUFeatures.edx);
    622     ASMCpuId_ECX_EDX(0x80000001, &pVM->cpum.s.CPUFeaturesExt.ecx, &pVM->cpum.s.CPUFeaturesExt.edx);
    623 
    624     /* Setup the CR4 AND and OR masks used in the switcher */
    625     /* Depends on the presence of FXSAVE(SSE) support on the host CPU */
    626     if (!pVM->cpum.s.CPUFeatures.edx.u1FXSR)
    627     {
    628         Log(("The CPU doesn't support FXSAVE/FXRSTOR!\n"));
    629         /* No FXSAVE implies no SSE */
    630         pVM->cpum.s.CR4.AndMask = X86_CR4_PVI | X86_CR4_VME;
    631         pVM->cpum.s.CR4.OrMask  = 0;
    632     }
    633     else
    634     {
    635         pVM->cpum.s.CR4.AndMask = X86_CR4_OSXMMEEXCPT | X86_CR4_PVI | X86_CR4_VME;
    636         pVM->cpum.s.CR4.OrMask  = X86_CR4_OSFXSR;
    637     }
    638 
    639     if (!pVM->cpum.s.CPUFeatures.edx.u1MMX)
    640     {
    641         Log(("The CPU doesn't support MMX!\n"));
    642         return VERR_UNSUPPORTED_CPU;
    643     }
    644     if (!pVM->cpum.s.CPUFeatures.edx.u1TSC)
    645     {
    646         Log(("The CPU doesn't support TSC!\n"));
    647         return VERR_UNSUPPORTED_CPU;
    648     }
    649     /* Bogus on AMD? */
    650     if (!pVM->cpum.s.CPUFeatures.edx.u1SEP)
    651         Log(("The CPU doesn't support SYSENTER/SYSEXIT!\n"));
    652 
    653     /*
    654      * Gather info about the host CPU.
    655      */
     621
    656622    PCPUMCPUIDLEAF  paLeaves;
    657623    uint32_t        cLeaves;
     
    663629    AssertLogRelRCReturn(rc, rc);
    664630    pVM->cpum.s.GuestFeatures.enmCpuVendor = pVM->cpum.s.HostFeatures.enmCpuVendor;
     631
     632    /*
     633     * Check that the CPU supports the minimum features we require.
     634     */
     635    if (!pVM->cpum.s.HostFeatures.fFxSaveRstor)
     636        return VMSetError(pVM, VERR_UNSUPPORTED_CPU, RT_SRC_POS, "Host CPU does not support the FXSAVE/FXRSTOR instruction.");
     637    if (!pVM->cpum.s.HostFeatures.fMmx)
     638        return VMSetError(pVM, VERR_UNSUPPORTED_CPU, RT_SRC_POS, "Host CPU does not support MMX.");
     639    if (!pVM->cpum.s.HostFeatures.fTsc)
     640        return VMSetError(pVM, VERR_UNSUPPORTED_CPU, RT_SRC_POS, "Host CPU does not support RDTSC.");
     641
     642    /* Bogus on AMD? */
     643    if (!pVM->cpum.s.CPUFeatures.edx.u1SEP)
     644        Log(("The CPU doesn't support SYSENTER/SYSEXIT!\n"));
     645
     646    /*
     647     * Setup the CR4 AND and OR masks used in the switcher
     648     */
     649    pVM->cpum.s.CR4.AndMask = X86_CR4_OSXMMEEXCPT | X86_CR4_PVI | X86_CR4_VME;
     650    pVM->cpum.s.CR4.OrMask  = X86_CR4_OSFXSR;
    665651
    666652    /*
     
    684670
    685671        pVCpu->cpum.s.Host.pXStateR3  = (PX86XSAVEAREA)pbXStates;
    686         pVCpu->cpum.s.Host.pXStateR0 = MMHyperR3ToR0(pVM, pbXStates);
    687         pVCpu->cpum.s.Host.pXStateRC = MMHyperR3ToR0(pVM, pbXStates);
     672        pVCpu->cpum.s.Host.pXStateR0  = MMHyperR3ToR0(pVM, pbXStates);
     673        pVCpu->cpum.s.Host.pXStateRC  = MMHyperR3ToR0(pVM, pbXStates);
    688674        pbXStates += cbMaxXState;
    689675
  • trunk/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp

    r54958 r55054  
    15381538        pFeatures->fPat                 = RT_BOOL(paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_PAT);
    15391539        pFeatures->fFxSaveRstor         = RT_BOOL(paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_FXSR);
     1540        pFeatures->fMmx                 = RT_BOOL(paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_MMX);
     1541        pFeatures->fTsc                 = RT_BOOL(paLeaves[1].uEcx & X86_CPUID_FEATURE_EDX_TSC);
    15401542        pFeatures->fSysEnter            = RT_BOOL(paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_SEP);
    15411543        pFeatures->fHypervisorPresent   = RT_BOOL(paLeaves[1].uEcx & X86_CPUID_FEATURE_ECX_HVP);
     
    15721574            pFeatures->fPat            |= RT_BOOL(pExtLeaf->uEdx & X86_CPUID_AMD_FEATURE_EDX_PAT);
    15731575            pFeatures->fFxSaveRstor    |= RT_BOOL(pExtLeaf->uEdx & X86_CPUID_AMD_FEATURE_EDX_FXSR);
     1576            pFeatures->fMmx            |= RT_BOOL(pExtLeaf->uEdx & X86_CPUID_AMD_FEATURE_EDX_MMX);
     1577            pFeatures->fTsc            |= RT_BOOL(pExtLeaf->uEdx & X86_CPUID_AMD_FEATURE_EDX_TSC);
    15741578        }
    15751579
  • trunk/src/VBox/VMM/VMMR3/VMMSwitcher.cpp

    r48221 r55054  
    690690            }
    691691
     692#if 0 /* Reusable for XSAVE. */
    692693            /*
    693694             * Insert relative jump to specified target it FXSAVE/FXRSTOR isn't supported by the cpu.
     
    709710                break;
    710711            }
     712#endif
    711713
    712714            /*
  • trunk/src/VBox/VMM/VMMRC/CPUMRCA.asm

    r55048 r55054  
    144144
    145145        mov     pXState, [pCpumCpu + CPUMCPU.Host.pXStateRC]
    146         mov     eax, pCpumCpu           ; Calculate the PCPUM pointer
    147         sub     eax, [pCpumCpu + CPUMCPU.offCPUM]
    148         test    dword [eax + CPUM.CPUFeatures.edx], X86_CPUID_FEATURE_EDX_FXSR
    149         jz short hlfpua_no_fxsave
    150 
    151146        fxsave  [pXState]
    152147        mov     pXState, [pCpumCpu + CPUMCPU.Guest.pXStateRC]
     
    164159        xor     eax, eax
    165160        ret
    166 
    167         ;
    168         ; Legacy CPU support.
    169         ;
    170 hlfpua_no_fxsave:
    171         fnsave  [pXState]
    172         mov     pXState, [pCpumCpu + CPUMCPU.Guest.pXStateRC]
    173         mov     eax, [pXState]          ; control word
    174         not     eax                     ; 1 means exception ignored (6 LS bits)
    175         and     eax, byte 03Fh          ; 6 LS bits only
    176         test    eax, [pXState + 4]      ; status word
    177         jz short hlfpua_no_exceptions_pending
    178         ; Technically incorrect, but we certainly don't want any exceptions now!!
    179         and     dword [pXState + 4], ~03Fh
    180 hlfpua_no_exceptions_pending:
    181         frstor  [pXState]
    182         jmp near hlfpua_finished_switch
    183161
    184162        ;
  • trunk/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac

    r55048 r55054  
    565565    ;
    566566    ; CR4.AndMask and CR4.OrMask are set in CPUMR3Init based on the presence of
    567     ; FXSAVE support on the host CPU
     567    ; FXSAVE and XSAVE support on the host CPU
    568568    ;
    569569    and     ecx, [rdx + CPUM.CR4.AndMask]
  • trunk/src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac

    r55048 r55054  
    420420    ;
    421421    ; CR4.AndMask and CR4.OrMask are set in CPUMR3Init based on the presence of
    422     ; FXSAVE support on the host CPU
     422    ; FXSAVE and XSAVE support on the host CPU
    423423    ;
    424424    CPUM_FROM_CPUMCPU(edx)
     
    992992    mov     eax, [edx + CPUMCPU.Guest.pXStateR0]
    993993    mov     ecx, [edx + CPUMCPU.Host.pXStateR0]
    994     FIXUP FIX_NO_FXSAVE_JMP, 0, gth_no_fxsave - NAME(Start) ; this will insert a jmp gth_no_fxsave if fxsave isn't supported.
    995994    fxsave  [eax]
    996995    fxrstor [ecx]
    997     jmp near gth_fpu_no
    998 
    999 gth_no_fxsave:
    1000     fnsave  [eax]
    1001     mov     eax, [ecx]                  ; control word
    1002     not     eax                         ; 1 means exception ignored (6 LS bits)
    1003     and     eax, byte 03Fh              ; 6 LS bits only
    1004     test    eax, [ecx + 4]              ; status word
    1005     jz      gth_no_exceptions_pending
    1006 
    1007     ; technically incorrect, but we certainly don't want any exceptions now!!
    1008     and     dword [ecx + 4], ~03Fh
    1009 
    1010 gth_no_exceptions_pending:
    1011     frstor  [ecx]
    1012     jmp short gth_fpu_no
    1013 
    1014 ALIGNCODE(16)
    1015 gth_fpu_no:
    1016996
    1017997    ; Control registers.
  • trunk/src/VBox/VMM/include/CPUMInternal.h

    r55049 r55054  
    187187    /** Supports the FXSAVE and FXRSTOR instructions. */
    188188    uint32_t        fFxSaveRstor : 1;
     189    /** Supports MMX. */
     190    uint32_t        fMmx : 1;
     191    /** Supports RDTSC. */
     192    uint32_t        fTsc : 1;
    189193    /** Intel SYSENTER/SYSEXIT support */
    190194    uint32_t        fSysEnter : 1;
     
    217221
    218222    /** Alignment padding. */
    219     uint32_t        fPadding : 8;
     223    uint32_t        fPadding : 12;
    220224
    221225    uint64_t        auPadding[2];
  • trunk/src/VBox/VMM/include/VMMSwitcher.h

    r45701 r55054  
    55
    66/*
    7  * Copyright (C) 2006-2012 Oracle Corporation
     7 * Copyright (C) 2006-2015 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4343#define FIX_HYPER_TSS           20
    4444#define FIX_GC_TSS_GDTE_DW2     21
    45 #define FIX_NO_FXSAVE_JMP       24
     45/*#define FIX_NO_FXSAVE_JMP       24 - reusable */
    4646#define FIX_NO_SYSENTER_JMP     25
    4747#define FIX_NO_SYSCALL_JMP      26
  • trunk/src/VBox/VMM/include/VMMSwitcher.mac

    r45786 r55054  
    55
    66;
    7 ; Copyright (C) 2006-2013 Oracle Corporation
     7; Copyright (C) 2006-2015 Oracle Corporation
    88;
    99; This file is part of VirtualBox Open Source Edition (OSE), as
     
    8585%define FIX_HYPER_TSS           20
    8686%define FIX_GC_TSS_GDTE_DW2     21
    87 %define FIX_NO_FXSAVE_JMP       24
     87;%define FIX_NO_FXSAVE_JMP       24 - reusable
    8888%define FIX_NO_SYSENTER_JMP     25
    8989%define FIX_NO_SYSCALL_JMP      26
Note: See TracChangeset for help on using the changeset viewer.

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