vmcs_intel_x64_natural_width_read_only_data_fields.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 // Author: Connor Davis <davisc@ainfosec.com>
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
13 //
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 
23 #ifndef VMCS_INTEL_X64_16BIT_NATURAL_WIDTH_READ_ONLY_DATA_FIELDS_H
24 #define VMCS_INTEL_X64_16BIT_NATURAL_WIDTH_READ_ONLY_DATA_FIELDS_H
25 
26 #include <vmcs/vmcs_intel_x64.h>
27 #include <intrinsics/portio_x64.h>
28 
35 
36 // *INDENT-OFF*
37 
38 namespace intel_x64
39 {
40 namespace vmcs
41 {
42 
43 namespace exit_qualification
44 {
45  constexpr const auto addr = 0x0000000000006400UL;
46  constexpr const auto name = "exit_qualification";
47 
48  inline bool exists() noexcept
49  { return true; }
50 
51  inline auto get()
52  { return get_vmcs_field(addr, name, exists()); }
53 
54  inline auto get_if_exists(bool verbose = false) noexcept
55  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
56 
57  namespace debug_exception
58  {
59  constexpr const auto name = "debug_exception";
60 
61  inline auto get_name()
62  { return name; }
63 
64  inline auto get()
65  { return get_vmcs_field(addr, name, exists()); }
66 
67  inline auto get_if_exists(bool verbose = false) noexcept
68  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
69 
70  namespace b0
71  {
72  constexpr const auto mask = 0x0000000000000001UL;
73  constexpr const auto from = 0;
74  constexpr const auto name = "b0";
75 
76  inline auto is_enabled()
77  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
78 
79  inline auto is_enabled_if_exists(bool verbose = false)
80  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
81 
82  inline auto is_disabled()
83  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
84 
85  inline auto is_disabled_if_exists(bool verbose = false)
86  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
87 
88  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
89  inline auto is_enabled(T t)
90  { return is_bit_set(t, from); }
91 
92  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
93  inline auto is_disabled(T t)
94  { return is_bit_cleared(t, from); }
95  }
96 
97  namespace b1
98  {
99  constexpr const auto mask = 0x0000000000000002UL;
100  constexpr const auto from = 1;
101  constexpr const auto name = "b1";
102 
103  inline auto is_enabled()
104  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
105 
106  inline auto is_enabled_if_exists(bool verbose = false)
107  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
108 
109  inline auto is_disabled()
110  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
111 
112  inline auto is_disabled_if_exists(bool verbose = false)
113  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
114 
115  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
116  inline auto is_enabled(T t)
117  { return is_bit_set(t, from); }
118 
119  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
120  inline auto is_disabled(T t)
121  { return is_bit_cleared(t, from); }
122  }
123 
124  namespace b2
125  {
126  constexpr const auto mask = 0x0000000000000004UL;
127  constexpr const auto from = 2;
128  constexpr const auto name = "b2";
129 
130  inline auto is_enabled()
131  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
132 
133  inline auto is_enabled_if_exists(bool verbose = false)
134  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
135 
136  inline auto is_disabled()
137  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
138 
139  inline auto is_disabled_if_exists(bool verbose = false)
140  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
141 
142  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
143  inline auto is_enabled(T t)
144  { return is_bit_set(t, from); }
145 
146  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
147  inline auto is_disabled(T t)
148  { return is_bit_cleared(t, from); }
149  }
150 
151  namespace b3
152  {
153  constexpr const auto mask = 0x0000000000000008UL;
154  constexpr const auto from = 3;
155  constexpr const auto name = "b3";
156 
157  inline auto is_enabled()
158  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
159 
160  inline auto is_enabled_if_exists(bool verbose = false)
161  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
162 
163  inline auto is_disabled()
164  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
165 
166  inline auto is_disabled_if_exists(bool verbose = false)
167  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
168 
169  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
170  inline auto is_enabled(T t)
171  { return is_bit_set(t, from); }
172 
173  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
174  inline auto is_disabled(T t)
175  { return is_bit_cleared(t, from); }
176  }
177 
178  namespace reserved
179  {
180  constexpr const auto mask = 0xFFFFFFFFFFFF9FF0UL;
181  constexpr const auto from = 0;
182  constexpr const auto name = "reserved";
183 
184  inline auto get()
185  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
186 
187  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
188  inline auto get(T t)
189  { return get_bits(t, mask) >> from; }
190 
191  inline auto get_if_exists(bool verbose = false) noexcept
192  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
193  }
194 
195  namespace bd
196  {
197  constexpr const auto mask = 0x0000000000002000UL;
198  constexpr const auto from = 13;
199  constexpr const auto name = "bd";
200 
201  inline auto is_enabled()
202  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
203 
204  inline auto is_enabled_if_exists(bool verbose = false)
205  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
206 
207  inline auto is_disabled()
208  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
209 
210  inline auto is_disabled_if_exists(bool verbose = false)
211  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
212 
213  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
214  inline auto is_enabled(T t)
215  { return is_bit_set(t, from); }
216 
217  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
218  inline auto is_disabled(T t)
219  { return is_bit_cleared(t, from); }
220  }
221 
222  namespace bs
223  {
224  constexpr const auto mask = 0x0000000000004000UL;
225  constexpr const auto from = 14;
226  constexpr const auto name = "bs";
227 
228  inline auto is_enabled()
229  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
230 
231  inline auto is_enabled_if_exists(bool verbose = false)
232  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
233 
234  inline auto is_disabled()
235  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
236 
237  inline auto is_disabled_if_exists(bool verbose = false)
238  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
239 
240  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
241  inline auto is_enabled(T t)
242  { return is_bit_set(t, from); }
243 
244  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
245  inline auto is_disabled(T t)
246  { return is_bit_cleared(t, from); }
247  }
248  }
249 
250  namespace page_fault_exception
251  {
252  constexpr const auto name = "page_fault_exception";
253 
254  inline auto get_name()
255  { return name; }
256 
257  inline auto address()
258  { return get_vmcs_field(addr, name, exists()); }
259 
260  inline auto address_if_exists(bool verbose = false) noexcept
261  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
262  }
263 
264  namespace sipi
265  {
266  constexpr const auto name = "sipi";
267 
268  inline auto get_name()
269  { return name; }
270 
271  inline auto get()
272  { return get_vmcs_field(addr, name, exists()); }
273 
274  inline auto get_if_exists(bool verbose = false) noexcept
275  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
276 
277  namespace vector
278  {
279  constexpr const auto mask = 0x00000000000000FFUL;
280  constexpr const auto from = 0;
281  constexpr const auto name = "vector";
282 
283  inline auto get()
284  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
285 
286  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
287  inline auto get(T t)
288  { return get_bits(t, mask) >> from; }
289 
290  inline auto get_if_exists(bool verbose = false) noexcept
291  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
292  }
293  }
294 
295  namespace task_switch
296  {
297  constexpr const auto name = "task_switch";
298 
299  inline auto get_name()
300  { return name; }
301 
302  inline auto get()
303  { return get_vmcs_field(addr, name, exists()); }
304 
305  inline auto get_if_exists(bool verbose = false) noexcept
306  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
307 
308  namespace tss_selector
309  {
310  constexpr const auto mask = 0x000000000000FFFFUL;
311  constexpr const auto from = 0;
312  constexpr const auto name = "tss_selector";
313 
314  inline auto get()
315  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
316 
317  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
318  inline auto get(T t)
319  { return get_bits(t, mask) >> from; }
320 
321  inline auto get_if_exists(bool verbose = false) noexcept
322  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
323  }
324 
325  namespace reserved
326  {
327  constexpr const auto mask = 0xFFFFFFFF3FFF0000UL;
328  constexpr const auto from = 0;
329  constexpr const auto name = "reserved";
330 
331  inline auto get()
332  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
333 
334  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
335  inline auto get(T t)
336  { return get_bits(t, mask) >> from; }
337 
338  inline auto get_if_exists(bool verbose = false) noexcept
339  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
340  }
341 
342  namespace source_of_task_switch_init
343  {
344  constexpr const auto mask = 0x00000000C0000000UL;
345  constexpr const auto from = 30;
346  constexpr const auto name = "task_switch_init_source";
347 
348  constexpr const auto call_instruction = 0U;
349  constexpr const auto iret_instruction = 1U;
350  constexpr const auto jmp_instruction = 2U;
351  constexpr const auto task_gate_in_idt = 3U;
352 
353  inline auto get()
354  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
355 
356  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
357  inline auto get(T t)
358  { return get_bits(t, mask) >> from; }
359 
360  inline auto get_if_exists(bool verbose = false) noexcept
361  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
362  }
363  }
364 
365  namespace invept
366  {
367  constexpr const auto name = "invept";
368 
369  inline auto get_name()
370  { return name; }
371 
372  inline auto get()
373  { return get_vmcs_field(addr, name, exists()); }
374 
375  inline auto get_if_exists(bool verbose = false) noexcept
376  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
377  }
378 
379  namespace invpcid
380  {
381  constexpr const auto name = "invpcid";
382 
383  inline auto get_name()
384  { return name; }
385 
386  inline auto get()
387  { return get_vmcs_field(addr, name, exists()); }
388 
389  inline auto get_if_exists(bool verbose = false) noexcept
390  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
391  }
392 
393  namespace invvpid
394  {
395  constexpr const auto name = "invvpid";
396 
397  inline auto get_name()
398  { return name; }
399 
400  inline auto get()
401  { return get_vmcs_field(addr, name, exists()); }
402 
403  inline auto get_if_exists(bool verbose = false) noexcept
404  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
405  }
406 
407  namespace lgdt
408  {
409  constexpr const auto name = "lgdt";
410 
411  inline auto get_name()
412  { return name; }
413 
414  inline auto get()
415  { return get_vmcs_field(addr, name, exists()); }
416 
417  inline auto get_if_exists(bool verbose = false) noexcept
418  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
419  }
420 
421  namespace lidt
422  {
423  constexpr const auto name = "lidt";
424 
425  inline auto get_name()
426  { return name; }
427 
428  inline auto get()
429  { return get_vmcs_field(addr, name, exists()); }
430 
431  inline auto get_if_exists(bool verbose = false) noexcept
432  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
433  }
434 
435  namespace lldt
436  {
437  constexpr const auto name = "lldt";
438 
439  inline auto get_name()
440  { return name; }
441 
442  inline auto get()
443  { return get_vmcs_field(addr, name, exists()); }
444 
445  inline auto get_if_exists(bool verbose = false) noexcept
446  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
447  }
448 
449  namespace ltr
450  {
451  constexpr const auto name = "ltr";
452 
453  inline auto get_name()
454  { return name; }
455 
456  inline auto get()
457  { return get_vmcs_field(addr, name, exists()); }
458 
459  inline auto get_if_exists(bool verbose = false) noexcept
460  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
461  }
462 
463  namespace sgdt
464  {
465  constexpr const auto name = "sgdt";
466 
467  inline auto get_name()
468  { return name; }
469 
470  inline auto get()
471  { return get_vmcs_field(addr, name, exists()); }
472 
473  inline auto get_if_exists(bool verbose = false) noexcept
474  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
475  }
476 
477  namespace sidt
478  {
479  constexpr const auto name = "sidt";
480 
481  inline auto get_name()
482  { return name; }
483 
484  inline auto get()
485  { return get_vmcs_field(addr, name, exists()); }
486 
487  inline auto get_if_exists(bool verbose = false) noexcept
488  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
489  }
490 
491  namespace sldt
492  {
493  constexpr const auto name = "sldt";
494 
495  inline auto get_name()
496  { return name; }
497 
498  inline auto get()
499  { return get_vmcs_field(addr, name, exists()); }
500 
501  inline auto get_if_exists(bool verbose = false) noexcept
502  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
503  }
504 
505  namespace str
506  {
507  constexpr const auto name = "str";
508 
509  inline auto get_name()
510  { return name; }
511 
512  inline auto get()
513  { return get_vmcs_field(addr, name, exists()); }
514 
515  inline auto get_if_exists(bool verbose = false) noexcept
516  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
517  }
518 
519  namespace vmclear
520  {
521  constexpr const auto name = "vmclear";
522 
523  inline auto get_name()
524  { return name; }
525 
526  inline auto get()
527  { return get_vmcs_field(addr, name, exists()); }
528 
529  inline auto get_if_exists(bool verbose = false) noexcept
530  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
531  }
532 
533  namespace vmptrld
534  {
535  constexpr const auto name = "vmptrld";
536 
537  inline auto get_name()
538  { return name; }
539 
540  inline auto get()
541  { return get_vmcs_field(addr, name, exists()); }
542 
543  inline auto get_if_exists(bool verbose = false) noexcept
544  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
545  }
546 
547  namespace vmptrst
548  {
549  constexpr const auto name = "vmptrst";
550 
551  inline auto get_name()
552  { return name; }
553 
554  inline auto get()
555  { return get_vmcs_field(addr, name, exists()); }
556 
557  inline auto get_if_exists(bool verbose = false) noexcept
558  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
559  }
560 
561  namespace vmread
562  {
563  constexpr const auto name = "vmread";
564 
565  inline auto get_name()
566  { return name; }
567 
568  inline auto get()
569  { return get_vmcs_field(addr, name, exists()); }
570 
571  inline auto get_if_exists(bool verbose = false) noexcept
572  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
573  }
574 
575  namespace vmwrite
576  {
577  constexpr const auto name = "vmwrite";
578 
579  inline auto get_name()
580  { return name; }
581 
582  inline auto get()
583  { return get_vmcs_field(addr, name, exists()); }
584 
585  inline auto get_if_exists(bool verbose = false) noexcept
586  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
587  }
588 
589  namespace vmxon
590  {
591  constexpr const auto name = "vmxon";
592 
593  inline auto get_name()
594  { return name; }
595 
596  inline auto get()
597  { return get_vmcs_field(addr, name, exists()); }
598 
599  inline auto get_if_exists(bool verbose = false) noexcept
600  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
601  }
602 
603  namespace xrstors
604  {
605  constexpr const auto name = "xrstors";
606 
607  inline auto get_name()
608  { return name; }
609 
610  inline auto get()
611  { return get_vmcs_field(addr, name, exists()); }
612 
613  inline auto get_if_exists(bool verbose = false) noexcept
614  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
615  }
616 
617  namespace xsaves
618  {
619  constexpr const auto name = "xsaves";
620 
621  inline auto get_name()
622  { return name; }
623 
624  inline auto get()
625  { return get_vmcs_field(addr, name, exists()); }
626 
627  inline auto get_if_exists(bool verbose = false) noexcept
628  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
629  }
630 
631  namespace control_register_access
632  {
633  constexpr const auto name = "control_register_access";
634 
635  inline auto get_name()
636  { return name; }
637 
638  inline auto get()
639  { return get_vmcs_field(addr, name, exists()); }
640 
641  inline auto get_if_exists(bool verbose = false) noexcept
642  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
643 
644  namespace control_register_number
645  {
646  constexpr const auto mask = 0x000000000000000FUL;
647  constexpr const auto from = 0;
648  constexpr const auto name = "control_register_number";
649 
650  inline auto get()
651  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
652 
653  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
654  inline auto get(T t)
655  { return get_bits(t, mask) >> from; }
656 
657  inline auto get_if_exists(bool verbose = false) noexcept
658  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
659  }
660 
661  namespace access_type
662  {
663  constexpr const auto mask = 0x0000000000000030UL;
664  constexpr const auto from = 4;
665  constexpr const auto name = "access_type";
666 
667  constexpr const auto mov_to_cr = 0U;
668  constexpr const auto mov_from_cr = 1U;
669  constexpr const auto clts = 2U;
670  constexpr const auto lmsw = 3U;
671 
672  inline auto get()
673  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
674 
675  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
676  inline auto get(T t)
677  { return get_bits(t, mask) >> from; }
678 
679  inline auto get_if_exists(bool verbose = false) noexcept
680  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
681  }
682 
683  namespace lmsw_operand_type
684  {
685  constexpr const auto mask = 0x0000000000000040UL;
686  constexpr const auto from = 6;
687  constexpr const auto name = "lmsw_operand_type";
688 
689  constexpr const auto reg = 0U;
690  constexpr const auto mem = 1U;
691 
692  inline auto get()
693  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
694 
695  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
696  inline auto get(T t)
697  { return get_bits(t, mask) >> from; }
698 
699  inline auto get_if_exists(bool verbose = false) noexcept
700  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
701  }
702 
703  namespace reserved
704  {
705  constexpr const auto mask = 0xFFFFFFFF0000F080UL;
706  constexpr const auto from = 0;
707  constexpr const auto name = "reserved";
708 
709  inline auto get()
710  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
711 
712  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
713  inline auto get(T t)
714  { return get_bits(t, mask) >> from; }
715 
716  inline auto get_if_exists(bool verbose = false) noexcept
717  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
718  }
719 
720  namespace general_purpose_register
721  {
722  constexpr const auto mask = 0x0000000000000F00UL;
723  constexpr const auto from = 8;
724  constexpr const auto name = "general_purpose_register";
725 
726  constexpr const auto rax = 0U;
727  constexpr const auto rcx = 1U;
728  constexpr const auto rdx = 2U;
729  constexpr const auto rbx = 3U;
730  constexpr const auto rsp = 4U;
731  constexpr const auto rbp = 5U;
732  constexpr const auto rsi = 6U;
733  constexpr const auto rdi = 7U;
734  constexpr const auto r8 = 8U;
735  constexpr const auto r9 = 9U;
736  constexpr const auto r10 = 10U;
737  constexpr const auto r11 = 11U;
738  constexpr const auto r12 = 12U;
739  constexpr const auto r13 = 13U;
740  constexpr const auto r14 = 14U;
741  constexpr const auto r15 = 15U;
742 
743  inline auto get()
744  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
745 
746  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
747  inline auto get(T t)
748  { return get_bits(t, mask) >> from; }
749 
750  inline auto get_if_exists(bool verbose = false) noexcept
751  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
752  }
753 
754  namespace source_data
755  {
756  constexpr const auto mask = 0x00000000FFFF0000UL;
757  constexpr const auto from = 16;
758  constexpr const auto name = "source_data";
759 
760  inline auto get()
761  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
762 
763  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
764  inline auto get(T t)
765  { return get_bits(t, mask) >> from; }
766 
767  inline auto get_if_exists(bool verbose = false) noexcept
768  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
769 
770  }
771  }
772 
773  namespace mov_dr
774  {
775  constexpr const auto name = "mov_dr";
776 
777  inline auto get_name()
778  { return name; }
779 
780  inline auto get()
781  { return get_vmcs_field(addr, name, exists()); }
782 
783  inline auto get_if_exists(bool verbose = false) noexcept
784  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
785 
786  namespace debug_register_number
787  {
788  constexpr const auto mask = 0x0000000000000007UL;
789  constexpr const auto from = 0;
790  constexpr const auto name = "debug_register_number";
791 
792  inline auto get()
793  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
794 
795  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
796  inline auto get(T t)
797  { return get_bits(t, mask) >> from; }
798 
799  inline auto get_if_exists(bool verbose = false) noexcept
800  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
801  }
802 
803  namespace reserved
804  {
805  constexpr const auto mask = 0xFFFFFFFFFFFFF0E8UL;
806  constexpr const auto from = 0;
807  constexpr const auto name = "reserved";
808 
809  inline auto get()
810  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
811 
812  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
813  inline auto get(T t)
814  { return get_bits(t, mask) >> from; }
815 
816  inline auto get_if_exists(bool verbose = false) noexcept
817  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
818  }
819 
820  namespace direction_of_access
821  {
822  constexpr const auto mask = 0x0000000000000010UL;
823  constexpr const auto from = 4;
824  constexpr const auto name = "direction_of_access";
825 
826  constexpr const auto to_dr = 0U;
827  constexpr const auto from_dr = 1U;
828 
829  inline auto get()
830  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
831 
832  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
833  inline auto get(T t)
834  { return get_bits(t, mask) >> from; }
835 
836  inline auto get_if_exists(bool verbose = false) noexcept
837  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
838  }
839 
840  namespace general_purpose_register
841  {
842  constexpr const auto mask = 0x0000000000000F00UL;
843  constexpr const auto from = 8;
844  constexpr const auto name = "general_purpose_register";
845 
846  constexpr const auto rax = 0U;
847  constexpr const auto rcx = 1U;
848  constexpr const auto rdx = 2U;
849  constexpr const auto rbx = 3U;
850  constexpr const auto rsp = 4U;
851  constexpr const auto rbp = 5U;
852  constexpr const auto rsi = 6U;
853  constexpr const auto rdi = 7U;
854  constexpr const auto r8 = 8U;
855  constexpr const auto r9 = 9U;
856  constexpr const auto r10 = 10U;
857  constexpr const auto r11 = 11U;
858  constexpr const auto r12 = 12U;
859  constexpr const auto r13 = 13U;
860  constexpr const auto r14 = 14U;
861  constexpr const auto r15 = 15U;
862 
863  inline auto get()
864  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
865 
866  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
867  inline auto get(T t)
868  { return get_bits(t, mask) >> from; }
869 
870  inline auto get_if_exists(bool verbose = false) noexcept
871  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
872  }
873  }
874 
875  namespace io_instruction
876  {
877  constexpr const auto name = "io_instruction";
878 
879  inline auto get_name()
880  { return name; }
881 
882  inline auto get()
883  { return get_vmcs_field(addr, name, exists()); }
884 
885  inline auto get_if_exists(bool verbose = false) noexcept
886  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
887 
888  namespace size_of_access
889  {
890  constexpr const auto mask = 0x0000000000000007UL;
891  constexpr const auto from = 0;
892  constexpr const auto name = "size_of_access";
893 
894  constexpr const auto one_byte = 0U;
895  constexpr const auto two_byte = 1U;
896  constexpr const auto four_byte = 3U;
897 
898  inline auto get()
899  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
900 
901  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
902  inline auto get(T t)
903  { return get_bits(t, mask) >> from; }
904 
905  inline auto get_if_exists(bool verbose = false) noexcept
906  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
907  }
908 
909  namespace direction_of_access
910  {
911  constexpr const auto mask = 0x0000000000000008UL;
912  constexpr const auto from = 3;
913  constexpr const auto name = "direction_of_access";
914 
915  constexpr const auto out = 0U;
916  constexpr const auto in = 1U;
917 
918  inline auto get()
919  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
920 
921  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
922  inline auto get(T t)
923  { return get_bits(t, mask) >> from; }
924 
925  inline auto get_if_exists(bool verbose = false) noexcept
926  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
927  }
928 
929  namespace string_instruction
930  {
931  constexpr const auto mask = 0x0000000000000010UL;
932  constexpr const auto from = 4;
933  constexpr const auto name = "string_instruction";
934 
935  constexpr const auto not_string = 0U;
936  constexpr const auto string = 1U;
937 
938  inline auto get()
939  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
940 
941  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
942  inline auto get(T t)
943  { return get_bits(t, mask) >> from; }
944 
945  inline auto get_if_exists(bool verbose = false) noexcept
946  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
947  }
948 
949  namespace rep_prefixed
950  {
951  constexpr const auto mask = 0x0000000000000020UL;
952  constexpr const auto from = 5;
953  constexpr const auto name = "rep_prefixed";
954 
955  constexpr const auto not_rep = 0U;
956  constexpr const auto rep = 1U;
957 
958  inline auto get()
959  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
960 
961  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
962  inline auto get(T t)
963  { return get_bits(t, mask) >> from; }
964 
965  inline auto get_if_exists(bool verbose = false) noexcept
966  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
967  }
968 
969  namespace operand_encoding
970  {
971  constexpr const auto mask = 0x0000000000000040UL;
972  constexpr const auto from = 6;
973  constexpr const auto name = "operand_encoding";
974 
975  constexpr const auto dx = 0U;
976  constexpr const auto immediate = 1U;
977 
978  inline auto get()
979  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
980 
981  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
982  inline auto get(T t)
983  { return get_bits(t, mask) >> from; }
984 
985  inline auto get_if_exists(bool verbose = false) noexcept
986  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
987  }
988 
989  namespace reserved
990  {
991  constexpr const auto mask = 0xFFFFFFFF0000FF80UL;
992  constexpr const auto from = 0;
993  constexpr const auto name = "reserved";
994 
995  inline auto get()
996  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
997 
998  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
999  inline auto get(T t)
1000  { return get_bits(t, mask) >> from; }
1001 
1002  inline auto get_if_exists(bool verbose = false) noexcept
1003  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1004  }
1005 
1006  namespace port_number
1007  {
1008  constexpr const auto mask = 0x00000000FFFF0000UL;
1009  constexpr const auto from = 16;
1010  constexpr const auto name = "port_number";
1011 
1012  inline auto get()
1013  { return gsl::narrow_cast<x64::portio::port_addr_type>(get_bits(get_vmcs_field(addr, name, exists()), mask) >> from); }
1014 
1015  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1016  inline auto get(T t)
1017  { return gsl::narrow_cast<x64::portio::port_addr_type>(get_bits(t, mask) >> from); }
1018 
1019  inline auto get_if_exists(bool verbose = false) noexcept
1020  { return gsl::narrow_cast<x64::portio::port_addr_type>(get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from); }
1021  }
1022  }
1023 
1024  namespace mwait
1025  {
1026  constexpr const auto name = "mwait";
1027 
1028  inline auto get_name()
1029  { return name; }
1030 
1031  inline auto get()
1032  { return get_vmcs_field(addr, name, exists()); }
1033 
1034  inline auto get_if_exists(bool verbose = false) noexcept
1035  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1036  }
1037 
1038  namespace linear_apic_access
1039  {
1040  constexpr const auto name = "linear_apic_access";
1041 
1042  inline auto get_name()
1043  { return name; }
1044 
1045  inline auto get()
1046  { return get_vmcs_field(addr, name, exists()); }
1047 
1048  inline auto get_if_exists(bool verbose = false) noexcept
1049  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1050 
1051  namespace offset
1052  {
1053  constexpr const auto mask = 0x0000000000000FFFUL;
1054  constexpr const auto from = 0;
1055  constexpr const auto name = "offset";
1056 
1057  inline auto get()
1058  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1059 
1060  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1061  inline auto get(T t)
1062  { return get_bits(t, mask) >> from; }
1063 
1064  inline auto get_if_exists(bool verbose = false) noexcept
1065  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1066  }
1067 
1068  namespace access_type
1069  {
1070  constexpr const auto mask = 0x000000000000F000UL;
1071  constexpr const auto from = 12;
1072  constexpr const auto name = "access_type";
1073 
1074  constexpr const auto read_during_instruction_execution = 0U;
1075  constexpr const auto write_during_instruction_execution = 1U;
1076  constexpr const auto instruction_fetch = 2U;
1077  constexpr const auto event_delivery = 3U;
1078 
1079  inline auto get()
1080  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1081 
1082  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1083  inline auto get(T t)
1084  { return get_bits(t, mask) >> from; }
1085 
1086  inline auto get_if_exists(bool verbose = false) noexcept
1087  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1088  }
1089 
1090  namespace reserved
1091  {
1092  constexpr const auto mask = 0xFFFFFFFFFFFF0000UL;
1093  constexpr const auto from = 0;
1094  constexpr const auto name = "reserved";
1095 
1096  inline auto get()
1097  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1098 
1099  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1100  inline auto get(T t)
1101  { return get_bits(t, mask) >> from; }
1102 
1103  inline auto get_if_exists(bool verbose = false) noexcept
1104  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1105  }
1106  }
1107 
1108  namespace guest_physical_apic_access
1109  {
1110  constexpr const auto name = "guest_physical_apic_access";
1111 
1112  inline auto get_name()
1113  { return name; }
1114 
1115  inline auto get()
1116  { return get_vmcs_field(addr, name, exists()); }
1117 
1118  inline auto get_if_exists(bool verbose = false) noexcept
1119  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1120 
1121  namespace access_type
1122  {
1123  constexpr const auto mask = 0x000000000000F000UL;
1124  constexpr const auto from = 12;
1125  constexpr const auto name = "access_type";
1126 
1127  constexpr const auto event_delivery = 10U;
1128  constexpr const auto instruction_fetch_or_execution = 15U;
1129 
1130  inline auto get()
1131  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1132 
1133  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1134  inline auto get(T t)
1135  { return get_bits(t, mask) >> from; }
1136 
1137  inline auto get_if_exists(bool verbose = false) noexcept
1138  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1139  }
1140 
1141  namespace reserved
1142  {
1143  constexpr const auto mask = 0xFFFFFFFFFFFF0000UL;
1144  constexpr const auto from = 0;
1145  constexpr const auto name = "reserved";
1146 
1147  inline auto get()
1148  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1149 
1150  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1151  inline auto get(T t)
1152  { return get_bits(t, mask) >> from; }
1153 
1154  inline auto get_if_exists(bool verbose = false) noexcept
1155  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1156  }
1157  }
1158 
1159  namespace ept_violation
1160  {
1161  constexpr const auto name = "ept_violation";
1162 
1163  inline auto get_name()
1164  { return name; }
1165 
1166  inline auto get()
1167  { return get_vmcs_field(addr, name, exists()); }
1168 
1169  inline auto get_if_exists(bool verbose = false) noexcept
1170  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1171 
1172  namespace data_read
1173  {
1174  constexpr const auto mask = 0x0000000000000001UL;
1175  constexpr const auto from = 0;
1176  constexpr const auto name = "data_read";
1177 
1178  inline auto is_enabled()
1179  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1180 
1181  inline auto is_enabled_if_exists(bool verbose = false)
1182  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1183 
1184  inline auto is_disabled()
1185  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1186 
1187  inline auto is_disabled_if_exists(bool verbose = false)
1188  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1189 
1190  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1191  inline auto is_enabled(T t)
1192  { return is_bit_set(t, from); }
1193 
1194  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1195  inline auto is_disabled(T t)
1196  { return is_bit_cleared(t, from); }
1197  }
1198 
1199  namespace data_write
1200  {
1201  constexpr const auto mask = 0x0000000000000002UL;
1202  constexpr const auto from = 1;
1203  constexpr const auto name = "data_write";
1204 
1205  inline auto is_enabled()
1206  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1207 
1208  inline auto is_enabled_if_exists(bool verbose = false)
1209  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1210 
1211  inline auto is_disabled()
1212  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1213 
1214  inline auto is_disabled_if_exists(bool verbose = false)
1215  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1216 
1217  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1218  inline auto is_enabled(T t)
1219  { return is_bit_set(t, from); }
1220 
1221  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1222  inline auto is_disabled(T t)
1223  { return is_bit_cleared(t, from); }
1224  }
1225 
1227  {
1228  constexpr const auto mask = 0x0000000000000004UL;
1229  constexpr const auto from = 2;
1230  constexpr const auto name = "instruction_fetch";
1231 
1232  inline auto is_enabled()
1233  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1234 
1235  inline auto is_enabled_if_exists(bool verbose = false)
1236  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1237 
1238  inline auto is_disabled()
1239  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1240 
1241  inline auto is_disabled_if_exists(bool verbose = false)
1242  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1243 
1244  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1245  inline auto is_enabled(T t)
1246  { return is_bit_set(t, from); }
1247 
1248  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1249  inline auto is_disabled(T t)
1250  { return is_bit_cleared(t, from); }
1251  }
1252 
1253  namespace readable
1254  {
1255  constexpr const auto mask = 0x0000000000000008UL;
1256  constexpr const auto from = 3;
1257  constexpr const auto name = "readable";
1258 
1259  inline auto is_enabled()
1260  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1261 
1262  inline auto is_enabled_if_exists(bool verbose = false)
1263  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1264 
1265  inline auto is_disabled()
1266  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1267 
1268  inline auto is_disabled_if_exists(bool verbose = false)
1269  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1270 
1271  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1272  inline auto is_enabled(T t)
1273  { return is_bit_set(t, from); }
1274 
1275  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1276  inline auto is_disabled(T t)
1277  { return is_bit_cleared(t, from); }
1278  }
1279 
1280  namespace writeable
1281  {
1282  constexpr const auto mask = 0x0000000000000010UL;
1283  constexpr const auto from = 4;
1284  constexpr const auto name = "writeable";
1285 
1286  inline auto is_enabled()
1287  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1288 
1289  inline auto is_enabled_if_exists(bool verbose = false)
1290  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1291 
1292  inline auto is_disabled()
1293  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1294 
1295  inline auto is_disabled_if_exists(bool verbose = false)
1296  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1297 
1298  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1299  inline auto is_enabled(T t)
1300  { return is_bit_set(t, from); }
1301 
1302  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1303  inline auto is_disabled(T t)
1304  { return is_bit_cleared(t, from); }
1305  }
1306 
1307  namespace executable
1308  {
1309  constexpr const auto mask = 0x0000000000000020UL;
1310  constexpr const auto from = 5;
1311  constexpr const auto name = "executable";
1312 
1313  inline auto is_enabled()
1314  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1315 
1316  inline auto is_enabled_if_exists(bool verbose = false)
1317  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1318 
1319  inline auto is_disabled()
1320  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1321 
1322  inline auto is_disabled_if_exists(bool verbose = false)
1323  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1324 
1325  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1326  inline auto is_enabled(T t)
1327  { return is_bit_set(t, from); }
1328 
1329  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1330  inline auto is_disabled(T t)
1331  { return is_bit_cleared(t, from); }
1332  }
1333 
1334  // bit 8 may be reserved to 0 if bit 7 is 0
1335  namespace reserved
1336  {
1337  constexpr const auto mask = 0xFFFFFFFFFFFFEE40UL;
1338  constexpr const auto from = 0;
1339  constexpr const auto name = "reserved";
1340 
1341  inline auto get()
1342  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1343 
1344  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1345  inline auto get(T t)
1346  { return get_bits(t, mask) >> from; }
1347 
1348  inline auto get_if_exists(bool verbose = false) noexcept
1349  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1350  }
1351 
1352  namespace valid_guest_linear_address
1353  {
1354  constexpr const auto mask = 0x0000000000000080UL;
1355  constexpr const auto from = 7;
1356  constexpr const auto name = "valid_guest_linear_address";
1357 
1358  inline auto is_enabled()
1359  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1360 
1361  inline auto is_enabled_if_exists(bool verbose = false)
1362  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1363 
1364  inline auto is_disabled()
1365  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1366 
1367  inline auto is_disabled_if_exists(bool verbose = false)
1368  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1369 
1370  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1371  inline auto is_enabled(T t)
1372  { return is_bit_set(t, from); }
1373 
1374  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1375  inline auto is_disabled(T t)
1376  { return is_bit_cleared(t, from); }
1377  }
1378 
1379  // intentionally left bit 8 out
1380 
1381  namespace nmi_unblocking_due_to_iret
1382  {
1383  constexpr const auto mask = 0x0000000000001000UL;
1384  constexpr const auto from = 12;
1385  constexpr const auto name = "nmi_unblocking_due_to_iret";
1386 
1387  inline auto is_enabled()
1388  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1389 
1390  inline auto is_enabled_if_exists(bool verbose = false)
1391  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1392 
1393  inline auto is_disabled()
1394  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1395 
1396  inline auto is_disabled_if_exists(bool verbose = false)
1397  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1398 
1399  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1400  inline auto is_enabled(T t)
1401  { return is_bit_set(t, from); }
1402 
1403  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1404  inline auto is_disabled(T t)
1405  { return is_bit_cleared(t, from); }
1406  }
1407  }
1408 
1409  namespace eoi_virtualization
1410  {
1411  constexpr const auto name = "eoi_virtualization";
1412 
1413  inline auto get_name()
1414  { return name; }
1415 
1416  inline auto get()
1417  { return get_vmcs_field(addr, name, exists()); }
1418 
1419  inline auto get_if_exists(bool verbose = false) noexcept
1420  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1421 
1422  namespace vector
1423  {
1424  constexpr const auto mask = 0x00000000000000FFUL;
1425  constexpr const auto from = 0;
1426  constexpr const auto name = "vector";
1427 
1428  inline auto get()
1429  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1430 
1431  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1432  inline auto get(T t)
1433  { return get_bits(t, mask) >> from; }
1434 
1435  inline auto get_if_exists(bool verbose = false) noexcept
1436  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1437  }
1438  }
1439 
1440  namespace apic_write
1441  {
1442  constexpr const auto name = "apic_write";
1443 
1444  inline auto get_name()
1445  { return name; }
1446 
1447  inline auto get()
1448  { return get_vmcs_field(addr, name, exists()); }
1449 
1450  inline auto get_if_exists(bool verbose = false) noexcept
1451  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1452 
1453  namespace offset
1454  {
1455  constexpr const auto mask = 0x0000000000000FFFUL;
1456  constexpr const auto from = 0;
1457  constexpr const auto name = "offset";
1458 
1459  inline auto get()
1460  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1461 
1462  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1463  inline auto get(T t)
1464  { return get_bits(t, mask) >> from; }
1465 
1466  inline auto get_if_exists(bool verbose = false) noexcept
1467  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1468  }
1469  }
1470 }
1471 
1472 namespace io_rcx
1473 {
1474  constexpr const auto addr = 0x0000000000006402UL;
1475  constexpr const auto name = "io_rcx";
1476 
1477  inline auto exists()
1478  { return true; }
1479 
1480  inline auto get()
1481  { return get_vmcs_field(addr, name, exists()); }
1482 
1483  inline auto get_if_exists(bool verbose = false) noexcept
1484  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1485 }
1486 
1487 namespace io_rsi
1488 {
1489  constexpr const auto addr = 0x0000000000006404UL;
1490  constexpr const auto name = "io_rsi";
1491 
1492  inline auto exists()
1493  { return true; }
1494 
1495  inline auto get()
1496  { return get_vmcs_field(addr, name, exists()); }
1497 
1498  inline auto get_if_exists(bool verbose = false) noexcept
1499  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1500 }
1501 
1502 namespace io_rdi
1503 {
1504  constexpr const auto addr = 0x0000000000006406UL;
1505  constexpr const auto name = "io_rdi";
1506 
1507  inline auto exists()
1508  { return true; }
1509 
1510  inline auto get()
1511  { return get_vmcs_field(addr, name, exists()); }
1512 
1513  inline auto get_if_exists(bool verbose = false) noexcept
1514  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1515 }
1516 
1517 namespace io_rip
1518 {
1519  constexpr const auto addr = 0x0000000000006408UL;
1520  constexpr const auto name = "io_rip";
1521 
1522  inline auto exists()
1523  { return true; }
1524 
1525  inline auto get()
1526  { return get_vmcs_field(addr, name, exists()); }
1527 
1528  inline auto get_if_exists(bool verbose = false) noexcept
1529  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1530 }
1531 
1532 namespace guest_linear_address
1533 {
1534  constexpr const auto addr = 0x000000000000640AUL;
1535  constexpr const auto name = "guest_linear_address";
1536 
1537  inline auto exists()
1538  { return true; }
1539 
1540  inline auto get()
1541  { return get_vmcs_field(addr, name, exists()); }
1542 
1543  inline auto get_if_exists(bool verbose = false) noexcept
1544  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1545 }
1546 
1547 }
1548 }
1549 
1550 // *INDENT-ON*
1551 
1552 #endif
auto get_vmcs_field_if_exists(T addr, const char *name, bool verbose, bool exists)
void uint64_t uint64_t uint64_t *rdx noexcept
auto is_bit_cleared(T t, B b) noexcept
Definition: bitmanip.h:54
constexpr const auto debug_exception
Definition: x64.h:96
uint16_t port_addr_type
Definition: portio_x64.h:57
constexpr const auto reserved
Definition: vcpuid.h:33
auto get_bits(T t, M m) noexcept
Definition: bitmanip.h:65
auto get_vmcs_field(T addr, const char *name, bool exists)
#define offset(a, b)
Definition: test.cpp:192
auto is_bit_set(T t, B b) noexcept
Definition: bitmanip.h:48