Changeset 55054 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Mar 31, 2015 7:29:50 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99343
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/CPUM.cpp
r55050 r55054 612 612 613 613 /* 614 * Check that the CPU supports the minimum features we require.614 * Gather info about the host CPU. 615 615 */ 616 616 if (!ASMHasCpuId()) … … 619 619 return VERR_UNSUPPORTED_CPU; 620 620 } 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 656 622 PCPUMCPUIDLEAF paLeaves; 657 623 uint32_t cLeaves; … … 663 629 AssertLogRelRCReturn(rc, rc); 664 630 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; 665 651 666 652 /* … … 684 670 685 671 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); 688 674 pbXStates += cbMaxXState; 689 675 -
trunk/src/VBox/VMM/VMMR3/CPUMR3CpuId.cpp
r54958 r55054 1538 1538 pFeatures->fPat = RT_BOOL(paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_PAT); 1539 1539 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); 1540 1542 pFeatures->fSysEnter = RT_BOOL(paLeaves[1].uEdx & X86_CPUID_FEATURE_EDX_SEP); 1541 1543 pFeatures->fHypervisorPresent = RT_BOOL(paLeaves[1].uEcx & X86_CPUID_FEATURE_ECX_HVP); … … 1572 1574 pFeatures->fPat |= RT_BOOL(pExtLeaf->uEdx & X86_CPUID_AMD_FEATURE_EDX_PAT); 1573 1575 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); 1574 1578 } 1575 1579 -
trunk/src/VBox/VMM/VMMR3/VMMSwitcher.cpp
r48221 r55054 690 690 } 691 691 692 #if 0 /* Reusable for XSAVE. */ 692 693 /* 693 694 * Insert relative jump to specified target it FXSAVE/FXRSTOR isn't supported by the cpu. … … 709 710 break; 710 711 } 712 #endif 711 713 712 714 /* -
trunk/src/VBox/VMM/VMMRC/CPUMRCA.asm
r55048 r55054 144 144 145 145 mov pXState, [pCpumCpu + CPUMCPU.Host.pXStateRC] 146 mov eax, pCpumCpu ; Calculate the PCPUM pointer147 sub eax, [pCpumCpu + CPUMCPU.offCPUM]148 test dword [eax + CPUM.CPUFeatures.edx], X86_CPUID_FEATURE_EDX_FXSR149 jz short hlfpua_no_fxsave150 151 146 fxsave [pXState] 152 147 mov pXState, [pCpumCpu + CPUMCPU.Guest.pXStateRC] … … 164 159 xor eax, eax 165 160 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 word174 not eax ; 1 means exception ignored (6 LS bits)175 and eax, byte 03Fh ; 6 LS bits only176 test eax, [pXState + 4] ; status word177 jz short hlfpua_no_exceptions_pending178 ; Technically incorrect, but we certainly don't want any exceptions now!!179 and dword [pXState + 4], ~03Fh180 hlfpua_no_exceptions_pending:181 frstor [pXState]182 jmp near hlfpua_finished_switch183 161 184 162 ; -
trunk/src/VBox/VMM/VMMSwitcher/AMD64andLegacy.mac
r55048 r55054 565 565 ; 566 566 ; CR4.AndMask and CR4.OrMask are set in CPUMR3Init based on the presence of 567 ; FXSAVE support on the host CPU567 ; FXSAVE and XSAVE support on the host CPU 568 568 ; 569 569 and ecx, [rdx + CPUM.CR4.AndMask] -
trunk/src/VBox/VMM/VMMSwitcher/PAEand32Bit.mac
r55048 r55054 420 420 ; 421 421 ; CR4.AndMask and CR4.OrMask are set in CPUMR3Init based on the presence of 422 ; FXSAVE support on the host CPU422 ; FXSAVE and XSAVE support on the host CPU 423 423 ; 424 424 CPUM_FROM_CPUMCPU(edx) … … 992 992 mov eax, [edx + CPUMCPU.Guest.pXStateR0] 993 993 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.995 994 fxsave [eax] 996 995 fxrstor [ecx] 997 jmp near gth_fpu_no998 999 gth_no_fxsave:1000 fnsave [eax]1001 mov eax, [ecx] ; control word1002 not eax ; 1 means exception ignored (6 LS bits)1003 and eax, byte 03Fh ; 6 LS bits only1004 test eax, [ecx + 4] ; status word1005 jz gth_no_exceptions_pending1006 1007 ; technically incorrect, but we certainly don't want any exceptions now!!1008 and dword [ecx + 4], ~03Fh1009 1010 gth_no_exceptions_pending:1011 frstor [ecx]1012 jmp short gth_fpu_no1013 1014 ALIGNCODE(16)1015 gth_fpu_no:1016 996 1017 997 ; Control registers. -
trunk/src/VBox/VMM/include/CPUMInternal.h
r55049 r55054 187 187 /** Supports the FXSAVE and FXRSTOR instructions. */ 188 188 uint32_t fFxSaveRstor : 1; 189 /** Supports MMX. */ 190 uint32_t fMmx : 1; 191 /** Supports RDTSC. */ 192 uint32_t fTsc : 1; 189 193 /** Intel SYSENTER/SYSEXIT support */ 190 194 uint32_t fSysEnter : 1; … … 217 221 218 222 /** Alignment padding. */ 219 uint32_t fPadding : 8;223 uint32_t fPadding : 12; 220 224 221 225 uint64_t auPadding[2]; -
trunk/src/VBox/VMM/include/VMMSwitcher.h
r45701 r55054 5 5 6 6 /* 7 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 43 43 #define FIX_HYPER_TSS 20 44 44 #define FIX_GC_TSS_GDTE_DW2 21 45 #define FIX_NO_FXSAVE_JMP 24 45 /*#define FIX_NO_FXSAVE_JMP 24 - reusable */ 46 46 #define FIX_NO_SYSENTER_JMP 25 47 47 #define FIX_NO_SYSCALL_JMP 26 -
trunk/src/VBox/VMM/include/VMMSwitcher.mac
r45786 r55054 5 5 6 6 ; 7 ; Copyright (C) 2006-201 3Oracle Corporation7 ; Copyright (C) 2006-2015 Oracle Corporation 8 8 ; 9 9 ; This file is part of VirtualBox Open Source Edition (OSE), as … … 85 85 %define FIX_HYPER_TSS 20 86 86 %define FIX_GC_TSS_GDTE_DW2 21 87 %define FIX_NO_FXSAVE_JMP 24 87 ;%define FIX_NO_FXSAVE_JMP 24 - reusable 88 88 %define FIX_NO_SYSENTER_JMP 25 89 89 %define FIX_NO_SYSCALL_JMP 26
Note:
See TracChangeset
for help on using the changeset viewer.