msrs_intel_x64.h
Go to the documentation of this file.
1 //
2 // Bareflank Hypervisor
3 //
4 // Copyright (C) 2015 Assured Information Security, Inc.
5 // Author: Rian Quinn <quinnr@ainfosec.com>
6 // Author: Brendan Kerrigan <kerriganb@ainfosec.com>
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 
22 #ifndef MSRS_INTEL_X64_H
23 #define MSRS_INTEL_X64_H
24 
25 #include <gsl/gsl>
26 
27 #include <debug.h>
28 #include <bitmanip.h>
29 
30 extern "C" uint64_t __read_msr(uint32_t addr) noexcept;
31 extern "C" void __write_msr(uint32_t addr, uint64_t val) noexcept;
32 
33 // *INDENT-OFF*
34 
35 namespace intel_x64
36 {
37 namespace msrs
38 {
39  using field_type = uint32_t;
40  using value_type = uint64_t;
41 
42  template<class A> inline auto get(A addr) noexcept
43  { return __read_msr(gsl::narrow_cast<field_type>(addr)); }
44 
45  template<class A, class T> void set(A addr, T val) noexcept
46  { __write_msr(gsl::narrow_cast<field_type>(addr), val); }
47 
48  namespace ia32_feature_control
49  {
50  constexpr const auto addr = 0x0000003AU;
51  constexpr const auto name = "ia32_feature_control";
52 
53  inline auto get() noexcept
54  { return __read_msr(addr); }
55 
56  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
57  void set(T val) noexcept { __write_msr(addr, val); }
58 
59  namespace lock_bit
60  {
61  constexpr const auto mask = 0x0000000000000001UL;
62  constexpr const auto from = 0;
63  constexpr const auto name = "lock_bit";
64 
65  inline auto get() noexcept
66  { return get_bit(__read_msr(addr), from) != 0; }
67 
68  inline void set(bool val) noexcept
69  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
70  }
71 
72  namespace enable_vmx_inside_smx
73  {
74  constexpr const auto mask = 0x0000000000000002UL;
75  constexpr const auto from = 1;
76  constexpr const auto name = "enable_vmx_inside_smx";
77 
78  inline auto get() noexcept
79  { return get_bit(__read_msr(addr), from) != 0; }
80 
81  inline void set(bool val) noexcept
82  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
83  }
84 
85  namespace enable_vmx_outside_smx
86  {
87  constexpr const auto mask = 0x0000000000000004UL;
88  constexpr const auto from = 2;
89  constexpr const auto name = "enable_vmx_outside_smx";
90 
91  inline auto get() noexcept
92  { return get_bit(__read_msr(addr), from) != 0; }
93 
94  inline void set(bool val) noexcept
95  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
96  }
97 
98  namespace senter_local_function_enables
99  {
100  constexpr const auto mask = 0x0000000000007F00UL;
101  constexpr const auto from = 8;
102  constexpr const auto name = "senter_local_function_enables";
103 
104  inline auto get() noexcept
105  { return get_bits(__read_msr(addr), mask) >> from; }
106 
107  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
108  void set(T val) noexcept { __write_msr(addr, set_bits(__read_msr(addr), mask, val << from)); }
109  }
110 
111  namespace senter_gloabl_function_enable
112  {
113  constexpr const auto mask = 0x0000000000008000UL;
114  constexpr const auto from = 15;
115  constexpr const auto name = "senter_gloabl_function_enables";
116 
117  inline auto get() noexcept
118  { return get_bit(__read_msr(addr), from) != 0; }
119 
120  inline void set(bool val) noexcept
121  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
122  }
123 
124  namespace sgx_launch_control_enable
125  {
126  constexpr const auto mask = 0x0000000000020000UL;
127  constexpr const auto from = 17;
128  constexpr const auto name = "sgx_launch_control_enable";
129 
130  inline auto get() noexcept
131  { return get_bit(__read_msr(addr), from) != 0; }
132 
133  inline void set(bool val) noexcept
134  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
135  }
136 
137  namespace sgx_global_enable
138  {
139  constexpr const auto mask = 0x0000000000040000UL;
140  constexpr const auto from = 18;
141  constexpr const auto name = "sgx_global_enable";
142 
143  inline auto get() noexcept
144  { return get_bit(__read_msr(addr), from) != 0; }
145 
146  inline void set(bool val) noexcept
147  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
148  }
149 
150  namespace lmce
151  {
152  constexpr const auto mask = 0x0000000000100000UL;
153  constexpr const auto from = 20;
154  constexpr const auto name = "lmce";
155 
156  inline auto get() noexcept
157  { return get_bit(__read_msr(addr), from) != 0; }
158 
159  inline void set(bool val) noexcept
160  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
161  }
162 
163  inline void dump() noexcept
164  {
165  bfdebug << "msrs::ia32_feature_control enabled flags:" << bfendl;
166 
167  if (lock_bit::get())
168  bfdebug << " - " << lock_bit::name << bfendl;
170  bfdebug << " - " << enable_vmx_inside_smx::name << bfendl;
172  bfdebug << " - " << enable_vmx_outside_smx::name << bfendl;
174  bfdebug << " - " << senter_gloabl_function_enable::name << bfendl;
176  bfdebug << " - " << sgx_launch_control_enable::name << bfendl;
178  bfdebug << " - " << sgx_global_enable::name << bfendl;
179  if (lmce::get())
180  bfdebug << " - " << lmce::name << bfendl;
181 
182  bfdebug << bfendl;
183  bfdebug << "msrs::ia32_feature_control fields:" << bfendl;
184 
185  bfdebug << " - " << senter_local_function_enables::name << " = "
187  }
188  }
189 
190  namespace ia32_sysenter_cs
191  {
192  constexpr const auto addr = 0x00000174U;
193  constexpr const auto name = "ia32_sysenter_cs";
194 
195  inline auto get() noexcept
196  { return __read_msr(addr); }
197 
198  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
199  void set(T val) noexcept { __write_msr(addr, val); }
200  }
201 
202  namespace ia32_sysenter_esp
203  {
204  constexpr const auto addr = 0x00000175U;
205  constexpr const auto name = "ia32_sysenter_esp";
206 
207  inline auto get() noexcept
208  { return __read_msr(addr); }
209 
210  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
211  void set(T val) noexcept { __write_msr(addr, val); }
212  }
213 
214  namespace ia32_sysenter_eip
215  {
216  constexpr const auto addr = 0x00000176;
217  constexpr const auto name = "ia32_sysenter_eip";
218 
219  inline auto get() noexcept
220  { return __read_msr(addr); }
221 
222  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
223  void set(T val) noexcept { __write_msr(addr, val); }
224  }
225 
226  namespace ia32_debugctl
227  {
228  constexpr const auto addr = 0x000001D9U;
229  constexpr const auto name = "ia32_debugctl";
230 
231  inline auto get() noexcept
232  { return __read_msr(addr); }
233 
234  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
235  void set(T val) noexcept { __write_msr(addr, val); }
236 
237  namespace lbr
238  {
239  constexpr const auto mask = 0x0000000000000001UL;
240  constexpr const auto from = 0;
241  constexpr const auto name = "lbr";
242 
243  inline auto get() noexcept
244  { return get_bit(__read_msr(addr), from) != 0; }
245 
246  inline void set(bool val) noexcept
247  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
248  }
249 
250  namespace btf
251  {
252  constexpr const auto mask = 0x0000000000000002UL;
253  constexpr const auto from = 1;
254  constexpr const auto name = "btf";
255 
256  inline auto get() noexcept
257  { return get_bit(__read_msr(addr), from) != 0; }
258 
259  inline void set(bool val) noexcept
260  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
261  }
262 
263  namespace tr
264  {
265  constexpr const auto mask = 0x0000000000000040UL;
266  constexpr const auto from = 6;
267  constexpr const auto name = "tr";
268 
269  inline auto get() noexcept
270  { return get_bit(__read_msr(addr), from) != 0; }
271 
272  inline void set(bool val) noexcept
273  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
274  }
275 
276  namespace bts
277  {
278  constexpr const auto mask = 0x0000000000000080UL;
279  constexpr const auto from = 7;
280  constexpr const auto name = "bts";
281 
282  inline auto get() noexcept
283  { return get_bit(__read_msr(addr), from) != 0; }
284 
285  inline void set(bool val) noexcept
286  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
287  }
288 
289  namespace btint
290  {
291  constexpr const auto mask = 0x0000000000000100UL;
292  constexpr const auto from = 8;
293  constexpr const auto name = "btint";
294 
295  inline auto get() noexcept
296  { return get_bit(__read_msr(addr), from) != 0; }
297 
298  inline void set(bool val) noexcept
299  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
300  }
301 
302  namespace bt_off_os
303  {
304  constexpr const auto mask = 0x0000000000000200UL;
305  constexpr const auto from = 9;
306  constexpr const auto name = "bt_off_os";
307 
308  inline auto get() noexcept
309  { return get_bit(__read_msr(addr), from) != 0; }
310 
311  inline void set(bool val) noexcept
312  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
313  }
314 
315  namespace bt_off_user
316  {
317  constexpr const auto mask = 0x0000000000000400UL;
318  constexpr const auto from = 10;
319  constexpr const auto name = "bt_off_user";
320 
321  inline auto get() noexcept
322  { return get_bit(__read_msr(addr), from) != 0; }
323 
324  inline void set(bool val) noexcept
325  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
326  }
327 
328  namespace freeze_lbrs_on_pmi
329  {
330  constexpr const auto mask = 0x0000000000000800UL;
331  constexpr const auto from = 11;
332  constexpr const auto name = "freeze_lbrs_on_pmi";
333 
334  inline auto get() noexcept
335  { return get_bit(__read_msr(addr), from) != 0; }
336 
337  inline void set(bool val) noexcept
338  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
339  }
340 
341  namespace freeze_perfmon_on_pmi
342  {
343  constexpr const auto mask = 0x0000000000001000UL;
344  constexpr const auto from = 12;
345  constexpr const auto name = "freeze_perfmon_on_pmi";
346 
347  inline auto get() noexcept
348  { return get_bit(__read_msr(addr), from) != 0; }
349 
350  inline void set(bool val) noexcept
351  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
352  }
353 
354  namespace enable_uncore_pmi
355  {
356  constexpr const auto mask = 0x0000000000002000UL;
357  constexpr const auto from = 13;
358  constexpr const auto name = "enable_uncore_pmi";
359 
360  inline auto get() noexcept
361  { return get_bit(__read_msr(addr), from) != 0; }
362 
363  inline void set(bool val) noexcept
364  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
365  }
366 
367  namespace freeze_while_smm
368  {
369  constexpr const auto mask = 0x0000000000004000UL;
370  constexpr const auto from = 14;
371  constexpr const auto name = "freeze_while_smm";
372 
373  inline auto get() noexcept
374  { return get_bit(__read_msr(addr), from) != 0; }
375 
376  inline void set(bool val) noexcept
377  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
378  }
379 
380  namespace rtm_debug
381  {
382  constexpr const auto mask = 0x0000000000008000UL;
383  constexpr const auto from = 15;
384  constexpr const auto name = "rtm_debug";
385 
386  inline auto get() noexcept
387  { return get_bit(__read_msr(addr), from) != 0; }
388 
389  inline void set(bool val) noexcept
390  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
391  }
392 
393  namespace reserved
394  {
395  constexpr const auto mask = 0xFFFFFFFFFFFF003CUL;
396  constexpr const auto from = 0;
397  constexpr const auto name = "reserved";
398 
399  inline auto get() noexcept
400  { return get_bits(__read_msr(addr), mask) >> from; }
401 
402  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
403  void set(T val) noexcept { __write_msr(addr, set_bits(__read_msr(addr), mask, val << from)); }
404  }
405 
406  inline void dump() noexcept
407  {
408  bfdebug << "msrs::ia32_debugctl enabled flags:" << bfendl;
409 
410  if (lbr::get())
411  bfdebug << " - " << lbr::name << bfendl;
412  if (btf::get())
413  bfdebug << " - " << btf::name << bfendl;
414  if (tr::get())
415  bfdebug << " - " << tr::name << bfendl;
416  if (bts::get())
417  bfdebug << " - " << bts::name << bfendl;
418  if (btint::get())
419  bfdebug << " - " << btint::name << bfendl;
420  if (bt_off_os::get())
421  bfdebug << " - " << bt_off_os::name << bfendl;
422  if (bt_off_user::get())
423  bfdebug << " - " << bt_off_user::name << bfendl;
425  bfdebug << " - " << freeze_lbrs_on_pmi::name << bfendl;
427  bfdebug << " - " << freeze_perfmon_on_pmi::name << bfendl;
429  bfdebug << " - " << enable_uncore_pmi::name << bfendl;
430  if (freeze_while_smm::get())
431  bfdebug << " - " << freeze_while_smm::name << bfendl;
432  if (rtm_debug::get())
433  bfdebug << " - " << rtm_debug::name << bfendl;
434  }
435  }
436 
437  namespace ia32_perf_global_ctrl
438  {
439  constexpr const auto addr = 0x0000038FU;
440  constexpr const auto name = "ia32_perf_global_ctrl";
441 
442  inline auto get() noexcept
443  { return __read_msr(addr); }
444 
445  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
446  void set(T val) noexcept { __write_msr(addr, val); }
447 
448  namespace pmc0
449  {
450  constexpr const auto mask = 0x0000000000000001UL;
451  constexpr const auto from = 0;
452  constexpr const auto name = "pmc0";
453 
454  inline auto get() noexcept
455  { return get_bit(__read_msr(addr), from) != 0; }
456 
457  inline void set(bool val) noexcept
458  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
459  }
460 
461  namespace pmc1
462  {
463  constexpr const auto mask = 0x0000000000000002UL;
464  constexpr const auto from = 1;
465  constexpr const auto name = "pmc1";
466 
467  inline auto get() noexcept
468  { return get_bit(__read_msr(addr), from) != 0; }
469 
470  inline void set(bool val) noexcept
471  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
472  }
473 
474  namespace pmc2
475  {
476  constexpr const auto mask = 0x0000000000000004UL;
477  constexpr const auto from = 2;
478  constexpr const auto name = "pmc2";
479 
480  inline auto get() noexcept
481  { return get_bit(__read_msr(addr), from) != 0; }
482 
483  inline void set(bool val) noexcept
484  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
485  }
486 
487  namespace pmc3
488  {
489  constexpr const auto mask = 0x0000000000000008UL;
490  constexpr const auto from = 3;
491  constexpr const auto name = "pmc3";
492 
493  inline auto get() noexcept
494  { return get_bit(__read_msr(addr), from) != 0; }
495 
496  inline void set(bool val) noexcept
497  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
498  }
499 
500  namespace pmc4
501  {
502  constexpr const auto mask = 0x0000000000000010UL;
503  constexpr const auto from = 4;
504  constexpr const auto name = "pmc4";
505 
506  inline auto get() noexcept
507  { return get_bit(__read_msr(addr), from) != 0; }
508 
509  inline void set(bool val) noexcept
510  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
511  }
512 
513  namespace pmc5
514  {
515  constexpr const auto mask = 0x0000000000000020UL;
516  constexpr const auto from = 5;
517  constexpr const auto name = "pmc5";
518 
519  inline auto get() noexcept
520  { return get_bit(__read_msr(addr), from) != 0; }
521 
522  inline void set(bool val) noexcept
523  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
524  }
525 
526  namespace pmc6
527  {
528  constexpr const auto mask = 0x0000000000000040UL;
529  constexpr const auto from = 6;
530  constexpr const auto name = "pmc6";
531 
532  inline auto get() noexcept
533  { return get_bit(__read_msr(addr), from) != 0; }
534 
535  inline void set(bool val) noexcept
536  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
537  }
538 
539  namespace pmc7
540  {
541  constexpr const auto mask = 0x0000000000000080UL;
542  constexpr const auto from = 7;
543  constexpr const auto name = "pmc7";
544 
545  inline auto get() noexcept
546  { return get_bit(__read_msr(addr), from) != 0; }
547 
548  inline void set(bool val) noexcept
549  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
550  }
551 
552  namespace fixed_ctr0
553  {
554  constexpr const auto mask = 0x0000000100000000UL;
555  constexpr const auto from = 32;
556  constexpr const auto name = "fixed_ctr0";
557 
558  inline auto get() noexcept
559  { return get_bit(__read_msr(addr), from) != 0; }
560 
561  inline void set(bool val) noexcept
562  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
563  }
564 
565  namespace fixed_ctr1
566  {
567  constexpr const auto mask = 0x0000000200000000UL;
568  constexpr const auto from = 33;
569  constexpr const auto name = "fixed_ctr1";
570 
571  inline auto get() noexcept
572  { return get_bit(__read_msr(addr), from) != 0; }
573 
574  inline void set(bool val) noexcept
575  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
576  }
577 
578  namespace fixed_ctr2
579  {
580  constexpr const auto mask = 0x0000000400000000UL;
581  constexpr const auto from = 34;
582  constexpr const auto name = "fixed_ctr2";
583 
584  inline auto get() noexcept
585  { return get_bit(__read_msr(addr), from) != 0; }
586 
587  inline void set(bool val) noexcept
588  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
589  }
590 
591  inline void dump() noexcept
592  {
593  bfdebug << "msrs::ia32_perf_global_ctrl enabled flags:" << bfendl;
594 
595  if (pmc0::get())
596  bfdebug << " - " << pmc0::name << bfendl;
597  if (pmc1::get())
598  bfdebug << " - " << pmc1::name << bfendl;
599  if (pmc2::get())
600  bfdebug << " - " << pmc2::name << bfendl;
601  if (pmc3::get())
602  bfdebug << " - " << pmc3::name << bfendl;
603  if (pmc4::get())
604  bfdebug << " - " << pmc4::name << bfendl;
605  if (pmc5::get())
606  bfdebug << " - " << pmc5::name << bfendl;
607  if (pmc6::get())
608  bfdebug << " - " << pmc6::name << bfendl;
609  if (pmc7::get())
610  bfdebug << " - " << pmc7::name << bfendl;
611  if (fixed_ctr0::get())
612  bfdebug << " - " << fixed_ctr0::name << bfendl;
613  if (fixed_ctr1::get())
614  bfdebug << " - " << fixed_ctr1::name << bfendl;
615  if (fixed_ctr2::get())
616  bfdebug << " - " << fixed_ctr2::name << bfendl;
617  }
618  }
619 
620  namespace ia32_vmx_basic
621  {
622  constexpr const auto addr = 0x00000480U;
623  constexpr const auto name = "ia32_vmx_basic";
624 
625  inline auto get() noexcept
626  { return __read_msr(addr); }
627 
628  namespace revision_id
629  {
630  constexpr const auto mask = 0x000000007FFFFFFFUL;
631  constexpr const auto from = 0;
632  constexpr const auto name = "revision_id";
633 
634  inline auto get() noexcept
635  { return get_bits(__read_msr(addr), mask) >> from; }
636  }
637 
638  namespace vmxon_vmcs_region_size
639  {
640  constexpr const auto mask = 0x00001FFF00000000UL;
641  constexpr const auto from = 32;
642  constexpr const auto name = "vmxon_vmcs_region_size";
643 
644  inline auto get() noexcept
645  { return get_bits(__read_msr(addr), mask) >> from; }
646  }
647 
648  namespace physical_address_width
649  {
650  constexpr const auto mask = 0x0001000000000000UL;
651  constexpr const auto from = 48;
652  constexpr const auto name = "physical_address_width";
653 
654  inline auto get() noexcept
655  { return get_bit(__read_msr(addr), from) != 0; }
656  }
657 
658  namespace dual_monitor_mode_support
659  {
660  constexpr const auto mask = 0x0002000000000000UL;
661  constexpr const auto from = 49;
662  constexpr const auto name = "dual_monitor_mode_support";
663 
664  inline auto get() noexcept
665  { return get_bit(__read_msr(addr), from) != 0; }
666  }
667 
668  namespace memory_type
669  {
670  constexpr const auto mask = 0x003C000000000000UL;
671  constexpr const auto from = 50;
672  constexpr const auto name = "memory_type";
673 
674  inline auto get() noexcept
675  { return get_bits(__read_msr(addr), mask) >> from; }
676  }
677 
678  namespace ins_outs_exit_information
679  {
680  constexpr const auto mask = 0x0040000000000000UL;
681  constexpr const auto from = 54;
682  constexpr const auto name = "ins_outs_exit_information";
683 
684  inline auto get() noexcept
685  { return get_bit(__read_msr(addr), from) != 0; }
686  }
687 
688  namespace true_based_controls
689  {
690  constexpr const auto mask = 0x0080000000000000UL;
691  constexpr const auto from = 55;
692  constexpr const auto name = "true_based_controls";
693 
694  inline auto get() noexcept
695  { return get_bit(__read_msr(addr), from) != 0; }
696  }
697 
698  inline void dump() noexcept
699  {
700  bfdebug << "msrs::ia32_vmx_basic enabled flags:" << bfendl;
701 
703  bfdebug << " - " << physical_address_width::name << bfendl;
705  bfdebug << " - " << dual_monitor_mode_support::name << bfendl;
707  bfdebug << " - " << ins_outs_exit_information::name << bfendl;
709  bfdebug << " - " << true_based_controls::name << bfendl;
710 
711  bfdebug << bfendl;
712  bfdebug << "msrs::ia32_vmx_basic fields:" << bfendl;
713 
714  bfdebug << " - " << revision_id::name << " = "
715  << view_as_pointer(revision_id::get()) << bfendl;
716  bfdebug << " - " << vmxon_vmcs_region_size::name << " = "
718  bfdebug << " - " << memory_type::name << " = "
719  << view_as_pointer(memory_type::get()) << bfendl;
720  }
721  }
722 
723  namespace ia32_vmx_misc
724  {
725  constexpr const auto addr = 0x00000485U;
726  constexpr const auto name = "ia32_vmx_misc";
727 
728  inline auto get() noexcept
729  { return __read_msr(addr); }
730 
731  namespace preemption_timer_decrement
732  {
733  constexpr const auto mask = 0x000000000000001FUL;
734  constexpr const auto from = 0;
735  constexpr const auto name = "preemption_timer_decrement";
736 
737  inline auto get() noexcept
738  { return get_bits(__read_msr(addr), mask) >> from; }
739  }
740 
741  namespace store_efer_lma_on_vm_exit
742  {
743  constexpr const auto mask = 0x0000000000000020UL;
744  constexpr const auto from = 5;
745  constexpr const auto name = "store_efer_lma_on_vm_exit";
746 
747  inline auto get() noexcept
748  { return get_bit(__read_msr(addr), from) != 0; }
749  }
750 
751  namespace activity_state_hlt_support
752  {
753  constexpr const auto mask = 0x0000000000000040UL;
754  constexpr const auto from = 6;
755  constexpr const auto name = "activity_state_hlt_support";
756 
757  inline auto get() noexcept
758  { return get_bit(__read_msr(addr), from) != 0; }
759  }
760 
761  namespace activity_state_shutdown_support
762  {
763  constexpr const auto mask = 0x0000000000000080UL;
764  constexpr const auto from = 7;
765  constexpr const auto name = "activity_state_shutdown_support";
766 
767  inline auto get() noexcept
768  { return get_bit(__read_msr(addr), from) != 0; }
769  }
770 
771  namespace activity_state_wait_for_sipi_support
772  {
773  constexpr const auto mask = 0x0000000000000100UL;
774  constexpr const auto from = 8;
775  constexpr const auto name = "activity_state_wait_for_sipi_support";
776 
777  inline auto get() noexcept
778  { return get_bit(__read_msr(addr), from) != 0; }
779  }
780 
781  namespace processor_trace_support
782  {
783  constexpr const auto mask = 0x0000000000004000UL;
784  constexpr const auto from = 14;
785  constexpr const auto name = "processor_trace_support";
786 
787  inline auto get() noexcept
788  { return get_bit(__read_msr(addr), from) != 0; }
789  }
790 
791  namespace rdmsr_in_smm_support
792  {
793  constexpr const auto mask = 0x0000000000008000UL;
794  constexpr const auto from = 15;
795  constexpr const auto name = "rdmsr_in_smm_support";
796 
797  inline auto get() noexcept
798  { return get_bit(__read_msr(addr), from) != 0; }
799  }
800 
801  namespace cr3_targets
802  {
803  constexpr const auto mask = 0x0000000001FF0000UL;
804  constexpr const auto from = 16;
805  constexpr const auto name = "cr3_targets";
806 
807  inline auto get() noexcept
808  { return get_bits(__read_msr(addr), mask) >> from; }
809  }
810 
811  namespace max_num_msr_load_store_on_exit
812  {
813  constexpr const auto mask = 0x000000000E000000UL;
814  constexpr const auto from = 25;
815  constexpr const auto name = "max_num_msr_load_store_on_exit";
816 
817  inline auto get() noexcept
818  { return get_bits(__read_msr(addr), mask) >> from; }
819  }
820 
821  namespace vmxoff_blocked_smi_support
822  {
823  constexpr const auto mask = 0x0000000010000000UL;
824  constexpr const auto from = 28;
825  constexpr const auto name = "vmxoff_blocked_smi_support";
826 
827  inline auto get() noexcept
828  { return get_bit(__read_msr(addr), from) != 0; }
829  }
830 
831  namespace vmwrite_all_fields_support
832  {
833  constexpr const auto mask = 0x0000000020000000UL;
834  constexpr const auto from = 29;
835  constexpr const auto name = "vmwrite_all_fields_support";
836 
837  inline auto get() noexcept
838  { return get_bit(__read_msr(addr), from) != 0; }
839  }
840 
841  namespace injection_with_instruction_length_of_zero
842  {
843  constexpr const auto mask = 0x0000000040000000UL;
844  constexpr const auto from = 30;
845  constexpr const auto name = "injection_with_instruction_length_of_zero";
846 
847  inline auto get() noexcept
848  { return get_bit(__read_msr(addr), from) != 0; }
849  }
850 
851  inline void dump() noexcept
852  {
853  bfdebug << "msrs::ia32_vmx_misc enabled flags:" << bfendl;
854 
856  bfdebug << " - " << store_efer_lma_on_vm_exit::name << bfendl;
858  bfdebug << " - " << activity_state_hlt_support::name << bfendl;
860  bfdebug << " - " << activity_state_shutdown_support::name << bfendl;
862  bfdebug << " - " << activity_state_wait_for_sipi_support::name << bfendl;
864  bfdebug << " - " << processor_trace_support::name << bfendl;
866  bfdebug << " - " << rdmsr_in_smm_support::name << bfendl;
868  bfdebug << " - " << vmxoff_blocked_smi_support::name << bfendl;
870  bfdebug << " - " << vmwrite_all_fields_support::name << bfendl;
872  bfdebug << " - " << injection_with_instruction_length_of_zero::name << bfendl;
873 
874  bfdebug << bfendl;
875  bfdebug << "msrs::ia32_vmx_misc fields:" << bfendl;
876 
877  bfdebug << " - " << preemption_timer_decrement::name << " = "
879  bfdebug << " - " << cr3_targets::name << " = "
880  << view_as_pointer(cr3_targets::get()) << bfendl;
881  bfdebug << " - " << max_num_msr_load_store_on_exit::name << " = "
883  }
884  }
885 
886  namespace ia32_vmx_cr0_fixed0
887  {
888  constexpr const auto addr = 0x00000486U;
889  constexpr const auto name = "ia32_vmx_cr0_fixed0";
890 
891  inline auto get() noexcept
892  { return __read_msr(addr); }
893  }
894 
895  namespace ia32_vmx_cr0_fixed1
896  {
897  constexpr const auto addr = 0x00000487U;
898  constexpr const auto name = "ia32_vmx_cr0_fixed1";
899 
900  inline auto get() noexcept
901  { return __read_msr(addr); }
902  }
903 
904  namespace ia32_vmx_cr4_fixed0
905  {
906  constexpr const auto addr = 0x00000488U;
907  constexpr const auto name = "ia32_vmx_cr4_fixed0";
908 
909  inline auto get() noexcept
910  { return __read_msr(addr); }
911  }
912 
913  namespace ia32_vmx_cr4_fixed1
914  {
915  constexpr const auto addr = 0x00000489U;
916  constexpr const auto name = "ia32_vmx_cr4_fixed1";
917 
918  inline auto get() noexcept
919  { return __read_msr(addr); }
920  }
921 
922  namespace ia32_vmx_procbased_ctls2
923  {
924  constexpr const auto addr = 0x0000048BU;
925  constexpr const auto name = "ia32_vmx_procbased_ctls2";
926 
927  inline auto get() noexcept
928  { return __read_msr(addr); }
929 
930  inline auto allowed0()
931  { return (__read_msr(addr) & 0x00000000FFFFFFFFUL); }
932 
933  inline auto allowed1()
934  { return ((__read_msr(addr) & 0xFFFFFFFF00000000UL) >> 32); }
935 
936  namespace virtualize_apic_accesses
937  {
938  constexpr const auto mask = 0x0000000000000001UL;
939  constexpr const auto from = 0;
940  constexpr const auto name = "virtualize_apic_accesses";
941 
942  inline auto get() noexcept
943  { return get_bit(__read_msr(addr), from) != 0; }
944 
945  inline auto is_allowed0() noexcept
946  { return (__read_msr(addr) & mask) == 0; }
947 
948  inline auto is_allowed1() noexcept
949  { return (__read_msr(addr) & (mask << 32)) != 0; }
950  }
951 
952  namespace enable_ept
953  {
954  constexpr const auto mask = 0x0000000000000002UL;
955  constexpr const auto from = 1;
956  constexpr const auto name = "enable_ept";
957 
958  inline auto get() noexcept
959  { return get_bit(__read_msr(addr), from) != 0; }
960 
961  inline auto is_allowed0() noexcept
962  { return (__read_msr(addr) & mask) == 0; }
963 
964  inline auto is_allowed1() noexcept
965  { return (__read_msr(addr) & (mask << 32)) != 0; }
966  }
967 
968  namespace descriptor_table_exiting
969  {
970  constexpr const auto mask = 0x0000000000000004UL;
971  constexpr const auto from = 2;
972  constexpr const auto name = "descriptor_table_exiting";
973 
974  inline auto get() noexcept
975  { return get_bit(__read_msr(addr), from) != 0; }
976 
977  inline auto is_allowed0() noexcept
978  { return (__read_msr(addr) & mask) == 0; }
979 
980  inline auto is_allowed1() noexcept
981  { return (__read_msr(addr) & (mask << 32)) != 0; }
982  }
983 
984  namespace enable_rdtscp
985  {
986  constexpr const auto mask = 0x0000000000000008UL;
987  constexpr const auto from = 3;
988  constexpr const auto name = "enable_rdtscp";
989 
990  inline auto get() noexcept
991  { return get_bit(__read_msr(addr), from) != 0; }
992 
993  inline auto is_allowed0() noexcept
994  { return (__read_msr(addr) & mask) == 0; }
995 
996  inline auto is_allowed1() noexcept
997  { return (__read_msr(addr) & (mask << 32)) != 0; }
998  }
999 
1000  namespace virtualize_x2apic_mode
1001  {
1002  constexpr const auto mask = 0x0000000000000010UL;
1003  constexpr const auto from = 4;
1004  constexpr const auto name = "virtualize_x2apic_mode";
1005 
1006  inline auto get() noexcept
1007  { return get_bit(__read_msr(addr), from) != 0; }
1008 
1009  inline auto is_allowed0() noexcept
1010  { return (__read_msr(addr) & mask) == 0; }
1011 
1012  inline auto is_allowed1() noexcept
1013  { return (__read_msr(addr) & (mask << 32)) != 0; }
1014  }
1015 
1016  namespace enable_vpid
1017  {
1018  constexpr const auto mask = 0x0000000000000020UL;
1019  constexpr const auto from = 5;
1020  constexpr const auto name = "enable_vpid";
1021 
1022  inline auto get() noexcept
1023  { return get_bit(__read_msr(addr), from) != 0; }
1024 
1025  inline auto is_allowed0() noexcept
1026  { return (__read_msr(addr) & mask) == 0; }
1027 
1028  inline auto is_allowed1() noexcept
1029  { return (__read_msr(addr) & (mask << 32)) != 0; }
1030  }
1031 
1032  namespace wbinvd_exiting
1033  {
1034  constexpr const auto mask = 0x0000000000000040UL;
1035  constexpr const auto from = 6;
1036  constexpr const auto name = "wbinvd_exiting";
1037 
1038  inline auto get() noexcept
1039  { return get_bit(__read_msr(addr), from) != 0; }
1040 
1041  inline auto is_allowed0() noexcept
1042  { return (__read_msr(addr) & mask) == 0; }
1043 
1044  inline auto is_allowed1() noexcept
1045  { return (__read_msr(addr) & (mask << 32)) != 0; }
1046  }
1047 
1048  namespace unrestricted_guest
1049  {
1050  constexpr const auto mask = 0x0000000000000080UL;
1051  constexpr const auto from = 7;
1052  constexpr const auto name = "unrestricted_guest";
1053 
1054  inline auto get() noexcept
1055  { return get_bit(__read_msr(addr), from) != 0; }
1056 
1057  inline auto is_allowed0() noexcept
1058  { return (__read_msr(addr) & mask) == 0; }
1059 
1060  inline auto is_allowed1() noexcept
1061  { return (__read_msr(addr) & (mask << 32)) != 0; }
1062  }
1063 
1064  namespace apic_register_virtualization
1065  {
1066  constexpr const auto mask = 0x0000000000000100UL;
1067  constexpr const auto from = 8;
1068  constexpr const auto name = "apic_register_virtualization";
1069 
1070  inline auto get() noexcept
1071  { return get_bit(__read_msr(addr), from) != 0; }
1072 
1073  inline auto is_allowed0() noexcept
1074  { return (__read_msr(addr) & mask) == 0; }
1075 
1076  inline auto is_allowed1() noexcept
1077  { return (__read_msr(addr) & (mask << 32)) != 0; }
1078  }
1079 
1080  namespace virtual_interrupt_delivery
1081  {
1082  constexpr const auto mask = 0x0000000000000200UL;
1083  constexpr const auto from = 9;
1084  constexpr const auto name = "virtual_interrupt_delivery";
1085 
1086  inline auto get() noexcept
1087  { return get_bit(__read_msr(addr), from) != 0; }
1088 
1089  inline auto is_allowed0() noexcept
1090  { return (__read_msr(addr) & mask) == 0; }
1091 
1092  inline auto is_allowed1() noexcept
1093  { return (__read_msr(addr) & (mask << 32)) != 0; }
1094  }
1095 
1096  namespace pause_loop_exiting
1097  {
1098  constexpr const auto mask = 0x0000000000000400UL;
1099  constexpr const auto from = 10;
1100  constexpr const auto name = "pause_loop_exiting";
1101 
1102  inline auto get() noexcept
1103  { return get_bit(__read_msr(addr), from) != 0; }
1104 
1105  inline auto is_allowed0() noexcept
1106  { return (__read_msr(addr) & mask) == 0; }
1107 
1108  inline auto is_allowed1() noexcept
1109  { return (__read_msr(addr) & (mask << 32)) != 0; }
1110  }
1111 
1112  namespace rdrand_exiting
1113  {
1114  constexpr const auto mask = 0x0000000000000800UL;
1115  constexpr const auto from = 11;
1116  constexpr const auto name = "rdrand_exiting";
1117 
1118  inline auto get() noexcept
1119  { return get_bit(__read_msr(addr), from) != 0; }
1120 
1121  inline auto is_allowed0() noexcept
1122  { return (__read_msr(addr) & mask) == 0; }
1123 
1124  inline auto is_allowed1() noexcept
1125  { return (__read_msr(addr) & (mask << 32)) != 0; }
1126  }
1127 
1128  namespace enable_invpcid
1129  {
1130  constexpr const auto mask = 0x0000000000001000UL;
1131  constexpr const auto from = 12;
1132  constexpr const auto name = "enable_invpcid";
1133 
1134  inline auto get() noexcept
1135  { return get_bit(__read_msr(addr), from) != 0; }
1136 
1137  inline auto is_allowed0() noexcept
1138  { return (__read_msr(addr) & mask) == 0; }
1139 
1140  inline auto is_allowed1() noexcept
1141  { return (__read_msr(addr) & (mask << 32)) != 0; }
1142  }
1143 
1144  namespace enable_vm_functions
1145  {
1146  constexpr const auto mask = 0x0000000000002000UL;
1147  constexpr const auto from = 13;
1148  constexpr const auto name = "enable_vm_functions";
1149 
1150  inline auto get() noexcept
1151  { return get_bit(__read_msr(addr), from) != 0; }
1152 
1153  inline auto is_allowed0() noexcept
1154  { return (__read_msr(addr) & mask) == 0; }
1155 
1156  inline auto is_allowed1() noexcept
1157  { return (__read_msr(addr) & (mask << 32)) != 0; }
1158  }
1159 
1160  namespace vmcs_shadowing
1161  {
1162  constexpr const auto mask = 0x0000000000004000UL;
1163  constexpr const auto from = 14;
1164  constexpr const auto name = "vmcs_shadowing";
1165 
1166  inline auto get() noexcept
1167  { return get_bit(__read_msr(addr), from) != 0; }
1168 
1169  inline auto is_allowed0() noexcept
1170  { return (__read_msr(addr) & mask) == 0; }
1171 
1172  inline auto is_allowed1() noexcept
1173  { return (__read_msr(addr) & (mask << 32)) != 0; }
1174  }
1175 
1176  namespace rdseed_exiting
1177  {
1178  constexpr const auto mask = 0x0000000000010000UL;
1179  constexpr const auto from = 16;
1180  constexpr const auto name = "rdseed_exiting";
1181 
1182  inline auto get() noexcept
1183  { return get_bit(__read_msr(addr), from) != 0; }
1184 
1185  inline auto is_allowed0() noexcept
1186  { return (__read_msr(addr) & mask) == 0; }
1187 
1188  inline auto is_allowed1() noexcept
1189  { return (__read_msr(addr) & (mask << 32)) != 0; }
1190  }
1191 
1192  namespace enable_pml
1193  {
1194  constexpr const auto mask = 0x0000000000020000UL;
1195  constexpr const auto from = 17;
1196  constexpr const auto name = "enable_pml";
1197 
1198  inline auto get() noexcept
1199  { return get_bit(__read_msr(addr), from) != 0; }
1200 
1201  inline auto is_allowed0() noexcept
1202  { return (__read_msr(addr) & mask) == 0; }
1203 
1204  inline auto is_allowed1() noexcept
1205  { return (__read_msr(addr) & (mask << 32)) != 0; }
1206  }
1207 
1208  namespace ept_violation_ve
1209  {
1210  constexpr const auto mask = 0x0000000000040000UL;
1211  constexpr const auto from = 18;
1212  constexpr const auto name = "ept_violation_ve";
1213 
1214  inline auto get() noexcept
1215  { return get_bit(__read_msr(addr), from) != 0; }
1216 
1217  inline auto is_allowed0() noexcept
1218  { return (__read_msr(addr) & mask) == 0; }
1219 
1220  inline auto is_allowed1() noexcept
1221  { return (__read_msr(addr) & (mask << 32)) != 0; }
1222  }
1223 
1224  namespace enable_xsaves_xrstors
1225  {
1226  constexpr const auto mask = 0x0000000000100000UL;
1227  constexpr const auto from = 20;
1228  constexpr const auto name = "enable_xsaves_xrstors";
1229 
1230  inline auto get() noexcept
1231  { return get_bit(__read_msr(addr), from) != 0; }
1232 
1233  inline auto is_allowed0() noexcept
1234  { return (__read_msr(addr) & mask) == 0; }
1235 
1236  inline auto is_allowed1() noexcept
1237  { return (__read_msr(addr) & (mask << 32)) != 0; }
1238  }
1239 
1240  inline void dump() noexcept
1241  {
1242  bfdebug << "msrs::ia32_vmx_procbased_ctls2 enabled flags:" << bfendl;
1243 
1245  bfdebug << " - " << virtualize_apic_accesses::name << bfendl;
1246  if (enable_ept::get())
1247  bfdebug << " - " << enable_ept::name << bfendl;
1249  bfdebug << " - " << descriptor_table_exiting::name << bfendl;
1250  if (enable_rdtscp::get())
1251  bfdebug << " - " << enable_rdtscp::name << bfendl;
1253  bfdebug << " - " << virtualize_x2apic_mode::name << bfendl;
1254  if (enable_vpid::get())
1255  bfdebug << " - " << enable_vpid::name << bfendl;
1256  if (wbinvd_exiting::get())
1257  bfdebug << " - " << wbinvd_exiting::name << bfendl;
1259  bfdebug << " - " << unrestricted_guest::name << bfendl;
1261  bfdebug << " - " << apic_register_virtualization::name << bfendl;
1263  bfdebug << " - " << virtual_interrupt_delivery::name << bfendl;
1265  bfdebug << " - " << pause_loop_exiting::name << bfendl;
1266  if (rdrand_exiting::get())
1267  bfdebug << " - " << rdrand_exiting::name << bfendl;
1268  if (enable_invpcid::get())
1269  bfdebug << " - " << enable_invpcid::name << bfendl;
1271  bfdebug << " - " << enable_vm_functions::name << bfendl;
1272  if (vmcs_shadowing::get())
1273  bfdebug << " - " << vmcs_shadowing::name << bfendl;
1274  if (rdseed_exiting::get())
1275  bfdebug << " - " << rdseed_exiting::name << bfendl;
1276  if (enable_pml::get())
1277  bfdebug << " - " << enable_pml::name << bfendl;
1278  if (ept_violation_ve::get())
1279  bfdebug << " - " << ept_violation_ve::name << bfendl;
1281  bfdebug << " - " << enable_xsaves_xrstors::name << bfendl;
1282 
1283  bfdebug << bfendl;
1284  bfdebug << "msrs::ia32_vmx_procbased_ctls2 allowed0 fields:" << bfendl;
1285 
1287  bfdebug << " - " << virtualize_apic_accesses::name << bfendl;
1289  bfdebug << " - " << enable_ept::name << bfendl;
1291  bfdebug << " - " << descriptor_table_exiting::name << bfendl;
1293  bfdebug << " - " << enable_rdtscp::name << bfendl;
1295  bfdebug << " - " << virtualize_x2apic_mode::name << bfendl;
1297  bfdebug << " - " << enable_vpid::name << bfendl;
1299  bfdebug << " - " << wbinvd_exiting::name << bfendl;
1301  bfdebug << " - " << unrestricted_guest::name << bfendl;
1303  bfdebug << " - " << apic_register_virtualization::name << bfendl;
1305  bfdebug << " - " << virtual_interrupt_delivery::name << bfendl;
1307  bfdebug << " - " << pause_loop_exiting::name << bfendl;
1309  bfdebug << " - " << rdrand_exiting::name << bfendl;
1311  bfdebug << " - " << enable_invpcid::name << bfendl;
1313  bfdebug << " - " << enable_vm_functions::name << bfendl;
1315  bfdebug << " - " << vmcs_shadowing::name << bfendl;
1317  bfdebug << " - " << rdseed_exiting::name << bfendl;
1319  bfdebug << " - " << enable_pml::name << bfendl;
1321  bfdebug << " - " << ept_violation_ve::name << bfendl;
1323  bfdebug << " - " << enable_xsaves_xrstors::name << bfendl;
1324 
1325  bfdebug << bfendl;
1326  bfdebug << "msrs::ia32_vmx_procbased_ctls2 allowed1 fields:" << bfendl;
1327 
1329  bfdebug << " - " << virtualize_apic_accesses::name << bfendl;
1331  bfdebug << " - " << enable_ept::name << bfendl;
1333  bfdebug << " - " << descriptor_table_exiting::name << bfendl;
1335  bfdebug << " - " << enable_rdtscp::name << bfendl;
1337  bfdebug << " - " << virtualize_x2apic_mode::name << bfendl;
1339  bfdebug << " - " << enable_vpid::name << bfendl;
1341  bfdebug << " - " << wbinvd_exiting::name << bfendl;
1343  bfdebug << " - " << unrestricted_guest::name << bfendl;
1345  bfdebug << " - " << apic_register_virtualization::name << bfendl;
1347  bfdebug << " - " << virtual_interrupt_delivery::name << bfendl;
1349  bfdebug << " - " << pause_loop_exiting::name << bfendl;
1351  bfdebug << " - " << rdrand_exiting::name << bfendl;
1353  bfdebug << " - " << enable_invpcid::name << bfendl;
1355  bfdebug << " - " << enable_vm_functions::name << bfendl;
1357  bfdebug << " - " << vmcs_shadowing::name << bfendl;
1359  bfdebug << " - " << rdseed_exiting::name << bfendl;
1361  bfdebug << " - " << enable_pml::name << bfendl;
1363  bfdebug << " - " << ept_violation_ve::name << bfendl;
1365  bfdebug << " - " << enable_xsaves_xrstors::name << bfendl;
1366  }
1367  }
1368 
1369  namespace ia32_vmx_ept_vpid_cap
1370  {
1371  constexpr const auto addr = 0x0000048CU;
1372  constexpr const auto name = "ia32_vmx_ept_vpid_cap";
1373 
1374  inline auto get() noexcept
1375  { return __read_msr(addr); }
1376 
1377  namespace execute_only_translation
1378  {
1379  constexpr const auto mask = 0x0000000000000001UL;
1380  constexpr const auto from = 0;
1381  constexpr const auto name = "execute_only_translation";
1382 
1383  inline auto get() noexcept
1384  { return get_bit(__read_msr(addr), from) != 0; }
1385  }
1386 
1387  namespace page_walk_length_of_4
1388  {
1389  constexpr const auto mask = 0x0000000000000040UL;
1390  constexpr const auto from = 6;
1391  constexpr const auto name = "page_walk_length_of_4";
1392 
1393  inline auto get() noexcept
1394  { return get_bit(__read_msr(addr), from) != 0; }
1395  }
1396 
1397  namespace memory_type_uncacheable_supported
1398  {
1399  constexpr const auto mask = 0x0000000000000100UL;
1400  constexpr const auto from = 8;
1401  constexpr const auto name = "memory_type_uncacheable_supported";
1402 
1403  inline auto get() noexcept
1404  { return get_bit(__read_msr(addr), from) != 0; }
1405  }
1406 
1407  namespace memory_type_write_back_supported
1408  {
1409  constexpr const auto mask = 0x0000000000004000UL;
1410  constexpr const auto from = 14;
1411  constexpr const auto name = "memory_type_write_back_supported";
1412 
1413  inline auto get() noexcept
1414  { return get_bit(__read_msr(addr), from) != 0; }
1415  }
1416 
1417  namespace pde_2mb_support
1418  {
1419  constexpr const auto mask = 0x0000000000010000UL;
1420  constexpr const auto from = 16;
1421  constexpr const auto name = "pde_2mb_support";
1422 
1423  inline auto get() noexcept
1424  { return get_bit(__read_msr(addr), from) != 0; }
1425  }
1426 
1427  namespace pdpte_1gb_support
1428  {
1429  constexpr const auto mask = 0x0000000000020000UL;
1430  constexpr const auto from = 17;
1431  constexpr const auto name = "pdpte_1gb_support";
1432 
1433  inline auto get() noexcept
1434  { return get_bit(__read_msr(addr), from) != 0; }
1435  }
1436 
1437  namespace invept_support
1438  {
1439  constexpr const auto mask = 0x0000000000100000UL;
1440  constexpr const auto from = 20;
1441  constexpr const auto name = "invept_support";
1442 
1443  inline auto get() noexcept
1444  { return get_bit(__read_msr(addr), from) != 0; }
1445  }
1446 
1447  namespace accessed_dirty_support
1448  {
1449  constexpr const auto mask = 0x0000000000200000UL;
1450  constexpr const auto from = 21;
1451  constexpr const auto name = "accessed_dirty_support";
1452 
1453  inline auto get() noexcept
1454  { return get_bit(__read_msr(addr), from) != 0; }
1455  }
1456 
1457  namespace invept_single_context_support
1458  {
1459  constexpr const auto mask = 0x0000000002000000UL;
1460  constexpr const auto from = 25;
1461  constexpr const auto name = "invept_single_context_support";
1462 
1463  inline auto get() noexcept
1464  { return get_bit(__read_msr(addr), from) != 0; }
1465  }
1466 
1467  namespace invept_all_context_support
1468  {
1469  constexpr const auto mask = 0x0000000004000000UL;
1470  constexpr const auto from = 26;
1471  constexpr const auto name = "invept_all_context_support";
1472 
1473  inline auto get() noexcept
1474  { return get_bit(__read_msr(addr), from) != 0; }
1475  }
1476 
1477  namespace invvpid_support
1478  {
1479  constexpr const auto mask = 0x0000000100000000UL;
1480  constexpr const auto from = 32;
1481  constexpr const auto name = "invvpid_support";
1482 
1483  inline auto get() noexcept
1484  { return get_bit(__read_msr(addr), from) != 0; }
1485  }
1486 
1487  namespace invvpid_individual_address_support
1488  {
1489  constexpr const auto mask = 0x0000010000000000UL;
1490  constexpr const auto from = 40;
1491  constexpr const auto name = "invvpid_individual_address_support";
1492 
1493  inline auto get() noexcept
1494  { return get_bit(__read_msr(addr), from) != 0; }
1495  }
1496 
1497  namespace invvpid_single_context_support
1498  {
1499  constexpr const auto mask = 0x0000020000000000UL;
1500  constexpr const auto from = 41;
1501  constexpr const auto name = "invvpid_single_context_support";
1502 
1503  inline auto get() noexcept
1504  { return get_bit(__read_msr(addr), from) != 0; }
1505  }
1506 
1507  namespace invvpid_all_context_support
1508  {
1509  constexpr const auto mask = 0x0000040000000000UL;
1510  constexpr const auto from = 42;
1511  constexpr const auto name = "invvpid_all_context_support";
1512 
1513  inline auto get() noexcept
1514  { return get_bit(__read_msr(addr), from) != 0; }
1515  }
1516 
1517  namespace invvpid_single_context_retaining_globals_support
1518  {
1519  constexpr const auto mask = 0x0000080000000000UL;
1520  constexpr const auto from = 43;
1521  constexpr const auto name = "invvpid_single_context_retaining_globals_support";
1522 
1523  inline auto get() noexcept
1524  { return get_bit(__read_msr(addr), from) != 0; }
1525  }
1526 
1527  inline void dump() noexcept
1528  {
1529  bfdebug << "msrs::ia32_vmx_ept_vpid_cap enabled flags:" << bfendl;
1530 
1532  bfdebug << " - " << execute_only_translation::name << bfendl;
1534  bfdebug << " - " << page_walk_length_of_4::name << bfendl;
1536  bfdebug << " - " << memory_type_uncacheable_supported::name << bfendl;
1538  bfdebug << " - " << memory_type_write_back_supported::name << bfendl;
1539  if (pde_2mb_support::get())
1540  bfdebug << " - " << pde_2mb_support::name << bfendl;
1541  if (pdpte_1gb_support::get())
1542  bfdebug << " - " << pdpte_1gb_support::name << bfendl;
1543  if (invept_support::get())
1544  bfdebug << " - " << invept_support::name << bfendl;
1546  bfdebug << " - " << accessed_dirty_support::name << bfendl;
1548  bfdebug << " - " << invept_single_context_support::name << bfendl;
1550  bfdebug << " - " << invept_all_context_support::name << bfendl;
1551  if (invvpid_support::get())
1552  bfdebug << " - " << invvpid_support::name << bfendl;
1554  bfdebug << " - " << invvpid_individual_address_support::name << bfendl;
1556  bfdebug << " - " << invvpid_single_context_support::name << bfendl;
1558  bfdebug << " - " << invvpid_all_context_support::name << bfendl;
1560  bfdebug << " - " << invvpid_single_context_retaining_globals_support::name << bfendl;
1561  }
1562  }
1563 
1564  namespace ia32_vmx_true_pinbased_ctls
1565  {
1566  constexpr const auto addr = 0x0000048DU;
1567  constexpr const auto name = "ia32_vmx_true_pinbased_ctls";
1568 
1569  inline auto get() noexcept
1570  { return __read_msr(addr); }
1571 
1572  inline auto allowed0()
1573  { return (__read_msr(addr) & 0x00000000FFFFFFFFUL); }
1574 
1575  inline auto allowed1()
1576  { return ((__read_msr(addr) & 0xFFFFFFFF00000000UL) >> 32); }
1577 
1578  namespace external_interrupt_exiting
1579  {
1580  constexpr const auto mask = 0x0000000000000001UL;
1581  constexpr const auto from = 0;
1582  constexpr const auto name = "external_interrupt_exiting";
1583 
1584  inline auto get() noexcept
1585  { return get_bit(__read_msr(addr), from) != 0; }
1586 
1587  inline auto is_allowed0() noexcept
1588  { return (__read_msr(addr) & mask) == 0; }
1589 
1590  inline auto is_allowed1() noexcept
1591  { return (__read_msr(addr) & (mask << 32)) != 0; }
1592  }
1593 
1594  namespace nmi_exiting
1595  {
1596  constexpr const auto mask = 0x0000000000000008UL;
1597  constexpr const auto from = 3;
1598  constexpr const auto name = "nmi_exiting";
1599 
1600  inline auto get() noexcept
1601  { return get_bit(__read_msr(addr), from) != 0; }
1602 
1603  inline auto is_allowed0() noexcept
1604  { return (__read_msr(addr) & mask) == 0; }
1605 
1606  inline auto is_allowed1() noexcept
1607  { return (__read_msr(addr) & (mask << 32)) != 0; }
1608  }
1609 
1610  namespace virtual_nmis
1611  {
1612  constexpr const auto mask = 0x0000000000000020UL;
1613  constexpr const auto from = 5;
1614  constexpr const auto name = "virtual_nmis";
1615 
1616  inline auto get() noexcept
1617  { return get_bit(__read_msr(addr), from) != 0; }
1618 
1619  inline auto is_allowed0() noexcept
1620  { return (__read_msr(addr) & mask) == 0; }
1621 
1622  inline auto is_allowed1() noexcept
1623  { return (__read_msr(addr) & (mask << 32)) != 0; }
1624  }
1625 
1626  namespace activate_vmx_preemption_timer
1627  {
1628  constexpr const auto mask = 0x0000000000000040UL;
1629  constexpr const auto from = 6;
1630  constexpr const auto name = "activate_vmx_preemption_timer";
1631 
1632  inline auto get() noexcept
1633  { return get_bit(__read_msr(addr), from) != 0; }
1634 
1635  inline auto is_allowed0() noexcept
1636  { return (__read_msr(addr) & mask) == 0; }
1637 
1638  inline auto is_allowed1() noexcept
1639  { return (__read_msr(addr) & (mask << 32)) != 0; }
1640  }
1641 
1642  namespace process_posted_interrupts
1643  {
1644  constexpr const auto mask = 0x0000000000000080UL;
1645  constexpr const auto from = 7;
1646  constexpr const auto name = "process_posted_interrupts";
1647 
1648  inline auto get() noexcept
1649  { return get_bit(__read_msr(addr), from) != 0; }
1650 
1651  inline auto is_allowed0() noexcept
1652  { return (__read_msr(addr) & mask) == 0; }
1653 
1654  inline auto is_allowed1() noexcept
1655  { return (__read_msr(addr) & (mask << 32)) != 0; }
1656  }
1657 
1658  inline void dump() noexcept
1659  {
1660  bfdebug << "msrs::ia32_vmx_true_pinbased_ctls enabled flags:" << bfendl;
1661 
1663  bfdebug << " - " << external_interrupt_exiting::name << bfendl;
1664  if (nmi_exiting::get())
1665  bfdebug << " - " << nmi_exiting::name << bfendl;
1666  if (virtual_nmis::get())
1667  bfdebug << " - " << virtual_nmis::name << bfendl;
1669  bfdebug << " - " << activate_vmx_preemption_timer::name << bfendl;
1671  bfdebug << " - " << process_posted_interrupts::name << bfendl;
1672 
1673  bfdebug << bfendl;
1674  bfdebug << "msrs::ia32_vmx_true_pinbased_ctls allowed0 fields:" << bfendl;
1675 
1677  bfdebug << " - " << external_interrupt_exiting::name << bfendl;
1679  bfdebug << " - " << nmi_exiting::name << bfendl;
1681  bfdebug << " - " << virtual_nmis::name << bfendl;
1683  bfdebug << " - " << activate_vmx_preemption_timer::name << bfendl;
1685  bfdebug << " - " << process_posted_interrupts::name << bfendl;
1686 
1687  bfdebug << bfendl;
1688  bfdebug << "msrs::ia32_vmx_true_pinbased_ctls allowed1 fields:" << bfendl;
1689 
1691  bfdebug << " - " << external_interrupt_exiting::name << bfendl;
1693  bfdebug << " - " << nmi_exiting::name << bfendl;
1695  bfdebug << " - " << virtual_nmis::name << bfendl;
1697  bfdebug << " - " << activate_vmx_preemption_timer::name << bfendl;
1699  bfdebug << " - " << process_posted_interrupts::name << bfendl;
1700  }
1701  }
1702 
1703  namespace ia32_vmx_true_procbased_ctls
1704  {
1705  constexpr const auto addr = 0x0000048EU;
1706  constexpr const auto name = "ia32_vmx_true_procbased_ctls";
1707 
1708  inline auto get() noexcept
1709  { return __read_msr(addr); }
1710 
1711  inline auto allowed0()
1712  { return (__read_msr(addr) & 0x00000000FFFFFFFFUL); }
1713 
1714  inline auto allowed1()
1715  { return ((__read_msr(addr) & 0xFFFFFFFF00000000UL) >> 32); }
1716 
1717  namespace interrupt_window_exiting
1718  {
1719  constexpr const auto mask = 0x0000000000000004UL;
1720  constexpr const auto from = 2;
1721  constexpr const auto name = "interrupt_window_exiting";
1722 
1723  inline auto get() noexcept
1724  { return get_bit(__read_msr(addr), from) != 0; }
1725 
1726  inline auto is_allowed0() noexcept
1727  { return (__read_msr(addr) & mask) == 0; }
1728 
1729  inline auto is_allowed1() noexcept
1730  { return (__read_msr(addr) & (mask << 32)) != 0; }
1731  }
1732 
1733  namespace use_tsc_offsetting
1734  {
1735  constexpr const auto mask = 0x0000000000000008UL;
1736  constexpr const auto from = 3;
1737  constexpr const auto name = "use_tsc_offsetting";
1738 
1739  inline auto get() noexcept
1740  { return get_bit(__read_msr(addr), from) != 0; }
1741 
1742  inline auto is_allowed0() noexcept
1743  { return (__read_msr(addr) & mask) == 0; }
1744 
1745  inline auto is_allowed1() noexcept
1746  { return (__read_msr(addr) & (mask << 32)) != 0; }
1747  }
1748 
1749  namespace hlt_exiting
1750  {
1751  constexpr const auto mask = 0x0000000000000080UL;
1752  constexpr const auto from = 7;
1753  constexpr const auto name = "hlt_exiting";
1754 
1755  inline auto get() noexcept
1756  { return get_bit(__read_msr(addr), from) != 0; }
1757 
1758  inline auto is_allowed0() noexcept
1759  { return (__read_msr(addr) & mask) == 0; }
1760 
1761  inline auto is_allowed1() noexcept
1762  { return (__read_msr(addr) & (mask << 32)) != 0; }
1763  }
1764 
1765  namespace invlpg_exiting
1766  {
1767  constexpr const auto mask = 0x0000000000000200UL;
1768  constexpr const auto from = 9;
1769  constexpr const auto name = "invlpg_exiting";
1770 
1771  inline auto get() noexcept
1772  { return get_bit(__read_msr(addr), from) != 0; }
1773 
1774  inline auto is_allowed0() noexcept
1775  { return (__read_msr(addr) & mask) == 0; }
1776 
1777  inline auto is_allowed1() noexcept
1778  { return (__read_msr(addr) & (mask << 32)) != 0; }
1779  }
1780 
1781  namespace mwait_exiting
1782  {
1783  constexpr const auto mask = 0x0000000000000400UL;
1784  constexpr const auto from = 10;
1785  constexpr const auto name = "mwait_exiting";
1786 
1787  inline auto get() noexcept
1788  { return get_bit(__read_msr(addr), from) != 0; }
1789 
1790  inline auto is_allowed0() noexcept
1791  { return (__read_msr(addr) & mask) == 0; }
1792 
1793  inline auto is_allowed1() noexcept
1794  { return (__read_msr(addr) & (mask << 32)) != 0; }
1795  }
1796 
1797  namespace rdpmc_exiting
1798  {
1799  constexpr const auto mask = 0x0000000000000800UL;
1800  constexpr const auto from = 11;
1801  constexpr const auto name = "rdpmc_exiting";
1802 
1803  inline auto get() noexcept
1804  { return get_bit(__read_msr(addr), from) != 0; }
1805 
1806  inline auto is_allowed0() noexcept
1807  { return (__read_msr(addr) & mask) == 0; }
1808 
1809  inline auto is_allowed1() noexcept
1810  { return (__read_msr(addr) & (mask << 32)) != 0; }
1811  }
1812 
1813  namespace rdtsc_exiting
1814  {
1815  constexpr const auto mask = 0x0000000000001000UL;
1816  constexpr const auto from = 12;
1817  constexpr const auto name = "rdtsc_exiting";
1818 
1819  inline auto get() noexcept
1820  { return get_bit(__read_msr(addr), from) != 0; }
1821 
1822  inline auto is_allowed0() noexcept
1823  { return (__read_msr(addr) & mask) == 0; }
1824 
1825  inline auto is_allowed1() noexcept
1826  { return (__read_msr(addr) & (mask << 32)) != 0; }
1827  }
1828 
1829  namespace cr3_load_exiting
1830  {
1831  constexpr const auto mask = 0x0000000000008000UL;
1832  constexpr const auto from = 15;
1833  constexpr const auto name = "cr3_load_exiting";
1834 
1835  inline auto get() noexcept
1836  { return get_bit(__read_msr(addr), from) != 0; }
1837 
1838  inline auto is_allowed0() noexcept
1839  { return (__read_msr(addr) & mask) == 0; }
1840 
1841  inline auto is_allowed1() noexcept
1842  { return (__read_msr(addr) & (mask << 32)) != 0; }
1843  }
1844 
1845  namespace cr3_store_exiting
1846  {
1847  constexpr const auto mask = 0x0000000000010000UL;
1848  constexpr const auto from = 16;
1849  constexpr const auto name = "cr3_store_exiting";
1850 
1851  inline auto get() noexcept
1852  { return get_bit(__read_msr(addr), from) != 0; }
1853 
1854  inline auto is_allowed0() noexcept
1855  { return (__read_msr(addr) & mask) == 0; }
1856 
1857  inline auto is_allowed1() noexcept
1858  { return (__read_msr(addr) & (mask << 32)) != 0; }
1859  }
1860 
1861  namespace cr8_load_exiting
1862  {
1863  constexpr const auto mask = 0x0000000000080000UL;
1864  constexpr const auto from = 19;
1865  constexpr const auto name = "cr8_load_exiting";
1866 
1867  inline auto get() noexcept
1868  { return get_bit(__read_msr(addr), from) != 0; }
1869 
1870  inline auto is_allowed0() noexcept
1871  { return (__read_msr(addr) & mask) == 0; }
1872 
1873  inline auto is_allowed1() noexcept
1874  { return (__read_msr(addr) & (mask << 32)) != 0; }
1875  }
1876 
1877  namespace cr8_store_exiting
1878  {
1879  constexpr const auto mask = 0x0000000000100000UL;
1880  constexpr const auto from = 20;
1881  constexpr const auto name = "cr8_store_exiting";
1882 
1883  inline auto get() noexcept
1884  { return get_bit(__read_msr(addr), from) != 0; }
1885 
1886  inline auto is_allowed0() noexcept
1887  { return (__read_msr(addr) & mask) == 0; }
1888 
1889  inline auto is_allowed1() noexcept
1890  { return (__read_msr(addr) & (mask << 32)) != 0; }
1891  }
1892 
1893  namespace use_tpr_shadow
1894  {
1895  constexpr const auto mask = 0x0000000000200000UL;
1896  constexpr const auto from = 21;
1897  constexpr const auto name = "use_tpr_shadow";
1898 
1899  inline auto get() noexcept
1900  { return get_bit(__read_msr(addr), from) != 0; }
1901 
1902  inline auto is_allowed0() noexcept
1903  { return (__read_msr(addr) & mask) == 0; }
1904 
1905  inline auto is_allowed1() noexcept
1906  { return (__read_msr(addr) & (mask << 32)) != 0; }
1907  }
1908 
1909  namespace nmi_window_exiting
1910  {
1911  constexpr const auto mask = 0x0000000000400000UL;
1912  constexpr const auto from = 22;
1913  constexpr const auto name = "nmi_window_exiting";
1914 
1915  inline auto get() noexcept
1916  { return get_bit(__read_msr(addr), from) != 0; }
1917 
1918  inline auto is_allowed0() noexcept
1919  { return (__read_msr(addr) & mask) == 0; }
1920 
1921  inline auto is_allowed1() noexcept
1922  { return (__read_msr(addr) & (mask << 32)) != 0; }
1923  }
1924 
1925  namespace mov_dr_exiting
1926  {
1927  constexpr const auto mask = 0x0000000000800000UL;
1928  constexpr const auto from = 23;
1929  constexpr const auto name = "mov_dr_exiting";
1930 
1931  inline auto get() noexcept
1932  { return get_bit(__read_msr(addr), from) != 0; }
1933 
1934  inline auto is_allowed0() noexcept
1935  { return (__read_msr(addr) & mask) == 0; }
1936 
1937  inline auto is_allowed1() noexcept
1938  { return (__read_msr(addr) & (mask << 32)) != 0; }
1939  }
1940 
1941  namespace unconditional_io_exiting
1942  {
1943  constexpr const auto mask = 0x0000000001000000UL;
1944  constexpr const auto from = 24;
1945  constexpr const auto name = "unconditional_io_exiting";
1946 
1947  inline auto get() noexcept
1948  { return get_bit(__read_msr(addr), from) != 0; }
1949 
1950  inline auto is_allowed0() noexcept
1951  { return (__read_msr(addr) & mask) == 0; }
1952 
1953  inline auto is_allowed1() noexcept
1954  { return (__read_msr(addr) & (mask << 32)) != 0; }
1955  }
1956 
1957  namespace use_io_bitmaps
1958  {
1959  constexpr const auto mask = 0x0000000002000000UL;
1960  constexpr const auto from = 25;
1961  constexpr const auto name = "use_io_bitmaps";
1962 
1963  inline auto get() noexcept
1964  { return get_bit(__read_msr(addr), from) != 0; }
1965 
1966  inline auto is_allowed0() noexcept
1967  { return (__read_msr(addr) & mask) == 0; }
1968 
1969  inline auto is_allowed1() noexcept
1970  { return (__read_msr(addr) & (mask << 32)) != 0; }
1971  }
1972 
1974  {
1975  constexpr const auto mask = 0x0000000008000000UL;
1976  constexpr const auto from = 27;
1977  constexpr const auto name = "monitor_trap_flag";
1978 
1979  inline auto get() noexcept
1980  { return get_bit(__read_msr(addr), from) != 0; }
1981 
1982  inline auto is_allowed0() noexcept
1983  { return (__read_msr(addr) & mask) == 0; }
1984 
1985  inline auto is_allowed1() noexcept
1986  { return (__read_msr(addr) & (mask << 32)) != 0; }
1987  }
1988 
1989  namespace use_msr_bitmap
1990  {
1991  constexpr const auto mask = 0x0000000010000000UL;
1992  constexpr const auto from = 28;
1993  constexpr const auto name = "use_msr_bitmap";
1994 
1995  inline auto get() noexcept
1996  { return get_bit(__read_msr(addr), from) != 0; }
1997 
1998  inline auto is_allowed0() noexcept
1999  { return (__read_msr(addr) & mask) == 0; }
2000 
2001  inline auto is_allowed1() noexcept
2002  { return (__read_msr(addr) & (mask << 32)) != 0; }
2003  }
2004 
2005  namespace monitor_exiting
2006  {
2007  constexpr const auto mask = 0x0000000020000000UL;
2008  constexpr const auto from = 29;
2009  constexpr const auto name = "monitor_exiting";
2010 
2011  inline auto get() noexcept
2012  { return get_bit(__read_msr(addr), from) != 0; }
2013 
2014  inline auto is_allowed0() noexcept
2015  { return (__read_msr(addr) & mask) == 0; }
2016 
2017  inline auto is_allowed1() noexcept
2018  { return (__read_msr(addr) & (mask << 32)) != 0; }
2019  }
2020 
2021  namespace pause_exiting
2022  {
2023  constexpr const auto mask = 0x0000000040000000UL;
2024  constexpr const auto from = 30;
2025  constexpr const auto name = "pause_exiting";
2026 
2027  inline auto get() noexcept
2028  { return get_bit(__read_msr(addr), from) != 0; }
2029 
2030  inline auto is_allowed0() noexcept
2031  { return (__read_msr(addr) & mask) == 0; }
2032 
2033  inline auto is_allowed1() noexcept
2034  { return (__read_msr(addr) & (mask << 32)) != 0; }
2035  }
2036 
2037  namespace activate_secondary_controls
2038  {
2039  constexpr const auto mask = 0x0000000080000000UL;
2040  constexpr const auto from = 31;
2041  constexpr const auto name = "activate_secondary_controls";
2042 
2043  inline auto get() noexcept
2044  { return get_bit(__read_msr(addr), from) != 0; }
2045 
2046  inline auto is_allowed0() noexcept
2047  { return (__read_msr(addr) & mask) == 0; }
2048 
2049  inline auto is_allowed1() noexcept
2050  { return (__read_msr(addr) & (mask << 32)) != 0; }
2051  }
2052 
2053  inline void dump() noexcept
2054  {
2055  bfdebug << "msrs::ia32_vmx_true_procbased_ctls enabled flags:" << bfendl;
2056 
2058  bfdebug << " - " << interrupt_window_exiting::name << bfendl;
2060  bfdebug << " - " << use_tsc_offsetting::name << bfendl;
2061  if (hlt_exiting::get())
2062  bfdebug << " - " << hlt_exiting::name << bfendl;
2063  if (invlpg_exiting::get())
2064  bfdebug << " - " << invlpg_exiting::name << bfendl;
2065  if (mwait_exiting::get())
2066  bfdebug << " - " << mwait_exiting::name << bfendl;
2067  if (rdpmc_exiting::get())
2068  bfdebug << " - " << rdpmc_exiting::name << bfendl;
2069  if (rdtsc_exiting::get())
2070  bfdebug << " - " << rdtsc_exiting::name << bfendl;
2071  if (cr3_load_exiting::get())
2072  bfdebug << " - " << cr3_load_exiting::name << bfendl;
2073  if (cr3_store_exiting::get())
2074  bfdebug << " - " << cr3_store_exiting::name << bfendl;
2075  if (cr8_load_exiting::get())
2076  bfdebug << " - " << cr8_load_exiting::name << bfendl;
2077  if (cr8_store_exiting::get())
2078  bfdebug << " - " << cr8_store_exiting::name << bfendl;
2079  if (use_tpr_shadow::get())
2080  bfdebug << " - " << use_tpr_shadow::name << bfendl;
2082  bfdebug << " - " << nmi_window_exiting::name << bfendl;
2083  if (mov_dr_exiting::get())
2084  bfdebug << " - " << mov_dr_exiting::name << bfendl;
2086  bfdebug << " - " << unconditional_io_exiting::name << bfendl;
2087  if (use_io_bitmaps::get())
2088  bfdebug << " - " << use_io_bitmaps::name << bfendl;
2089  if (monitor_trap_flag::get())
2090  bfdebug << " - " << monitor_trap_flag::name << bfendl;
2091  if (use_msr_bitmap::get())
2092  bfdebug << " - " << use_msr_bitmap::name << bfendl;
2093  if (monitor_exiting::get())
2094  bfdebug << " - " << monitor_exiting::name << bfendl;
2095  if (pause_exiting::get())
2096  bfdebug << " - " << pause_exiting::name << bfendl;
2098  bfdebug << " - " << activate_secondary_controls::name << bfendl;
2099 
2100  bfdebug << bfendl;
2101  bfdebug << "msrs::ia32_vmx_true_pinbased_ctls allowed0 fields:" << bfendl;
2102 
2104  bfdebug << " - " << interrupt_window_exiting::name << bfendl;
2106  bfdebug << " - " << use_tsc_offsetting::name << bfendl;
2108  bfdebug << " - " << hlt_exiting::name << bfendl;
2110  bfdebug << " - " << invlpg_exiting::name << bfendl;
2112  bfdebug << " - " << mwait_exiting::name << bfendl;
2114  bfdebug << " - " << rdpmc_exiting::name << bfendl;
2116  bfdebug << " - " << rdtsc_exiting::name << bfendl;
2118  bfdebug << " - " << cr3_load_exiting::name << bfendl;
2120  bfdebug << " - " << cr3_store_exiting::name << bfendl;
2122  bfdebug << " - " << cr8_load_exiting::name << bfendl;
2124  bfdebug << " - " << cr8_store_exiting::name << bfendl;
2126  bfdebug << " - " << use_tpr_shadow::name << bfendl;
2128  bfdebug << " - " << nmi_window_exiting::name << bfendl;
2130  bfdebug << " - " << mov_dr_exiting::name << bfendl;
2132  bfdebug << " - " << unconditional_io_exiting::name << bfendl;
2134  bfdebug << " - " << use_io_bitmaps::name << bfendl;
2136  bfdebug << " - " << monitor_trap_flag::name << bfendl;
2138  bfdebug << " - " << use_msr_bitmap::name << bfendl;
2140  bfdebug << " - " << monitor_exiting::name << bfendl;
2142  bfdebug << " - " << pause_exiting::name << bfendl;
2144  bfdebug << " - " << activate_secondary_controls::name << bfendl;
2145 
2146  bfdebug << bfendl;
2147  bfdebug << "msrs::ia32_vmx_true_pinbased_ctls allowed1 fields:" << bfendl;
2148 
2150  bfdebug << " - " << interrupt_window_exiting::name << bfendl;
2152  bfdebug << " - " << use_tsc_offsetting::name << bfendl;
2154  bfdebug << " - " << hlt_exiting::name << bfendl;
2156  bfdebug << " - " << invlpg_exiting::name << bfendl;
2158  bfdebug << " - " << mwait_exiting::name << bfendl;
2160  bfdebug << " - " << rdpmc_exiting::name << bfendl;
2162  bfdebug << " - " << rdtsc_exiting::name << bfendl;
2164  bfdebug << " - " << cr3_load_exiting::name << bfendl;
2166  bfdebug << " - " << cr3_store_exiting::name << bfendl;
2168  bfdebug << " - " << cr8_load_exiting::name << bfendl;
2170  bfdebug << " - " << cr8_store_exiting::name << bfendl;
2172  bfdebug << " - " << use_tpr_shadow::name << bfendl;
2174  bfdebug << " - " << nmi_window_exiting::name << bfendl;
2176  bfdebug << " - " << mov_dr_exiting::name << bfendl;
2178  bfdebug << " - " << unconditional_io_exiting::name << bfendl;
2180  bfdebug << " - " << use_io_bitmaps::name << bfendl;
2182  bfdebug << " - " << monitor_trap_flag::name << bfendl;
2184  bfdebug << " - " << use_msr_bitmap::name << bfendl;
2186  bfdebug << " - " << monitor_exiting::name << bfendl;
2188  bfdebug << " - " << pause_exiting::name << bfendl;
2190  bfdebug << " - " << activate_secondary_controls::name << bfendl;
2191  }
2192  }
2193 
2194  namespace ia32_vmx_true_exit_ctls
2195  {
2196  constexpr const auto addr = 0x0000048FU;
2197  constexpr const auto name = "ia32_vmx_true_exit_ctls";
2198 
2199  inline auto get() noexcept
2200  { return __read_msr(addr); }
2201 
2202  inline auto allowed0()
2203  { return (__read_msr(addr) & 0x00000000FFFFFFFFUL); }
2204 
2205  inline auto allowed1()
2206  { return ((__read_msr(addr) & 0xFFFFFFFF00000000UL) >> 32); }
2207 
2208  namespace save_debug_controls
2209  {
2210  constexpr const auto mask = 0x0000000000000004UL;
2211  constexpr const auto from = 2;
2212  constexpr const auto name = "save_debug_controls";
2213 
2214  inline auto get() noexcept
2215  { return get_bit(__read_msr(addr), from) != 0; }
2216 
2217  inline auto is_allowed0() noexcept
2218  { return (__read_msr(addr) & mask) == 0; }
2219 
2220  inline auto is_allowed1() noexcept
2221  { return (__read_msr(addr) & (mask << 32)) != 0; }
2222  }
2223 
2224  namespace host_address_space_size
2225  {
2226  constexpr const auto mask = 0x0000000000000200UL;
2227  constexpr const auto from = 9;
2228  constexpr const auto name = "host_address_space_size";
2229 
2230  inline auto get() noexcept
2231  { return get_bit(__read_msr(addr), from) != 0; }
2232 
2233  inline auto is_allowed0() noexcept
2234  { return (__read_msr(addr) & mask) == 0; }
2235 
2236  inline auto is_allowed1() noexcept
2237  { return (__read_msr(addr) & (mask << 32)) != 0; }
2238  }
2239 
2240  namespace load_ia32_perf_global_ctrl
2241  {
2242  constexpr const auto mask = 0x0000000000001000UL;
2243  constexpr const auto from = 12;
2244  constexpr const auto name = "load_ia32_perf_global_ctrl";
2245 
2246  inline auto get() noexcept
2247  { return get_bit(__read_msr(addr), from) != 0; }
2248 
2249  inline auto is_allowed0() noexcept
2250  { return (__read_msr(addr) & mask) == 0; }
2251 
2252  inline auto is_allowed1() noexcept
2253  { return (__read_msr(addr) & (mask << 32)) != 0; }
2254  }
2255 
2256  namespace acknowledge_interrupt_on_exit
2257  {
2258  constexpr const auto mask = 0x0000000000008000UL;
2259  constexpr const auto from = 15;
2260  constexpr const auto name = "acknowledge_interrupt_on_exit";
2261 
2262  inline auto get() noexcept
2263  { return get_bit(__read_msr(addr), from) != 0; }
2264 
2265  inline auto is_allowed0() noexcept
2266  { return (__read_msr(addr) & mask) == 0; }
2267 
2268  inline auto is_allowed1() noexcept
2269  { return (__read_msr(addr) & (mask << 32)) != 0; }
2270  }
2271 
2272  namespace save_ia32_pat
2273  {
2274  constexpr const auto mask = 0x0000000000040000UL;
2275  constexpr const auto from = 18;
2276  constexpr const auto name = "save_ia32_pat";
2277 
2278  inline auto get() noexcept
2279  { return get_bit(__read_msr(addr), from) != 0; }
2280 
2281  inline auto is_allowed0() noexcept
2282  { return (__read_msr(addr) & mask) == 0; }
2283 
2284  inline auto is_allowed1() noexcept
2285  { return (__read_msr(addr) & (mask << 32)) != 0; }
2286  }
2287 
2288  namespace load_ia32_pat
2289  {
2290  constexpr const auto mask = 0x0000000000080000UL;
2291  constexpr const auto from = 19;
2292  constexpr const auto name = "load_ia32_pat";
2293 
2294  inline auto get() noexcept
2295  { return get_bit(__read_msr(addr), from) != 0; }
2296 
2297  inline auto is_allowed0() noexcept
2298  { return (__read_msr(addr) & mask) == 0; }
2299 
2300  inline auto is_allowed1() noexcept
2301  { return (__read_msr(addr) & (mask << 32)) != 0; }
2302  }
2303 
2304  namespace save_ia32_efer
2305  {
2306  constexpr const auto mask = 0x0000000000100000UL;
2307  constexpr const auto from = 20;
2308  constexpr const auto name = "save_ia32_efer";
2309 
2310  inline auto get() noexcept
2311  { return get_bit(__read_msr(addr), from) != 0; }
2312 
2313  inline auto is_allowed0() noexcept
2314  { return (__read_msr(addr) & mask) == 0; }
2315 
2316  inline auto is_allowed1() noexcept
2317  { return (__read_msr(addr) & (mask << 32)) != 0; }
2318  }
2319 
2320  namespace load_ia32_efer
2321  {
2322  constexpr const auto mask = 0x0000000000200000UL;
2323  constexpr const auto from = 21;
2324  constexpr const auto name = "load_ia32_efer";
2325 
2326  inline auto get() noexcept
2327  { return get_bit(__read_msr(addr), from) != 0; }
2328 
2329  inline auto is_allowed0() noexcept
2330  { return (__read_msr(addr) & mask) == 0; }
2331 
2332  inline auto is_allowed1() noexcept
2333  { return (__read_msr(addr) & (mask << 32)) != 0; }
2334  }
2335 
2336  namespace save_vmx_preemption_timer_value
2337  {
2338  constexpr const auto mask = 0x0000000000400000UL;
2339  constexpr const auto from = 22;
2340  constexpr const auto name = "save_vmx_preemption_timer_value";
2341 
2342  inline auto get() noexcept
2343  { return get_bit(__read_msr(addr), from) != 0; }
2344 
2345  inline auto is_allowed0() noexcept
2346  { return (__read_msr(addr) & mask) == 0; }
2347 
2348  inline auto is_allowed1() noexcept
2349  { return (__read_msr(addr) & (mask << 32)) != 0; }
2350  }
2351 
2352  namespace clear_ia32_bndcfgs
2353  {
2354  constexpr const auto mask = 0x0000000000800000UL;
2355  constexpr const auto from = 23;
2356  constexpr const auto name = "clear_ia32_bndcfgs";
2357 
2358  inline auto get() noexcept
2359  { return get_bit(__read_msr(addr), from) != 0; }
2360 
2361  inline auto is_allowed0() noexcept
2362  { return (__read_msr(addr) & mask) == 0; }
2363 
2364  inline auto is_allowed1() noexcept
2365  { return (__read_msr(addr) & (mask << 32)) != 0; }
2366  }
2367 
2368  inline void dump() noexcept
2369  {
2370  bfdebug << "msrs::ia32_vmx_true_exit_ctls enabled flags:" << bfendl;
2371 
2373  bfdebug << " - " << save_debug_controls::name << bfendl;
2375  bfdebug << " - " << host_address_space_size::name << bfendl;
2377  bfdebug << " - " << load_ia32_perf_global_ctrl::name << bfendl;
2379  bfdebug << " - " << acknowledge_interrupt_on_exit::name << bfendl;
2380  if (save_ia32_pat::get())
2381  bfdebug << " - " << save_ia32_pat::name << bfendl;
2382  if (load_ia32_pat::get())
2383  bfdebug << " - " << load_ia32_pat::name << bfendl;
2384  if (save_ia32_efer::get())
2385  bfdebug << " - " << save_ia32_efer::name << bfendl;
2386  if (load_ia32_efer::get())
2387  bfdebug << " - " << load_ia32_efer::name << bfendl;
2389  bfdebug << " - " << save_vmx_preemption_timer_value::name << bfendl;
2391  bfdebug << " - " << clear_ia32_bndcfgs::name << bfendl;
2392 
2393  bfdebug << bfendl;
2394  bfdebug << "msrs::ia32_vmx_true_exit_ctls allowed0 fields:" << bfendl;
2395 
2397  bfdebug << " - " << save_debug_controls::name << bfendl;
2399  bfdebug << " - " << host_address_space_size::name << bfendl;
2401  bfdebug << " - " << load_ia32_perf_global_ctrl::name << bfendl;
2403  bfdebug << " - " << acknowledge_interrupt_on_exit::name << bfendl;
2405  bfdebug << " - " << save_ia32_pat::name << bfendl;
2407  bfdebug << " - " << load_ia32_pat::name << bfendl;
2409  bfdebug << " - " << save_ia32_efer::name << bfendl;
2411  bfdebug << " - " << load_ia32_efer::name << bfendl;
2413  bfdebug << " - " << save_vmx_preemption_timer_value::name << bfendl;
2415  bfdebug << " - " << clear_ia32_bndcfgs::name << bfendl;
2416 
2417  bfdebug << bfendl;
2418  bfdebug << "msrs::ia32_vmx_true_exit_ctls allowed1 fields:" << bfendl;
2419 
2421  bfdebug << " - " << save_debug_controls::name << bfendl;
2423  bfdebug << " - " << host_address_space_size::name << bfendl;
2425  bfdebug << " - " << load_ia32_perf_global_ctrl::name << bfendl;
2427  bfdebug << " - " << acknowledge_interrupt_on_exit::name << bfendl;
2429  bfdebug << " - " << save_ia32_pat::name << bfendl;
2431  bfdebug << " - " << load_ia32_pat::name << bfendl;
2433  bfdebug << " - " << save_ia32_efer::name << bfendl;
2435  bfdebug << " - " << load_ia32_efer::name << bfendl;
2437  bfdebug << " - " << save_vmx_preemption_timer_value::name << bfendl;
2439  bfdebug << " - " << clear_ia32_bndcfgs::name << bfendl;
2440  }
2441  }
2442 
2443  namespace ia32_vmx_true_entry_ctls
2444  {
2445  constexpr const auto addr = 0x00000490U;
2446  constexpr const auto name = "ia32_vmx_true_entry_ctls";
2447 
2448  inline auto get() noexcept
2449  { return __read_msr(addr); }
2450 
2451  inline auto allowed0()
2452  { return (__read_msr(addr) & 0x00000000FFFFFFFFUL); }
2453 
2454  inline auto allowed1()
2455  { return ((__read_msr(addr) & 0xFFFFFFFF00000000UL) >> 32); }
2456 
2457  namespace load_debug_controls
2458  {
2459  constexpr const auto mask = 0x0000000000000004UL;
2460  constexpr const auto from = 2;
2461  constexpr const auto name = "load_debug_controls";
2462 
2463  inline auto get() noexcept
2464  { return get_bit(__read_msr(addr), from) != 0; }
2465 
2466  inline auto is_allowed0() noexcept
2467  { return (__read_msr(addr) & mask) == 0; }
2468 
2469  inline auto is_allowed1() noexcept
2470  { return (__read_msr(addr) & (mask << 32)) != 0; }
2471  }
2472 
2473  namespace ia_32e_mode_guest
2474  {
2475  constexpr const auto mask = 0x0000000000000200UL;
2476  constexpr const auto from = 9;
2477  constexpr const auto name = "ia_32e_mode_guest";
2478 
2479  inline auto get() noexcept
2480  { return get_bit(__read_msr(addr), from) != 0; }
2481 
2482  inline auto is_allowed0() noexcept
2483  { return (__read_msr(addr) & mask) == 0; }
2484 
2485  inline auto is_allowed1() noexcept
2486  { return (__read_msr(addr) & (mask << 32)) != 0; }
2487  }
2488 
2489  namespace entry_to_smm
2490  {
2491  constexpr const auto mask = 0x0000000000000400UL;
2492  constexpr const auto from = 10;
2493  constexpr const auto name = "entry_to_smm";
2494 
2495  inline auto get() noexcept
2496  { return get_bit(__read_msr(addr), from) != 0; }
2497 
2498  inline auto is_allowed0() noexcept
2499  { return (__read_msr(addr) & mask) == 0; }
2500 
2501  inline auto is_allowed1() noexcept
2502  { return (__read_msr(addr) & (mask << 32)) != 0; }
2503  }
2504 
2505  namespace deactivate_dual_monitor_treatment
2506  {
2507  constexpr const auto mask = 0x0000000000000800UL;
2508  constexpr const auto from = 11;
2509  constexpr const auto name = "deactivate_dual_monitor_treatment";
2510 
2511  inline auto get() noexcept
2512  { return get_bit(__read_msr(addr), from) != 0; }
2513 
2514  inline auto is_allowed0() noexcept
2515  { return (__read_msr(addr) & mask) == 0; }
2516 
2517  inline auto is_allowed1() noexcept
2518  { return (__read_msr(addr) & (mask << 32)) != 0; }
2519  }
2520 
2521  namespace load_ia32_perf_global_ctrl
2522  {
2523  constexpr const auto mask = 0x0000000000002000UL;
2524  constexpr const auto from = 13;
2525  constexpr const auto name = "load_ia32_perf_global_ctrl";
2526 
2527  inline auto get() noexcept
2528  { return get_bit(__read_msr(addr), from) != 0; }
2529 
2530  inline auto is_allowed0() noexcept
2531  { return (__read_msr(addr) & mask) == 0; }
2532 
2533  inline auto is_allowed1() noexcept
2534  { return (__read_msr(addr) & (mask << 32)) != 0; }
2535  }
2536 
2537  namespace load_ia32_pat
2538  {
2539  constexpr const auto mask = 0x0000000000004000UL;
2540  constexpr const auto from = 14;
2541  constexpr const auto name = "load_ia32_pat";
2542 
2543  inline auto get() noexcept
2544  { return get_bit(__read_msr(addr), from) != 0; }
2545 
2546  inline auto is_allowed0() noexcept
2547  { return (__read_msr(addr) & mask) == 0; }
2548 
2549  inline auto is_allowed1() noexcept
2550  { return (__read_msr(addr) & (mask << 32)) != 0; }
2551  }
2552 
2553  namespace load_ia32_efer
2554  {
2555  constexpr const auto mask = 0x0000000000008000UL;
2556  constexpr const auto from = 15;
2557  constexpr const auto name = "load_ia32_efer";
2558 
2559  inline auto get() noexcept
2560  { return get_bit(__read_msr(addr), from) != 0; }
2561 
2562  inline auto is_allowed0() noexcept
2563  { return (__read_msr(addr) & mask) == 0; }
2564 
2565  inline auto is_allowed1() noexcept
2566  { return (__read_msr(addr) & (mask << 32)) != 0; }
2567  }
2568 
2569  namespace load_ia32_bndcfgs
2570  {
2571  constexpr const auto mask = 0x0000000000010000UL;
2572  constexpr const auto from = 16;
2573  constexpr const auto name = "load_ia32_bndcfgs";
2574 
2575  inline auto get() noexcept
2576  { return get_bit(__read_msr(addr), from) != 0; }
2577 
2578  inline auto is_allowed0() noexcept
2579  { return (__read_msr(addr) & mask) == 0; }
2580 
2581  inline auto is_allowed1() noexcept
2582  { return (__read_msr(addr) & (mask << 32)) != 0; }
2583  }
2584 
2585  inline void dump() noexcept
2586  {
2587  bfdebug << "msrs::ia32_vmx_true_entry_ctls enabled flags:" << bfendl;
2588 
2590  bfdebug << " - " << load_debug_controls::name << bfendl;
2591  if (ia_32e_mode_guest::get())
2592  bfdebug << " - " << ia_32e_mode_guest::name << bfendl;
2593  if (entry_to_smm::get())
2594  bfdebug << " - " << entry_to_smm::name << bfendl;
2596  bfdebug << " - " << deactivate_dual_monitor_treatment::name << bfendl;
2598  bfdebug << " - " << load_ia32_perf_global_ctrl::name << bfendl;
2599  if (load_ia32_pat::get())
2600  bfdebug << " - " << load_ia32_pat::name << bfendl;
2601  if (load_ia32_efer::get())
2602  bfdebug << " - " << load_ia32_efer::name << bfendl;
2603  if (load_ia32_bndcfgs::get())
2604  bfdebug << " - " << load_ia32_bndcfgs::name << bfendl;
2605 
2606  bfdebug << bfendl;
2607  bfdebug << "msrs::ia32_vmx_true_entry_ctls allowed0 fields:" << bfendl;
2608 
2610  bfdebug << " - " << load_debug_controls::name << bfendl;
2612  bfdebug << " - " << ia_32e_mode_guest::name << bfendl;
2614  bfdebug << " - " << entry_to_smm::name << bfendl;
2616  bfdebug << " - " << deactivate_dual_monitor_treatment::name << bfendl;
2618  bfdebug << " - " << load_ia32_perf_global_ctrl::name << bfendl;
2620  bfdebug << " - " << load_ia32_pat::name << bfendl;
2622  bfdebug << " - " << load_ia32_efer::name << bfendl;
2624  bfdebug << " - " << load_ia32_bndcfgs::name << bfendl;
2625 
2626  bfdebug << bfendl;
2627  bfdebug << "msrs::ia32_vmx_true_entry_ctls allowed1 fields:" << bfendl;
2628 
2630  bfdebug << " - " << load_debug_controls::name << bfendl;
2632  bfdebug << " - " << ia_32e_mode_guest::name << bfendl;
2634  bfdebug << " - " << entry_to_smm::name << bfendl;
2636  bfdebug << " - " << deactivate_dual_monitor_treatment::name << bfendl;
2638  bfdebug << " - " << load_ia32_perf_global_ctrl::name << bfendl;
2640  bfdebug << " - " << load_ia32_pat::name << bfendl;
2642  bfdebug << " - " << load_ia32_efer::name << bfendl;
2644  bfdebug << " - " << load_ia32_bndcfgs::name << bfendl;
2645  }
2646  }
2647 
2648  namespace ia32_vmx_vmfunc
2649  {
2650  constexpr const auto addr = 0x00000491U;
2651  constexpr const auto name = "ia32_vmx_vmfunc";
2652 
2653  inline auto get() noexcept
2654  { return __read_msr(addr); }
2655 
2656  namespace eptp_switching
2657  {
2658  constexpr const auto mask = 0x0000000000000001UL;
2659  constexpr const auto from = 0;
2660  constexpr const auto name = "eptp_switching";
2661 
2662  inline auto is_allowed1()
2663  { return is_bit_set(__read_msr(addr), from); }
2664  }
2665  }
2666 
2667  namespace ia32_efer
2668  {
2669  constexpr const auto addr = 0xC0000080U;
2670  constexpr const auto name = "ia32_efer";
2671 
2672  inline auto get() noexcept
2673  { return __read_msr(addr); }
2674 
2675  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2676  void set(T val) noexcept { __write_msr(addr, val); }
2677 
2678  namespace sce
2679  {
2680  constexpr const auto mask = 0x0000000000000001UL;
2681  constexpr const auto from = 0;
2682  constexpr const auto name = "sce";
2683 
2684  inline auto get() noexcept
2685  { return get_bit(__read_msr(addr), from) != 0; }
2686 
2687  inline void set(bool val) noexcept
2688  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
2689  }
2690 
2691  namespace lme
2692  {
2693  constexpr const auto mask = 0x0000000000000100UL;
2694  constexpr const auto from = 8;
2695  constexpr const auto name = "lme";
2696 
2697  inline auto get() noexcept
2698  { return get_bit(__read_msr(addr), from) != 0; }
2699 
2700  inline void set(bool val) noexcept
2701  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
2702  }
2703 
2704  namespace lma
2705  {
2706  constexpr const auto mask = 0x0000000000000400UL;
2707  constexpr const auto from = 10;
2708  constexpr const auto name = "lma";
2709 
2710  inline auto get() noexcept
2711  { return get_bit(__read_msr(addr), from) != 0; }
2712 
2713  inline void set(bool val) noexcept
2714  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
2715  }
2716 
2717  namespace nxe
2718  {
2719  constexpr const auto mask = 0x0000000000000800UL;
2720  constexpr const auto from = 11;
2721  constexpr const auto name = "lma";
2722 
2723  inline auto get() noexcept
2724  { return get_bit(__read_msr(addr), from) != 0; }
2725 
2726  inline void set(bool val) noexcept
2727  { __write_msr(addr, val ? set_bit(__read_msr(addr), from) : clear_bit(__read_msr(addr), from)); }
2728  }
2729 
2730  namespace reserved
2731  {
2732  constexpr const auto mask = 0xFFFFFFFFFFFFF2FEUL;
2733  constexpr const auto from = 0;
2734  constexpr const auto name = "reserved";
2735 
2736  inline auto get() noexcept
2737  { return get_bits(__read_msr(addr), mask) >> from; }
2738 
2739  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2740  void set(T val) noexcept { __write_msr(addr, set_bits(__read_msr(addr), mask, val << from)); }
2741  }
2742 
2743  inline void dump() noexcept
2744  {
2745  bfdebug << "msrs::ia32_efer enabled flags:" << bfendl;
2746 
2747  if (sce::get())
2748  bfdebug << " - " << sce::name << bfendl;
2749  if (lme::get())
2750  bfdebug << " - " << lme::name << bfendl;
2751  if (lma::get())
2752  bfdebug << " - " << lma::name << bfendl;
2753  if (nxe::get())
2754  bfdebug << " - " << nxe::name << bfendl;
2755  }
2756  }
2757 
2758  namespace ia32_fs_base
2759  {
2760  constexpr const auto addr = 0xC0000100U;
2761  constexpr const auto name = "ia32_fs_base";
2762 
2763  inline auto get() noexcept
2764  { return __read_msr(addr); }
2765 
2766  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2767  void set(T val) noexcept { __write_msr(addr, val); }
2768  }
2769 
2770  namespace ia32_gs_base
2771  {
2772  constexpr const auto addr = 0xC0000101U;
2773  constexpr const auto name = "ia32_gs_base";
2774 
2775  inline auto get() noexcept
2776  { return __read_msr(addr); }
2777 
2778  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2779  void set(T val) noexcept { __write_msr(addr, val); }
2780  }
2781 }
2782 }
2783 
2784 // *INDENT-ON*
2785 
2786 #endif
constexpr const auto mask
constexpr const auto name
constexpr const auto name
void dump() noexcept
auto is_allowed1() noexcept
constexpr const auto name
uint32_t field_type
constexpr const auto from
auto is_allowed1() noexcept
constexpr const auto from
constexpr const auto mask
constexpr const auto from
constexpr const auto name
void __write_msr(uint32_t addr, uint64_t val) noexcept
constexpr const auto name
auto is_allowed0() noexcept
constexpr const auto from
auto is_allowed1() noexcept
auto is_allowed1() noexcept
auto allowed0()
auto get_bit(T t, B b) noexcept
Definition: bitmanip.h:42
constexpr const auto mask
auto is_allowed0() noexcept
constexpr const auto mask
void uint64_t uint64_t uint64_t *rdx noexcept
auto is_allowed0() noexcept
auto is_allowed0() noexcept
constexpr const auto mask
constexpr const auto from
auto is_allowed0() noexcept
auto is_allowed1() noexcept
constexpr const auto mask
constexpr const auto mask
constexpr const auto name
auto clear_bit(T t, B b) noexcept
Definition: bitmanip.h:36
auto is_allowed0() noexcept
constexpr const auto reserved
Definition: vcpuid.h:33
const void * view_as_pointer(const T val)
auto set_bit(T t, B b) noexcept
Definition: bitmanip.h:30
auto get_bits(T t, M m) noexcept
Definition: bitmanip.h:65
auto get() noexcept
auto get() noexcept
constexpr const auto name
constexpr const auto mask
auto get() noexcept
uint64_t __read_msr(uint32_t addr) noexcept
auto is_allowed1() noexcept
auto is_allowed0() noexcept
constexpr const auto name
auto is_allowed0() noexcept
constexpr const auto from
constexpr const auto name
auto get() noexcept
constexpr const auto from
auto get() noexcept
auto is_bit_set(T t, B b) noexcept
Definition: bitmanip.h:48
constexpr const auto from
uint64_t value_type
auto allowed1()
auto is_allowed1() noexcept
constexpr const auto name
auto set_bits(T t, M m, V v) noexcept
Definition: bitmanip.h:72
auto get() noexcept
auto get() noexcept
auto get() noexcept
auto is_allowed1() noexcept