3 MSR_IA32_VMX_BASIC
= 0x480
4 MSR_IA32_VMX_PINBASED_CTLS
= 0x481
5 MSR_IA32_VMX_PROCBASED_CTLS
= 0x482
6 MSR_IA32_VMX_EXIT_CTLS
= 0x483
7 MSR_IA32_VMX_ENTRY_CTLS
= 0x484
8 MSR_IA32_VMX_MISC_CTLS
= 0x485
9 MSR_IA32_VMX_PROCBASED_CTLS2
= 0x48B
10 MSR_IA32_VMX_TRUE_PINBASED_CTLS
= 0x48D
11 MSR_IA32_VMX_TRUE_PROCBASED_CTLS
= 0x48E
12 MSR_IA32_VMX_TRUE_EXIT_CTLS
= 0x48F
13 MSR_IA32_VMX_TRUE_ENTRY_CTLS
= 0x490
18 self
.f
= file('/dev/cpu/0/msr')
20 self
.f
= file('/dev/msr0')
21 def read(self
, index
, default
= None):
25 return struct
.unpack('Q', self
.f
.read(8))[0]
29 class Control(object):
30 def __init__(self
, name
, bits
, cap_msr
, true_cap_msr
= None):
33 self
.cap_msr
= cap_msr
34 self
.true_cap_msr
= true_cap_msr
38 return (val
& 0xffffffff, val
>> 32)
41 mbz
, mb1
= self
.read2(self
.cap_msr
)
44 tmbz
, tmb1
= self
.read2(self
.true_cap_msr
)
45 for bit
in sorted(self
.bits
.keys()):
46 zero
= not (mbz
& (1 << bit
))
47 one
= mb1
& (1 << bit
)
48 true_zero
= not (tmbz
& (1 << bit
))
49 true_one
= tmb1
& (1 << bit
)
51 if (self
.true_cap_msr
and true_zero
and true_one
52 and one
and not zero
):
54 elif zero
and not one
:
56 elif one
and not zero
:
60 print ' %-40s %s' % (self
.bits
[bit
], s
)
64 name
= 'pin-based controls',
66 0: 'External interrupt exiting',
69 6: 'Activate VMX-preemption timer',
71 cap_msr
= MSR_IA32_VMX_PINBASED_CTLS
,
72 true_cap_msr
= MSR_IA32_VMX_TRUE_PINBASED_CTLS
,
76 name
= 'primary processor-based controls',
78 2: 'Interrupt window exiting',
79 3: 'Use TSC offsetting',
85 15: 'CR3-load exiting',
86 16: 'CR3-store exiting',
87 19: 'CR8-load exiting',
88 20: 'CR8-store exiting',
90 22: 'NMI-window exiting',
92 24: 'Unconditional I/O exiting',
93 25: 'Use I/O bitmaps',
94 27: 'Monitor trap flag',
95 28: 'Use MSR bitmaps',
96 29: 'MONITOR exiting',
98 31: 'Activate secondary control',
100 cap_msr
= MSR_IA32_VMX_PROCBASED_CTLS
,
101 true_cap_msr
= MSR_IA32_VMX_TRUE_PROCBASED_CTLS
,
105 name
= 'secondary processor-based controls',
107 0: 'Virtualize APIC accesses',
109 2: 'Descriptor-table exiting',
110 4: 'Virtualize x2APIC mode',
113 7: 'Unrestricted guest',
114 10: 'PAUSE-loop exiting',
116 cap_msr
= MSR_IA32_VMX_PROCBASED_CTLS2
,
120 name
= 'VM-Exit controls',
122 2: 'Save debug controls',
123 9: 'Host address-space size',
124 12: 'Load IA32_PERF_GLOBAL_CTRL',
125 15: 'Acknowledge interrupt on exit',
128 20: 'Save IA32_EFER',
129 21: 'Load IA32_EFER',
130 22: 'Save VMX-preemption timer value',
132 cap_msr
= MSR_IA32_VMX_EXIT_CTLS
,
133 true_cap_msr
= MSR_IA32_VMX_TRUE_EXIT_CTLS
,
137 name
= 'VM-Entry controls',
139 2: 'Load debug controls',
140 9: 'IA-64 mode guest',
142 11: 'Deactivate dual-monitor treatment',
143 13: 'Load IA32_PERF_GLOBAL_CTRL',
145 15: 'Load IA32_EFER',
147 cap_msr
= MSR_IA32_VMX_ENTRY_CTLS
,
148 true_cap_msr
= MSR_IA32_VMX_TRUE_ENTRY_CTLS
,