vmcs_intel_x64_natural_width_host_state_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_NATURAL_WIDTH_HOST_STATE_FIELDS_H
24 #define VMCS_INTEL_X64_NATURAL_WIDTH_HOST_STATE_FIELDS_H
25 
26 #include <vmcs/vmcs_intel_x64.h>
27 
34 
35 // *INDENT-OFF*
36 
37 namespace intel_x64
38 {
39 namespace vmcs
40 {
41 
42 namespace host_cr0
43 {
44  constexpr const auto addr = 0x0000000000006C00UL;
45  constexpr const auto name = "host_cr0";
46 
47  inline bool exists() noexcept
48  { return true; }
49 
50  inline auto get()
51  { return get_vmcs_field(addr, name, exists()); }
52 
53  inline auto get_if_exists(bool verbose = false) noexcept
54  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
55 
56  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
57  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
58 
59  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
60  void set_if_exists(T val, bool verbose = false) noexcept
61  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
62 
63  namespace protection_enable
64  {
65  constexpr const auto mask = 0x0000000000000001UL;
66  constexpr const auto from = 0;
67  constexpr const auto name = "protection_enable";
68 
69  inline auto is_enabled()
70  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
71 
72  inline auto is_enabled_if_exists(bool verbose = false) noexcept
73  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
74 
75  inline auto is_disabled()
76  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
77 
78  inline auto is_disabled_if_exists(bool verbose = false) noexcept
79  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
80 
81  inline void enable()
82  {
83  auto&& field = get_vmcs_field(addr, name, exists());
84  set_vmcs_field(set_bit(field, from), addr, name, exists());
85  }
86 
87  inline void enable_if_exists(bool verbose = false) noexcept
88  {
89  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
90  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
91  }
92 
93  inline void disable()
94  {
95  auto&& field = get_vmcs_field(addr, name, exists());
96  set_vmcs_field(clear_bit(field, from), addr, name, exists());
97  }
98 
99  inline void disable_if_exists(bool verbose = false) noexcept
100  {
101  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
102  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
103  }
104  }
105 
106  namespace monitor_coprocessor
107  {
108  constexpr const auto mask = 0x0000000000000002UL;
109  constexpr const auto from = 1;
110  constexpr const auto name = "monitor_coprocessor";
111 
112  inline auto is_enabled()
113  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
114 
115  inline auto is_enabled_if_exists(bool verbose = false) noexcept
116  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
117 
118  inline auto is_disabled()
119  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
120 
121  inline auto is_disabled_if_exists(bool verbose = false) noexcept
122  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
123 
124  inline void enable()
125  {
126  auto&& field = get_vmcs_field(addr, name, exists());
127  set_vmcs_field(set_bit(field, from), addr, name, exists());
128  }
129 
130  inline void enable_if_exists(bool verbose = false) noexcept
131  {
132  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
133  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
134  }
135 
136  inline void disable()
137  {
138  auto&& field = get_vmcs_field(addr, name, exists());
139  set_vmcs_field(clear_bit(field, from), addr, name, exists());
140  }
141 
142  inline void disable_if_exists(bool verbose = false) noexcept
143  {
144  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
145  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
146  }
147  }
148 
149  namespace emulation
150  {
151  constexpr const auto mask = 0x0000000000000004UL;
152  constexpr const auto from = 2;
153  constexpr const auto name = "emulation";
154 
155  inline auto is_enabled()
156  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
157 
158  inline auto is_enabled_if_exists(bool verbose = false) noexcept
159  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
160 
161  inline auto is_disabled()
162  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
163 
164  inline auto is_disabled_if_exists(bool verbose = false) noexcept
165  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
166 
167  inline void enable()
168  {
169  auto&& field = get_vmcs_field(addr, name, exists());
170  set_vmcs_field(set_bit(field, from), addr, name, exists());
171  }
172 
173  inline void enable_if_exists(bool verbose = false) noexcept
174  {
175  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
176  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
177  }
178 
179  inline void disable()
180  {
181  auto&& field = get_vmcs_field(addr, name, exists());
182  set_vmcs_field(clear_bit(field, from), addr, name, exists());
183  }
184 
185  inline void disable_if_exists(bool verbose = false) noexcept
186  {
187  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
188  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
189  }
190  }
191 
192  namespace task_switched
193  {
194  constexpr const auto mask = 0x0000000000000008UL;
195  constexpr const auto from = 3;
196  constexpr const auto name = "task_switched";
197 
198  inline auto is_enabled()
199  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
200 
201  inline auto is_enabled_if_exists(bool verbose = false) noexcept
202  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
203 
204  inline auto is_disabled()
205  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
206 
207  inline auto is_disabled_if_exists(bool verbose = false) noexcept
208  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
209 
210  inline void enable()
211  {
212  auto&& field = get_vmcs_field(addr, name, exists());
213  set_vmcs_field(set_bit(field, from), addr, name, exists());
214  }
215 
216  inline void enable_if_exists(bool verbose = false) noexcept
217  {
218  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
219  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
220  }
221 
222  inline void disable()
223  {
224  auto&& field = get_vmcs_field(addr, name, exists());
225  set_vmcs_field(clear_bit(field, from), addr, name, exists());
226  }
227 
228  inline void disable_if_exists(bool verbose = false) noexcept
229  {
230  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
231  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
232  }
233  }
234 
235  namespace extension_type
236  {
237  constexpr const auto mask = 0x0000000000000010UL;
238  constexpr const auto from = 4;
239  constexpr const auto name = "extension_type";
240 
241  inline auto is_enabled()
242  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
243 
244  inline auto is_enabled_if_exists(bool verbose = false) noexcept
245  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
246 
247  inline auto is_disabled()
248  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
249 
250  inline auto is_disabled_if_exists(bool verbose = false) noexcept
251  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
252 
253  inline void enable()
254  {
255  auto&& field = get_vmcs_field(addr, name, exists());
256  set_vmcs_field(set_bit(field, from), addr, name, exists());
257  }
258 
259  inline void enable_if_exists(bool verbose = false) noexcept
260  {
261  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
262  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
263  }
264 
265  inline void disable()
266  {
267  auto&& field = get_vmcs_field(addr, name, exists());
268  set_vmcs_field(clear_bit(field, from), addr, name, exists());
269  }
270 
271  inline void disable_if_exists(bool verbose = false) noexcept
272  {
273  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
274  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
275  }
276  }
277 
278  namespace numeric_error
279  {
280  constexpr const auto mask = 0x0000000000000020UL;
281  constexpr const auto from = 5;
282  constexpr const auto name = "numeric_error";
283 
284  inline auto is_enabled()
285  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
286 
287  inline auto is_enabled_if_exists(bool verbose = false) noexcept
288  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
289 
290  inline auto is_disabled()
291  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
292 
293  inline auto is_disabled_if_exists(bool verbose = false) noexcept
294  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
295 
296  inline void enable()
297  {
298  auto&& field = get_vmcs_field(addr, name, exists());
299  set_vmcs_field(set_bit(field, from), addr, name, exists());
300  }
301 
302  inline void enable_if_exists(bool verbose = false) noexcept
303  {
304  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
305  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
306  }
307 
308  inline void disable()
309  {
310  auto&& field = get_vmcs_field(addr, name, exists());
311  set_vmcs_field(clear_bit(field, from), addr, name, exists());
312  }
313 
314  inline void disable_if_exists(bool verbose = false) noexcept
315  {
316  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
317  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
318  }
319  }
320 
321  namespace write_protect
322  {
323  constexpr const auto mask = 0x0000000000010000UL;
324  constexpr const auto from = 16;
325  constexpr const auto name = "write_protect";
326 
327  inline auto is_enabled()
328  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
329 
330  inline auto is_enabled_if_exists(bool verbose = false) noexcept
331  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
332 
333  inline auto is_disabled()
334  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
335 
336  inline auto is_disabled_if_exists(bool verbose = false) noexcept
337  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
338 
339  inline void enable()
340  {
341  auto&& field = get_vmcs_field(addr, name, exists());
342  set_vmcs_field(set_bit(field, from), addr, name, exists());
343  }
344 
345  inline void enable_if_exists(bool verbose = false) noexcept
346  {
347  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
348  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
349  }
350 
351  inline void disable()
352  {
353  auto&& field = get_vmcs_field(addr, name, exists());
354  set_vmcs_field(clear_bit(field, from), addr, name, exists());
355  }
356 
357  inline void disable_if_exists(bool verbose = false) noexcept
358  {
359  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
360  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
361  }
362  }
363 
364  namespace alignment_mask
365  {
366  constexpr const auto mask = 0x0000000000040000UL;
367  constexpr const auto from = 18;
368  constexpr const auto name = "alignment_mask";
369 
370  inline auto is_enabled()
371  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
372 
373  inline auto is_enabled_if_exists(bool verbose = false) noexcept
374  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
375 
376  inline auto is_disabled()
377  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
378 
379  inline auto is_disabled_if_exists(bool verbose = false) noexcept
380  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
381 
382  inline void enable()
383  {
384  auto&& field = get_vmcs_field(addr, name, exists());
385  set_vmcs_field(set_bit(field, from), addr, name, exists());
386  }
387 
388  inline void enable_if_exists(bool verbose = false) noexcept
389  {
390  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
391  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
392  }
393 
394  inline void disable()
395  {
396  auto&& field = get_vmcs_field(addr, name, exists());
397  set_vmcs_field(clear_bit(field, from), addr, name, exists());
398  }
399 
400  inline void disable_if_exists(bool verbose = false) noexcept
401  {
402  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
403  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
404  }
405  }
406 
407  namespace not_write_through
408  {
409  constexpr const auto mask = 0x0000000020000000UL;
410  constexpr const auto from = 29;
411  constexpr const auto name = "not_write_through";
412 
413  inline auto is_enabled()
414  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
415 
416  inline auto is_enabled_if_exists(bool verbose = false) noexcept
417  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
418 
419  inline auto is_disabled()
420  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
421 
422  inline auto is_disabled_if_exists(bool verbose = false) noexcept
423  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
424 
425  inline void enable()
426  {
427  auto&& field = get_vmcs_field(addr, name, exists());
428  set_vmcs_field(set_bit(field, from), addr, name, exists());
429  }
430 
431  inline void enable_if_exists(bool verbose = false) noexcept
432  {
433  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
434  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
435  }
436 
437  inline void disable()
438  {
439  auto&& field = get_vmcs_field(addr, name, exists());
440  set_vmcs_field(clear_bit(field, from), addr, name, exists());
441  }
442 
443  inline void disable_if_exists(bool verbose = false) noexcept
444  {
445  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
446  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
447  }
448  }
449 
450  namespace cache_disable
451  {
452  constexpr const auto mask = 0x0000000040000000UL;
453  constexpr const auto from = 30;
454  constexpr const auto name = "cache_disable";
455 
456  inline auto is_enabled()
457  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
458 
459  inline auto is_enabled_if_exists(bool verbose = false) noexcept
460  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
461 
462  inline auto is_disabled()
463  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
464 
465  inline auto is_disabled_if_exists(bool verbose = false) noexcept
466  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
467 
468  inline void enable()
469  {
470  auto&& field = get_vmcs_field(addr, name, exists());
471  set_vmcs_field(set_bit(field, from), addr, name, exists());
472  }
473 
474  inline void enable_if_exists(bool verbose = false) noexcept
475  {
476  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
477  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
478  }
479 
480  inline void disable()
481  {
482  auto&& field = get_vmcs_field(addr, name, exists());
483  set_vmcs_field(clear_bit(field, from), addr, name, exists());
484  }
485 
486  inline void disable_if_exists(bool verbose = false) noexcept
487  {
488  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
489  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
490  }
491  }
492 
493  namespace paging
494  {
495  constexpr const auto mask = 0x0000000080000000UL;
496  constexpr const auto from = 31;
497  constexpr const auto name = "paging";
498 
499  inline auto is_enabled()
500  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
501 
502  inline auto is_enabled_if_exists(bool verbose = false) noexcept
503  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
504 
505  inline auto is_disabled()
506  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
507 
508  inline auto is_disabled_if_exists(bool verbose = false) noexcept
509  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
510 
511  inline void enable()
512  {
513  auto&& field = get_vmcs_field(addr, name, exists());
514  set_vmcs_field(set_bit(field, from), addr, name, exists());
515  }
516 
517  inline void enable_if_exists(bool verbose = false) noexcept
518  {
519  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
520  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
521  }
522 
523  inline void disable()
524  {
525  auto&& field = get_vmcs_field(addr, name, exists());
526  set_vmcs_field(clear_bit(field, from), addr, name, exists());
527  }
528 
529  inline void disable_if_exists(bool verbose = false) noexcept
530  {
531  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
532  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
533  }
534  }
535 
536  inline void dump() noexcept
537  {
538  bfdebug << "host cr0 enabled flags:" << bfendl;
539 
541  bfdebug << " - " << protection_enable::name << bfendl;
543  bfdebug << " - " << monitor_coprocessor::name << bfendl;
544  if (emulation::is_enabled())
545  bfdebug << " - " << emulation::name << bfendl;
547  bfdebug << " - " << task_switched::name << bfendl;
549  bfdebug << " - " << extension_type::name << bfendl;
551  bfdebug << " - " << numeric_error::name << bfendl;
553  bfdebug << " - " << write_protect::name << bfendl;
555  bfdebug << " - " << alignment_mask::name << bfendl;
557  bfdebug << " - " << not_write_through::name << bfendl;
559  bfdebug << " - " << cache_disable::name << bfendl;
560  if (paging::is_enabled())
561  bfdebug << " - " << paging::name << bfendl;
562  }
563 }
564 
565 namespace host_cr3
566 {
567  constexpr const auto addr = 0x0000000000006C02UL;
568  constexpr const auto name = "host_cr3";
569 
570  inline bool exists() noexcept
571  { return true; }
572 
573  inline auto get()
574  { return get_vmcs_field(addr, name, exists()); }
575 
576  inline auto get_if_exists(bool verbose = false) noexcept
577  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
578 
579  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
580  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
581 
582  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
583  void set_if_exists(T val, bool verbose = false) noexcept
584  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
585 }
586 
587 namespace host_cr4
588 {
589  constexpr const auto addr = 0x0000000000006C04UL;
590  constexpr const auto name = "host_cr4";
591 
592  inline bool exists() noexcept
593  { return true; }
594 
595  inline auto get()
596  { return get_vmcs_field(addr, name, exists()); }
597 
598  inline auto get_if_exists(bool verbose = false) noexcept
599  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
600 
601  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
602  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
603 
604  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
605  void set_if_exists(T val, bool verbose = false) noexcept
606  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
607 
608  namespace v8086_mode_extensions
609  {
610  constexpr const auto mask = 0x0000000000000001UL;
611  constexpr const auto from = 0;
612  constexpr const auto name = "v8086_mode_extensions";
613 
614  inline auto is_enabled()
615  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
616 
617  inline auto is_enabled_if_exists(bool verbose = false) noexcept
618  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
619 
620  inline auto is_disabled()
621  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
622 
623  inline auto is_disabled_if_exists(bool verbose = false) noexcept
624  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
625 
626  inline void enable()
627  {
628  auto&& field = get_vmcs_field(addr, name, exists());
629  set_vmcs_field(set_bit(field, from), addr, name, exists());
630  }
631 
632  inline void enable_if_exists(bool verbose = false) noexcept
633  {
634  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
635  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
636  }
637 
638  inline void disable()
639  {
640  auto&& field = get_vmcs_field(addr, name, exists());
641  set_vmcs_field(clear_bit(field, from), addr, name, exists());
642  }
643 
644  inline void disable_if_exists(bool verbose = false) noexcept
645  {
646  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
647  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
648  }
649  }
650 
651  namespace protected_mode_virtual_interrupts
652  {
653  constexpr const auto mask = 0x0000000000000002UL;
654  constexpr const auto from = 1;
655  constexpr const auto name = "protected_mode_virtual_interrupts";
656 
657  inline auto is_enabled()
658  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
659 
660  inline auto is_enabled_if_exists(bool verbose = false) noexcept
661  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
662 
663  inline auto is_disabled()
664  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
665 
666  inline auto is_disabled_if_exists(bool verbose = false) noexcept
667  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
668 
669  inline void enable()
670  {
671  auto&& field = get_vmcs_field(addr, name, exists());
672  set_vmcs_field(set_bit(field, from), addr, name, exists());
673  }
674 
675  inline void enable_if_exists(bool verbose = false) noexcept
676  {
677  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
678  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
679  }
680 
681  inline void disable()
682  {
683  auto&& field = get_vmcs_field(addr, name, exists());
684  set_vmcs_field(clear_bit(field, from), addr, name, exists());
685  }
686 
687  inline void disable_if_exists(bool verbose = false) noexcept
688  {
689  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
690  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
691  }
692  }
693 
694  namespace time_stamp_disable
695  {
696  constexpr const auto mask = 0x0000000000000004UL;
697  constexpr const auto from = 2;
698  constexpr const auto name = "time_stamp_disable";
699 
700  inline auto is_enabled()
701  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
702 
703  inline auto is_enabled_if_exists(bool verbose = false) noexcept
704  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
705 
706  inline auto is_disabled()
707  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
708 
709  inline auto is_disabled_if_exists(bool verbose = false) noexcept
710  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
711 
712  inline void enable()
713  {
714  auto&& field = get_vmcs_field(addr, name, exists());
715  set_vmcs_field(set_bit(field, from), addr, name, exists());
716  }
717 
718  inline void enable_if_exists(bool verbose = false) noexcept
719  {
720  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
721  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
722  }
723 
724  inline void disable()
725  {
726  auto&& field = get_vmcs_field(addr, name, exists());
727  set_vmcs_field(clear_bit(field, from), addr, name, exists());
728  }
729 
730  inline void disable_if_exists(bool verbose = false) noexcept
731  {
732  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
733  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
734  }
735  }
736 
737  namespace debugging_extensions
738  {
739  constexpr const auto mask = 0x0000000000000008UL;
740  constexpr const auto from = 3;
741  constexpr const auto name = "debugging_extensions";
742 
743  inline auto is_enabled()
744  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
745 
746  inline auto is_enabled_if_exists(bool verbose = false) noexcept
747  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
748 
749  inline auto is_disabled()
750  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
751 
752  inline auto is_disabled_if_exists(bool verbose = false) noexcept
753  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
754 
755  inline void enable()
756  {
757  auto&& field = get_vmcs_field(addr, name, exists());
758  set_vmcs_field(set_bit(field, from), addr, name, exists());
759  }
760 
761  inline void enable_if_exists(bool verbose = false) noexcept
762  {
763  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
764  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
765  }
766 
767  inline void disable()
768  {
769  auto&& field = get_vmcs_field(addr, name, exists());
770  set_vmcs_field(clear_bit(field, from), addr, name, exists());
771  }
772 
773  inline void disable_if_exists(bool verbose = false) noexcept
774  {
775  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
776  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
777  }
778  }
779 
780  namespace page_size_extensions
781  {
782  constexpr const auto mask = 0x0000000000000010UL;
783  constexpr const auto from = 4;
784  constexpr const auto name = "page_size_extensions";
785 
786  inline auto is_enabled()
787  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
788 
789  inline auto is_enabled_if_exists(bool verbose = false) noexcept
790  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
791 
792  inline auto is_disabled()
793  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
794 
795  inline auto is_disabled_if_exists(bool verbose = false) noexcept
796  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
797 
798  inline void enable()
799  {
800  auto&& field = get_vmcs_field(addr, name, exists());
801  set_vmcs_field(set_bit(field, from), addr, name, exists());
802  }
803 
804  inline void enable_if_exists(bool verbose = false) noexcept
805  {
806  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
807  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
808  }
809 
810  inline void disable()
811  {
812  auto&& field = get_vmcs_field(addr, name, exists());
813  set_vmcs_field(clear_bit(field, from), addr, name, exists());
814  }
815 
816  inline void disable_if_exists(bool verbose = false) noexcept
817  {
818  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
819  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
820  }
821  }
822 
823  namespace physical_address_extensions
824  {
825  constexpr const auto mask = 0x0000000000000020UL;
826  constexpr const auto from = 5;
827  constexpr const auto name = "physical_address_extensions";
828 
829  inline auto is_enabled()
830  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
831 
832  inline auto is_enabled_if_exists(bool verbose = false) noexcept
833  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
834 
835  inline auto is_disabled()
836  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
837 
838  inline auto is_disabled_if_exists(bool verbose = false) noexcept
839  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
840 
841  inline void enable()
842  {
843  auto&& field = get_vmcs_field(addr, name, exists());
844  set_vmcs_field(set_bit(field, from), addr, name, exists());
845  }
846 
847  inline void enable_if_exists(bool verbose = false) noexcept
848  {
849  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
850  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
851  }
852 
853  inline void disable()
854  {
855  auto&& field = get_vmcs_field(addr, name, exists());
856  set_vmcs_field(clear_bit(field, from), addr, name, exists());
857  }
858 
859  inline void disable_if_exists(bool verbose = false) noexcept
860  {
861  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
862  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
863  }
864  }
865 
866  namespace machine_check_enable
867  {
868  constexpr const auto mask = 0x0000000000000040UL;
869  constexpr const auto from = 6;
870  constexpr const auto name = "machine_check_enable";
871 
872  inline auto is_enabled()
873  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
874 
875  inline auto is_enabled_if_exists(bool verbose = false) noexcept
876  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
877 
878  inline auto is_disabled()
879  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
880 
881  inline auto is_disabled_if_exists(bool verbose = false) noexcept
882  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
883 
884  inline void enable()
885  {
886  auto&& field = get_vmcs_field(addr, name, exists());
887  set_vmcs_field(set_bit(field, from), addr, name, exists());
888  }
889 
890  inline void enable_if_exists(bool verbose = false) noexcept
891  {
892  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
893  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
894  }
895 
896  inline void disable()
897  {
898  auto&& field = get_vmcs_field(addr, name, exists());
899  set_vmcs_field(clear_bit(field, from), addr, name, exists());
900  }
901 
902  inline void disable_if_exists(bool verbose = false) noexcept
903  {
904  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
905  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
906  }
907  }
908 
909  namespace page_global_enable
910  {
911  constexpr const auto mask = 0x0000000000000080UL;
912  constexpr const auto from = 7;
913  constexpr const auto name = "page_global_enable";
914 
915  inline auto is_enabled()
916  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
917 
918  inline auto is_enabled_if_exists(bool verbose = false) noexcept
919  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
920 
921  inline auto is_disabled()
922  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
923 
924  inline auto is_disabled_if_exists(bool verbose = false) noexcept
925  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
926 
927  inline void enable()
928  {
929  auto&& field = get_vmcs_field(addr, name, exists());
930  set_vmcs_field(set_bit(field, from), addr, name, exists());
931  }
932 
933  inline void enable_if_exists(bool verbose = false) noexcept
934  {
935  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
936  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
937  }
938 
939  inline void disable()
940  {
941  auto&& field = get_vmcs_field(addr, name, exists());
942  set_vmcs_field(clear_bit(field, from), addr, name, exists());
943  }
944 
945  inline void disable_if_exists(bool verbose = false) noexcept
946  {
947  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
948  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
949  }
950  }
951 
952  namespace performance_monitor_counter_enable
953  {
954  constexpr const auto mask = 0x0000000000000100UL;
955  constexpr const auto from = 8;
956  constexpr const auto name = "performance_monitor_counter_enable";
957 
958  inline auto is_enabled()
959  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
960 
961  inline auto is_enabled_if_exists(bool verbose = false) noexcept
962  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
963 
964  inline auto is_disabled()
965  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
966 
967  inline auto is_disabled_if_exists(bool verbose = false) noexcept
968  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
969 
970  inline void enable()
971  {
972  auto&& field = get_vmcs_field(addr, name, exists());
973  set_vmcs_field(set_bit(field, from), addr, name, exists());
974  }
975 
976  inline void enable_if_exists(bool verbose = false) noexcept
977  {
978  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
979  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
980  }
981 
982  inline void disable()
983  {
984  auto&& field = get_vmcs_field(addr, name, exists());
985  set_vmcs_field(clear_bit(field, from), addr, name, exists());
986  }
987 
988  inline void disable_if_exists(bool verbose = false) noexcept
989  {
990  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
991  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
992  }
993  }
994 
995  namespace osfxsr
996  {
997  constexpr const auto mask = 0x0000000000000200UL;
998  constexpr const auto from = 9;
999  constexpr const auto name = "osfxsr";
1000 
1001  inline auto is_enabled()
1002  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1003 
1004  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1005  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1006 
1007  inline auto is_disabled()
1008  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1009 
1010  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1011  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1012 
1013  inline void enable()
1014  {
1015  auto&& field = get_vmcs_field(addr, name, exists());
1016  set_vmcs_field(set_bit(field, from), addr, name, exists());
1017  }
1018 
1019  inline void enable_if_exists(bool verbose = false) noexcept
1020  {
1021  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1022  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1023  }
1024 
1025  inline void disable()
1026  {
1027  auto&& field = get_vmcs_field(addr, name, exists());
1028  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1029  }
1030 
1031  inline void disable_if_exists(bool verbose = false) noexcept
1032  {
1033  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1034  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1035  }
1036  }
1037 
1038  namespace osxmmexcpt
1039  {
1040  constexpr const auto mask = 0x0000000000000400UL;
1041  constexpr const auto from = 10;
1042  constexpr const auto name = "osxmmexcpt";
1043 
1044  inline auto is_enabled()
1045  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1046 
1047  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1048  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1049 
1050  inline auto is_disabled()
1051  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1052 
1053  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1054  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1055 
1056  inline void enable()
1057  {
1058  auto&& field = get_vmcs_field(addr, name, exists());
1059  set_vmcs_field(set_bit(field, from), addr, name, exists());
1060  }
1061 
1062  inline void enable_if_exists(bool verbose = false) noexcept
1063  {
1064  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1065  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1066  }
1067 
1068  inline void disable()
1069  {
1070  auto&& field = get_vmcs_field(addr, name, exists());
1071  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1072  }
1073 
1074  inline void disable_if_exists(bool verbose = false) noexcept
1075  {
1076  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1077  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1078  }
1079  }
1080 
1081  namespace vmx_enable_bit
1082  {
1083  constexpr const auto mask = 0x0000000000002000UL;
1084  constexpr const auto from = 13;
1085  constexpr const auto name = "vmx_enable_bit";
1086 
1087  inline auto is_enabled()
1088  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1089 
1090  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1091  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1092 
1093  inline auto is_disabled()
1094  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1095 
1096  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1097  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1098 
1099  inline void enable()
1100  {
1101  auto&& field = get_vmcs_field(addr, name, exists());
1102  set_vmcs_field(set_bit(field, from), addr, name, exists());
1103  }
1104 
1105  inline void enable_if_exists(bool verbose = false) noexcept
1106  {
1107  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1108  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1109  }
1110 
1111  inline void disable()
1112  {
1113  auto&& field = get_vmcs_field(addr, name, exists());
1114  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1115  }
1116 
1117  inline void disable_if_exists(bool verbose = false) noexcept
1118  {
1119  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1120  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1121  }
1122  }
1123 
1124  namespace smx_enable_bit
1125  {
1126  constexpr const auto mask = 0x0000000000004000UL;
1127  constexpr const auto from = 14;
1128  constexpr const auto name = "smx_enable_bit";
1129 
1130  inline auto is_enabled()
1131  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1132 
1133  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1134  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1135 
1136  inline auto is_disabled()
1137  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1138 
1139  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1140  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1141 
1142  inline void enable()
1143  {
1144  auto&& field = get_vmcs_field(addr, name, exists());
1145  set_vmcs_field(set_bit(field, from), addr, name, exists());
1146  }
1147 
1148  inline void enable_if_exists(bool verbose = false) noexcept
1149  {
1150  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1151  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1152  }
1153 
1154  inline void disable()
1155  {
1156  auto&& field = get_vmcs_field(addr, name, exists());
1157  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1158  }
1159 
1160  inline void disable_if_exists(bool verbose = false) noexcept
1161  {
1162  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1163  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1164  }
1165  }
1166 
1167  namespace fsgsbase_enable_bit
1168  {
1169  constexpr const auto mask = 0x0000000000010000UL;
1170  constexpr const auto from = 16;
1171  constexpr const auto name = "fsgsbase_enable_bit";
1172 
1173  inline auto is_enabled()
1174  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1175 
1176  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1177  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1178 
1179  inline auto is_disabled()
1180  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1181 
1182  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1183  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1184 
1185  inline void enable()
1186  {
1187  auto&& field = get_vmcs_field(addr, name, exists());
1188  set_vmcs_field(set_bit(field, from), addr, name, exists());
1189  }
1190 
1191  inline void enable_if_exists(bool verbose = false) noexcept
1192  {
1193  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1194  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1195  }
1196 
1197  inline void disable()
1198  {
1199  auto&& field = get_vmcs_field(addr, name, exists());
1200  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1201  }
1202 
1203  inline void disable_if_exists(bool verbose = false) noexcept
1204  {
1205  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1206  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1207  }
1208  }
1209 
1210  namespace pcid_enable_bit
1211  {
1212  constexpr const auto mask = 0x0000000000020000UL;
1213  constexpr const auto from = 17;
1214  constexpr const auto name = "pcid_enable_bit";
1215 
1216  inline auto is_enabled()
1217  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1218 
1219  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1220  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1221 
1222  inline auto is_disabled()
1223  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1224 
1225  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1226  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1227 
1228  inline void enable()
1229  {
1230  auto&& field = get_vmcs_field(addr, name, exists());
1231  set_vmcs_field(set_bit(field, from), addr, name, exists());
1232  }
1233 
1234  inline void enable_if_exists(bool verbose = false) noexcept
1235  {
1236  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1237  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1238  }
1239 
1240  inline void disable()
1241  {
1242  auto&& field = get_vmcs_field(addr, name, exists());
1243  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1244  }
1245 
1246  inline void disable_if_exists(bool verbose = false) noexcept
1247  {
1248  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1249  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1250  }
1251  }
1252 
1253  namespace osxsave
1254  {
1255  constexpr const auto mask = 0x0000000000040000UL;
1256  constexpr const auto from = 18;
1257  constexpr const auto name = "osxsave";
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) noexcept
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) noexcept
1269  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1270 
1271  inline void enable()
1272  {
1273  auto&& field = get_vmcs_field(addr, name, exists());
1274  set_vmcs_field(set_bit(field, from), addr, name, exists());
1275  }
1276 
1277  inline void enable_if_exists(bool verbose = false) noexcept
1278  {
1279  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1280  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1281  }
1282 
1283  inline void disable()
1284  {
1285  auto&& field = get_vmcs_field(addr, name, exists());
1286  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1287  }
1288 
1289  inline void disable_if_exists(bool verbose = false) noexcept
1290  {
1291  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1292  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1293  }
1294  }
1295 
1296  namespace smep_enable_bit
1297  {
1298  constexpr const auto mask = 0x0000000000100000UL;
1299  constexpr const auto from = 20;
1300  constexpr const auto name = "smep_enable_bit";
1301 
1302  inline auto is_enabled()
1303  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1304 
1305  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1306  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1307 
1308  inline auto is_disabled()
1309  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1310 
1311  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1312  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1313 
1314  inline void enable()
1315  {
1316  auto&& field = get_vmcs_field(addr, name, exists());
1317  set_vmcs_field(set_bit(field, from), addr, name, exists());
1318  }
1319 
1320  inline void enable_if_exists(bool verbose = false) noexcept
1321  {
1322  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1323  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1324  }
1325 
1326  inline void disable()
1327  {
1328  auto&& field = get_vmcs_field(addr, name, exists());
1329  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1330  }
1331 
1332  inline void disable_if_exists(bool verbose = false) noexcept
1333  {
1334  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1335  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1336  }
1337  }
1338 
1339  namespace smap_enable_bit
1340  {
1341  constexpr const auto mask = 0x0000000000200000UL;
1342  constexpr const auto from = 21;
1343  constexpr const auto name = "smap_enable_bit";
1344 
1345  inline auto is_enabled()
1346  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1347 
1348  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1349  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1350 
1351  inline auto is_disabled()
1352  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1353 
1354  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1355  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1356 
1357  inline void enable()
1358  {
1359  auto&& field = get_vmcs_field(addr, name, exists());
1360  set_vmcs_field(set_bit(field, from), addr, name, exists());
1361  }
1362 
1363  inline void enable_if_exists(bool verbose = false) noexcept
1364  {
1365  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1366  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1367  }
1368 
1369  inline void disable()
1370  {
1371  auto&& field = get_vmcs_field(addr, name, exists());
1372  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1373  }
1374 
1375  inline void disable_if_exists(bool verbose = false) noexcept
1376  {
1377  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1378  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1379  }
1380  }
1381 
1382  namespace protection_key_enable_bit
1383  {
1384  constexpr const auto mask = 0x0000000000400000UL;
1385  constexpr const auto from = 22;
1386  constexpr const auto name = "protection_key_enable_bit";
1387 
1388  inline auto is_enabled()
1389  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1390 
1391  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1392  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1393 
1394  inline auto is_disabled()
1395  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1396 
1397  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1398  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1399 
1400  inline void enable()
1401  {
1402  auto&& field = get_vmcs_field(addr, name, exists());
1403  set_vmcs_field(set_bit(field, from), addr, name, exists());
1404  }
1405 
1406  inline void enable_if_exists(bool verbose = false) noexcept
1407  {
1408  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1409  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1410  }
1411 
1412  inline void disable()
1413  {
1414  auto&& field = get_vmcs_field(addr, name, exists());
1415  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1416  }
1417 
1418  inline void disable_if_exists(bool verbose = false) noexcept
1419  {
1420  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1421  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1422  }
1423  }
1424 
1425  inline void dump() noexcept
1426  {
1427  bfdebug << "host cr4 enabled flags:" << bfendl;
1428 
1430  bfdebug << " - " << v8086_mode_extensions::name << bfendl;
1432  bfdebug << " - " << protected_mode_virtual_interrupts::name << bfendl;
1434  bfdebug << " - " << time_stamp_disable::name << bfendl;
1436  bfdebug << " - " << debugging_extensions::name << bfendl;
1438  bfdebug << " - " << page_size_extensions::name << bfendl;
1440  bfdebug << " - " << physical_address_extensions::name << bfendl;
1442  bfdebug << " - " << machine_check_enable::name << bfendl;
1444  bfdebug << " - " << page_global_enable::name << bfendl;
1446  bfdebug << " - " << performance_monitor_counter_enable::name << bfendl;
1447  if (osfxsr::is_enabled())
1448  bfdebug << " - " << osfxsr::name << bfendl;
1449  if (osxmmexcpt::is_enabled())
1450  bfdebug << " - " << osxmmexcpt::name << bfendl;
1452  bfdebug << " - " << vmx_enable_bit::name << bfendl;
1454  bfdebug << " - " << smx_enable_bit::name << bfendl;
1456  bfdebug << " - " << smx_enable_bit::name << bfendl;
1458  bfdebug << " - " << fsgsbase_enable_bit::name << bfendl;
1460  bfdebug << " - " << pcid_enable_bit::name << bfendl;
1461  if (osxsave::is_enabled())
1462  bfdebug << " - " << osxsave::name << bfendl;
1464  bfdebug << " - " << smep_enable_bit::name << bfendl;
1466  bfdebug << " - " << smap_enable_bit::name << bfendl;
1468  bfdebug << " - " << protection_key_enable_bit::name << bfendl;
1469  }
1470 }
1471 
1472 namespace host_fs_base
1473 {
1474  constexpr const auto addr = 0x0000000000006C06UL;
1475  constexpr const auto name = "host_fs_base";
1476 
1477  inline bool exists() noexcept
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  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1487  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
1488 
1489  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1490  void set_if_exists(T val, bool verbose = false) noexcept
1491  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
1492 }
1493 
1494 namespace host_gs_base
1495 {
1496  constexpr const auto addr = 0x0000000000006C08UL;
1497  constexpr const auto name = "host_gs_base";
1498 
1499  inline bool exists() noexcept
1500  { return true; }
1501 
1502  inline auto get()
1503  { return get_vmcs_field(addr, name, exists()); }
1504 
1505  inline auto get_if_exists(bool verbose = false) noexcept
1506  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1507 
1508  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1509  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
1510 
1511  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1512  void set_if_exists(T val, bool verbose = false) noexcept
1513  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
1514 }
1515 
1516 namespace host_tr_base
1517 {
1518  constexpr const auto addr = 0x0000000000006C0AUL;
1519  constexpr const auto name = "host_tr_base";
1520 
1521  inline bool exists() noexcept
1522  { return true; }
1523 
1524  inline auto get()
1525  { return get_vmcs_field(addr, name, exists()); }
1526 
1527  inline auto get_if_exists(bool verbose = false) noexcept
1528  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1529 
1530  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1531  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
1532 
1533  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1534  void set_if_exists(T val, bool verbose = false) noexcept
1535  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
1536 }
1537 
1538 namespace host_gdtr_base
1539 {
1540  constexpr const auto addr = 0x0000000000006C0CUL;
1541  constexpr const auto name = "host_gdtr_base";
1542 
1543  inline bool exists() noexcept
1544  { return true; }
1545 
1546  inline auto get()
1547  { return get_vmcs_field(addr, name, exists()); }
1548 
1549  inline auto get_if_exists(bool verbose = false) noexcept
1550  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1551 
1552  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1553  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
1554 
1555  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1556  void set_if_exists(T val, bool verbose = false) noexcept
1557  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
1558 }
1559 
1560 namespace host_idtr_base
1561 {
1562  constexpr const auto addr = 0x0000000000006C0EUL;
1563  constexpr const auto name = "host_idtr_base";
1564 
1565  inline bool exists() noexcept
1566  { return true; }
1567 
1568  inline auto get()
1569  { return get_vmcs_field(addr, name, exists()); }
1570 
1571  inline auto get_if_exists(bool verbose = false) noexcept
1572  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1573 
1574  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1575  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
1576 
1577  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1578  void set_if_exists(T val, bool verbose = false) noexcept
1579  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
1580 }
1581 
1582 namespace host_ia32_sysenter_esp
1583 {
1584  constexpr const auto addr = 0x0000000000006C10UL;
1585  constexpr const auto name = "host_ia32_sysenter_esp";
1586 
1587  inline bool exists() noexcept
1588  { return true; }
1589 
1590  inline auto get()
1591  { return get_vmcs_field(addr, name, exists()); }
1592 
1593  inline auto get_if_exists(bool verbose = false) noexcept
1594  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1595 
1596  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1597  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
1598 
1599  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1600  void set_if_exists(T val, bool verbose = false) noexcept
1601  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
1602 }
1603 
1604 namespace host_ia32_sysenter_eip
1605 {
1606  constexpr const auto addr = 0x0000000000006C12UL;
1607  constexpr const auto name = "host_ia32_sysenter_eip";
1608 
1609  inline bool exists() noexcept
1610  { return true; }
1611 
1612  inline auto get()
1613  { return get_vmcs_field(addr, name, exists()); }
1614 
1615  inline auto get_if_exists(bool verbose = false) noexcept
1616  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1617 
1618  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1619  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
1620 
1621  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1622  void set_if_exists(T val, bool verbose = false) noexcept
1623  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
1624 }
1625 
1626 namespace host_rsp
1627 {
1628  constexpr const auto addr = 0x0000000000006C14UL;
1629  constexpr const auto name = "host_rsp";
1630 
1631  inline bool exists() noexcept
1632  { return true; }
1633 
1634  inline auto get()
1635  { return get_vmcs_field(addr, name, exists()); }
1636 
1637  inline auto get_if_exists(bool verbose = false) noexcept
1638  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1639 
1640  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1641  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
1642 
1643  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1644  void set_if_exists(T val, bool verbose = false) noexcept
1645  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
1646 }
1647 
1648 namespace host_rip
1649 {
1650  constexpr const auto addr = 0x0000000000006C16UL;
1651  constexpr const auto name = "host_rip";
1652 
1653  inline bool exists() noexcept
1654  { return true; }
1655 
1656  inline auto get()
1657  { return get_vmcs_field(addr, name, exists()); }
1658 
1659  inline auto get_if_exists(bool verbose = false) noexcept
1660  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1661 
1662  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1663  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
1664 
1665  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1666  void set_if_exists(T val, bool verbose = false) noexcept
1667  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
1668 }
1669 
1670 }
1671 }
1672 
1673 // *INDENT-ON*
1674 
1675 #endif
auto get_vmcs_field_if_exists(T addr, const char *name, bool verbose, bool exists)
void set_if_exists(T val, bool verbose=false) noexcept
void set_if_exists(T val, bool verbose=false) noexcept
void set_if_exists(T val, bool verbose=false) noexcept
void set_if_exists(T val, bool verbose=false) noexcept
void set_if_exists(T val, bool verbose=false) noexcept
auto set_vmcs_field_if_exists(V val, A addr, const char *name, bool verbose, bool exists) noexcept
void uint64_t uint64_t uint64_t *rdx noexcept
auto is_bit_cleared(T t, B b) noexcept
Definition: bitmanip.h:54
void set_if_exists(T val, bool verbose=false) noexcept
auto clear_bit(T t, B b) noexcept
Definition: bitmanip.h:36
auto set_vmcs_field(V val, A addr, const char *name, bool exists)
auto set_bit(T t, B b) noexcept
Definition: bitmanip.h:30
void set_if_exists(T val, bool verbose=false) noexcept
auto get_vmcs_field(T addr, const char *name, bool exists)
void set_if_exists(T val, bool verbose=false) noexcept
void set_if_exists(T val, bool verbose=false) noexcept
void set_if_exists(T val, bool verbose=false) noexcept
auto is_bit_set(T t, B b) noexcept
Definition: bitmanip.h:48