Elite Member
|
補充一下,VirtualBox OSE關於SVM/VMX的source code應該是在src/VBox/VMM/VMMR0中,另外在VirtualBox上開SVM時看到的log檔如下....
引用:
00:14:31.511 Ext Name: AuthenticAMD
00:14:31.511 Ext Supports: 0x80000000-0x80000004
00:14:31.511 Family: 15 Extended: 0 Effectiv: 15
00:14:31.511 Model: 8 Extended: 4 Effectiv: 8
00:14:31.511 Stepping: 2
00:14:31.511 Brand ID: 0x595
00:14:31.511 Mnemonic - Description = guest (host)
00:14:31.511 FPU - x87 FPU on Chip = 1 (1)
00:14:31.511 VME - Virtual 8086 Mode Enhancements = 1 (1)
00:14:31.511 DE - Debugging extensions = 1 (1)
00:14:31.511 PSE - Page Size Extension = 1 (1)
00:14:31.511 TSC - Time Stamp Counter = 1 (1)
00:14:31.511 MSR - K86 Model Specific Registers = 1 (1)
00:14:31.511 PAE - Physical Address Extension = 0 (1)
00:14:31.511 MCE - Machine Check Exception = 0 (1)
00:14:31.511 CX8 - CMPXCHG8B instruction = 1 (1)
00:14:31.511 APIC - APIC On-Chip = 0 (1)
00:14:31.511 10 - Reserved = 0 (0)
00:14:31.511 SEP - SYSCALL and SYSRET = 0 (1)
00:14:31.511 MTRR - Memory Type Range Registers = 0 (1)
00:14:31.512 PGE - PTE Global Bit = 1 (1)
00:14:31.512 MCA - Machine Check Architecture = 0 (1)
00:14:31.512 CMOV - Conditional Move Instructions = 1 (1)
00:14:31.512 PAT - Page Attribute Table = 1 (1)
00:14:31.512 PSE-36 - 36-bit Page Size Extention = 0 (1)
00:14:31.512 18 - Reserved = 0 (0)
00:14:31.512 19 - Reserved = 0 (0)
00:14:31.512 NX - No-Execute Page Protection = 0 (1)
00:14:31.512 DS - Debug Store = 0 (0)
00:14:31.512 AXMMX - AMD Extensions to MMX Instr. = 0 (1)
00:14:31.512 MMX - Intel MMX Technology = 1 (1)
00:14:31.512 FXSR - FXSAVE and FXRSTOR Instructions = 1 (1)
00:14:31.512 25 - AMD fast FXSAVE and FXRSTOR Instr.= 1 (1)
00:14:31.512 26 - Reserved = 0 (0)
00:14:31.512 27 - Reserved = 0 (1)
00:14:31.512 28 - Reserved = 0 (0)
00:14:31.512 29 - AMD Long Mode = 0 (1)
00:14:31.512 30 - AMD Extensions to 3DNow = 1 (1)
00:14:31.512 31 - AMD 3DNow = 1 (1)
00:14:31.512 LahfSahf - LAHF/SAHF in 64-bit mode = 0 (1)
00:14:31.512 CmpLegacy - Core MP legacy mode (depr) = 0 (1)
00:14:31.512 SVM - AMD VM Extensions = 0 (1)
00:14:31.512 APIC registers starting at 0x400 = 0 (1)
00:14:31.512 AltMovCR8 - LOCK MOV CR0 means MOV CR8 = 0 (1)
00:14:31.512 Advanced bit manipulation = 0 (0)
00:14:31.512 SSE4A instruction support = 0 (0)
00:14:31.512 Misaligned SSE mode = 0 (0)
00:14:31.512 PREFETCH and PREFETCHW instruction = 0 (0)
00:14:31.512 OS visible workaround = 0 (0)
00:14:31.512 11:10 - Reserved = 0x0 (0x0)
00:14:31.512 SKINIT, STGI, and DEV support = 0 (0)
00:14:31.512 Watchdog timer support. = 0 (0)
00:14:31.512 31:14 - Reserved = 0x0 (0x0)
00:14:31.512 Full Name: AMD Turion(tm) 64 X2 Mobile Technology TL-50
snipped....
00:14:31.896 HWACMM: cpuid 0x80000001.u32AMDFeatureECX = 1f
00:14:31.896 HWACMM: cpuid 0x80000001.u32AMDFeatureEDX = ebd3fbff
00:14:31.896 HWACCM: SVM revision = 1
00:14:31.896 HWACCM: SVM max ASID = 64
|
可以看到至少在起始階段,VirtualBox是有去做相關的偵測/初始化的(後續有沒有真的派上用場就再研究了  ),不過根據 VirtualBox architecture上的描述,並不是所有動作都適合無條件SVM/VMX的   ....
引用:
One notable novelty is that all four privilege levels (rings) are supported in either mode, so guest software can theoretically run at any of them. VT-x then defines transitions from root to non-root mode (and vice versa) and calls these "VM entry" and "VM exit".
In non-root mode, the processor will automatically cause VM exits for certain privileged instructions and events. For some of these instructions, it is even configurable whether VM exits should occur.
Since, however, nearly all operating systems in use today only make use of ring-0 and ring-3, and since a lot of operations in non-root mode are very expensive, VirtualBox does not use VT-x exactly as intended by Intel. Instead, we make partial use of it -- only where it makes sense and where it helps us to improve performance. So, as said above, our hypervisor, on non-VT-x machines, lives in ring 0 of the guest context, below the guest ring-0 code that is actually run in ring 1. When VT-x is enabled, the hypervisor can safely live in ring 0 host context and gets activated automatically by use of the new VM exits.
|
__________________
士大夫之無恥,是謂國恥   ....
|