vmcs_intel_x64_64bit_guest_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_64BIT_GUEST_STATE_FIELDS_H
24 #define VMCS_INTEL_X64_64BIT_GUEST_STATE_FIELDS_H
25 
26 #include <bitmanip.h>
27 #include <type_traits>
28 #include <vmcs/vmcs_intel_x64.h>
29 
31 #include <intrinsics/cpuid_x64.h>
32 
39 
40 // *INDENT-OFF*
41 
42 namespace intel_x64
43 {
44 namespace vmcs
45 {
46 
47 namespace vmcs_link_pointer
48 {
49  constexpr const auto addr = 0x0000000000002800UL;
50  constexpr const auto name = "vmcs_link_pointer";
51 
52  inline auto exists()
53  { return true; }
54 
55  inline auto get()
56  { return get_vmcs_field(addr, name, exists()); }
57 
58  inline auto get_if_exists(bool verbose = false) noexcept
59  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
60 
61  template <class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
62  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
63 
64  template <class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
65  void set_if_exists(T val, bool verbose = false) noexcept
66  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
67 }
68 
69 namespace guest_ia32_debugctl
70 {
71  constexpr const auto addr = 0x0000000000002802UL;
72  constexpr const auto name = "guest_ia32_debugctl";
73 
74  inline auto exists()
75  { return true; }
76 
77  inline auto get()
78  { return get_vmcs_field(addr, name, exists()); }
79 
80  inline auto get_if_exists(bool verbose = false) noexcept
81  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
82 
83  template <class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
84  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
85 
86  template <class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
87  void set_if_exists(T val, bool verbose = false) noexcept
88  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
89 
90  namespace lbr
91  {
92  constexpr const auto mask = 0x0000000000000001UL;
93  constexpr const auto from = 0;
94  constexpr const auto name = "lbr";
95 
96  inline auto is_enabled()
97  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
98 
99  inline auto is_enabled_if_exists(bool verbose = false) noexcept
100  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
101 
102  inline auto is_disabled()
103  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
104 
105  inline auto is_disabled_if_exists(bool verbose = false) noexcept
106  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
107 
108  inline void enable()
109  {
110  auto&& field = get_vmcs_field(addr, name, exists());
111  set_vmcs_field(set_bit(field, from), addr, name, exists());
112  }
113 
114  inline void enable_if_exists(bool verbose = false) noexcept
115  {
116  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
117  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
118  }
119 
120  inline void disable()
121  {
122  auto&& field = get_vmcs_field(addr, name, exists());
123  set_vmcs_field(clear_bit(field, from), addr, name, exists());
124  }
125 
126  inline void disable_if_exists(bool verbose = false) noexcept
127  {
128  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
129  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
130  }
131  }
132 
133  namespace btf
134  {
135  constexpr const auto mask = 0x0000000000000002UL;
136  constexpr const auto from = 1;
137  constexpr const auto name = "btf";
138 
139  inline auto is_enabled()
140  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
141 
142  inline auto is_enabled_if_exists(bool verbose = false) noexcept
143  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
144 
145  inline auto is_disabled()
146  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
147 
148  inline auto is_disabled_if_exists(bool verbose = false) noexcept
149  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
150 
151  inline void enable()
152  {
153  auto&& field = get_vmcs_field(addr, name, exists());
154  set_vmcs_field(set_bit(field, from), addr, name, exists());
155  }
156 
157  inline void enable_if_exists(bool verbose = false) noexcept
158  {
159  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
160  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
161  }
162 
163  inline void disable()
164  {
165  auto&& field = get_vmcs_field(addr, name, exists());
166  set_vmcs_field(clear_bit(field, from), addr, name, exists());
167  }
168 
169  inline void disable_if_exists(bool verbose = false) noexcept
170  {
171  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
172  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
173  }
174  }
175 
176  namespace tr
177  {
178  constexpr const auto mask = 0x0000000000000040UL;
179  constexpr const auto from = 6;
180  constexpr const auto name = "tr";
181 
182  inline auto is_enabled()
183  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
184 
185  inline auto is_enabled_if_exists(bool verbose = false) noexcept
186  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
187 
188  inline auto is_disabled()
189  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
190 
191  inline auto is_disabled_if_exists(bool verbose = false) noexcept
192  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
193 
194  inline void enable()
195  {
196  auto&& field = get_vmcs_field(addr, name, exists());
197  set_vmcs_field(set_bit(field, from), addr, name, exists());
198  }
199 
200  inline void enable_if_exists(bool verbose = false) noexcept
201  {
202  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
203  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
204  }
205 
206  inline void disable()
207  {
208  auto&& field = get_vmcs_field(addr, name, exists());
209  set_vmcs_field(clear_bit(field, from), addr, name, exists());
210  }
211 
212  inline void disable_if_exists(bool verbose = false) noexcept
213  {
214  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
215  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
216  }
217  }
218 
219  namespace bts
220  {
221  constexpr const auto mask = 0x0000000000000080UL;
222  constexpr const auto from = 7;
223  constexpr const auto name = "bts";
224 
225  inline auto is_enabled()
226  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
227 
228  inline auto is_enabled_if_exists(bool verbose = false) noexcept
229  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
230 
231  inline auto is_disabled()
232  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
233 
234  inline auto is_disabled_if_exists(bool verbose = false) noexcept
235  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
236 
237  inline void enable()
238  {
239  auto&& field = get_vmcs_field(addr, name, exists());
240  set_vmcs_field(set_bit(field, from), addr, name, exists());
241  }
242 
243  inline void enable_if_exists(bool verbose = false) noexcept
244  {
245  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
246  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
247  }
248 
249  inline void disable()
250  {
251  auto&& field = get_vmcs_field(addr, name, exists());
252  set_vmcs_field(clear_bit(field, from), addr, name, exists());
253  }
254 
255  inline void disable_if_exists(bool verbose = false) noexcept
256  {
257  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
258  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
259  }
260  }
261 
262  namespace btint
263  {
264  constexpr const auto mask = 0x0000000000000100UL;
265  constexpr const auto from = 8;
266  constexpr const auto name = "btint";
267 
268  inline auto is_enabled()
269  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
270 
271  inline auto is_enabled_if_exists(bool verbose = false) noexcept
272  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
273 
274  inline auto is_disabled()
275  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
276 
277  inline auto is_disabled_if_exists(bool verbose = false) noexcept
278  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
279 
280  inline void enable()
281  {
282  auto&& field = get_vmcs_field(addr, name, exists());
283  set_vmcs_field(set_bit(field, from), addr, name, exists());
284  }
285 
286  inline void enable_if_exists(bool verbose = false) noexcept
287  {
288  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
289  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
290  }
291 
292  inline void disable()
293  {
294  auto&& field = get_vmcs_field(addr, name, exists());
295  set_vmcs_field(clear_bit(field, from), addr, name, exists());
296  }
297 
298  inline void disable_if_exists(bool verbose = false) noexcept
299  {
300  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
301  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
302  }
303  }
304 
305  namespace bt_off_os
306  {
307  constexpr const auto mask = 0x0000000000000200UL;
308  constexpr const auto from = 9;
309  constexpr const auto name = "bt_off_os";
310 
311  inline auto is_enabled()
312  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
313 
314  inline auto is_enabled_if_exists(bool verbose = false) noexcept
315  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
316 
317  inline auto is_disabled()
318  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
319 
320  inline auto is_disabled_if_exists(bool verbose = false) noexcept
321  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
322 
323  inline void enable()
324  {
325  auto&& field = get_vmcs_field(addr, name, exists());
326  set_vmcs_field(set_bit(field, from), addr, name, exists());
327  }
328 
329  inline void enable_if_exists(bool verbose = false) noexcept
330  {
331  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
332  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
333  }
334 
335  inline void disable()
336  {
337  auto&& field = get_vmcs_field(addr, name, exists());
338  set_vmcs_field(clear_bit(field, from), addr, name, exists());
339  }
340 
341  inline void disable_if_exists(bool verbose = false) noexcept
342  {
343  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
344  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
345  }
346  }
347 
348  namespace bt_off_user
349  {
350  constexpr const auto mask = 0x0000000000000400UL;
351  constexpr const auto from = 10;
352  constexpr const auto name = "bt_off_user";
353 
354  inline auto is_enabled()
355  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
356 
357  inline auto is_enabled_if_exists(bool verbose = false) noexcept
358  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
359 
360  inline auto is_disabled()
361  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
362 
363  inline auto is_disabled_if_exists(bool verbose = false) noexcept
364  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
365 
366  inline void enable()
367  {
368  auto&& field = get_vmcs_field(addr, name, exists());
369  set_vmcs_field(set_bit(field, from), addr, name, exists());
370  }
371 
372  inline void enable_if_exists(bool verbose = false) noexcept
373  {
374  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
375  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
376  }
377 
378  inline void disable()
379  {
380  auto&& field = get_vmcs_field(addr, name, exists());
381  set_vmcs_field(clear_bit(field, from), addr, name, exists());
382  }
383 
384  inline void disable_if_exists(bool verbose = false) noexcept
385  {
386  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
387  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
388  }
389  }
390 
391  namespace freeze_lbrs_on_pmi
392  {
393  constexpr const auto mask = 0x0000000000000800UL;
394  constexpr const auto from = 11;
395  constexpr const auto name = "freeze_lbrs_on_pmi";
396 
397  inline auto is_enabled()
398  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
399 
400  inline auto is_enabled_if_exists(bool verbose = false) noexcept
401  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
402 
403  inline auto is_disabled()
404  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
405 
406  inline auto is_disabled_if_exists(bool verbose = false) noexcept
407  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
408 
409  inline void enable()
410  {
411  auto&& field = get_vmcs_field(addr, name, exists());
412  set_vmcs_field(set_bit(field, from), addr, name, exists());
413  }
414 
415  inline void enable_if_exists(bool verbose = false) noexcept
416  {
417  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
418  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
419  }
420 
421  inline void disable()
422  {
423  auto&& field = get_vmcs_field(addr, name, exists());
424  set_vmcs_field(clear_bit(field, from), addr, name, exists());
425  }
426 
427  inline void disable_if_exists(bool verbose = false) noexcept
428  {
429  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
430  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
431  }
432  }
433  namespace freeze_perfmon_on_pmi
434  {
435  constexpr const auto mask = 0x0000000000001000UL;
436  constexpr const auto from = 12;
437  constexpr const auto name = "freeze_perfmon_on_pmi";
438 
439  inline auto is_enabled()
440  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
441 
442  inline auto is_enabled_if_exists(bool verbose = false) noexcept
443  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
444 
445  inline auto is_disabled()
446  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
447 
448  inline auto is_disabled_if_exists(bool verbose = false) noexcept
449  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
450 
451  inline void enable()
452  {
453  auto&& field = get_vmcs_field(addr, name, exists());
454  set_vmcs_field(set_bit(field, from), addr, name, exists());
455  }
456 
457  inline void enable_if_exists(bool verbose = false) noexcept
458  {
459  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
460  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
461  }
462 
463  inline void disable()
464  {
465  auto&& field = get_vmcs_field(addr, name, exists());
466  set_vmcs_field(clear_bit(field, from), addr, name, exists());
467  }
468 
469  inline void disable_if_exists(bool verbose = false) noexcept
470  {
471  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
472  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
473  }
474  }
475 
476  namespace enable_uncore_pmi
477  {
478  constexpr const auto mask = 0x0000000000002000UL;
479  constexpr const auto from = 13;
480  constexpr const auto name = "enable_uncore_pmi";
481 
482  inline auto is_enabled()
483  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
484 
485  inline auto is_enabled_if_exists(bool verbose = false) noexcept
486  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
487 
488  inline auto is_disabled()
489  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
490 
491  inline auto is_disabled_if_exists(bool verbose = false) noexcept
492  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
493 
494  inline void enable()
495  {
496  auto&& field = get_vmcs_field(addr, name, exists());
497  set_vmcs_field(set_bit(field, from), addr, name, exists());
498  }
499 
500  inline void enable_if_exists(bool verbose = false) noexcept
501  {
502  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
503  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
504  }
505 
506  inline void disable()
507  {
508  auto&& field = get_vmcs_field(addr, name, exists());
509  set_vmcs_field(clear_bit(field, from), addr, name, exists());
510  }
511 
512  inline void disable_if_exists(bool verbose = false) noexcept
513  {
514  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
515  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
516  }
517  }
518 
519  namespace freeze_while_smm
520  {
521  constexpr const auto mask = 0x0000000000004000UL;
522  constexpr const auto from = 14;
523  constexpr const auto name = "freeze_while_smm";
524 
525  inline auto is_enabled()
526  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
527 
528  inline auto is_enabled_if_exists(bool verbose = false) noexcept
529  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
530 
531  inline auto is_disabled()
532  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
533 
534  inline auto is_disabled_if_exists(bool verbose = false) noexcept
535  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
536 
537  inline void enable()
538  {
539  auto&& field = get_vmcs_field(addr, name, exists());
540  set_vmcs_field(set_bit(field, from), addr, name, exists());
541  }
542 
543  inline void enable_if_exists(bool verbose = false) noexcept
544  {
545  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
546  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
547  }
548 
549  inline void disable()
550  {
551  auto&& field = get_vmcs_field(addr, name, exists());
552  set_vmcs_field(clear_bit(field, from), addr, name, exists());
553  }
554 
555  inline void disable_if_exists(bool verbose = false) noexcept
556  {
557  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
558  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
559  }
560  }
561 
562  namespace rtm_debug
563  {
564  constexpr const auto mask = 0x0000000000008000UL;
565  constexpr const auto from = 15;
566  constexpr const auto name = "rtm_debug";
567 
568  inline auto is_enabled()
569  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
570 
571  inline auto is_enabled_if_exists(bool verbose = false) noexcept
572  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
573 
574  inline auto is_disabled()
575  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
576 
577  inline auto is_disabled_if_exists(bool verbose = false) noexcept
578  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
579 
580  inline void enable()
581  {
582  auto&& field = get_vmcs_field(addr, name, exists());
583  set_vmcs_field(set_bit(field, from), addr, name, exists());
584  }
585 
586  inline void enable_if_exists(bool verbose = false) noexcept
587  {
588  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
589  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
590  }
591 
592  inline void disable()
593  {
594  auto&& field = get_vmcs_field(addr, name, exists());
595  set_vmcs_field(clear_bit(field, from), addr, name, exists());
596  }
597 
598  inline void disable_if_exists(bool verbose = false) noexcept
599  {
600  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
601  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
602  }
603  }
604 
605  namespace reserved
606  {
607  constexpr const auto mask = 0xFFFFFFFFFFFF003CUL;
608  constexpr const auto from = 0;
609  constexpr const auto name = "reserved";
610 
611  inline auto get()
612  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
613 
614  inline auto get_if_exists(bool verbose = false) noexcept
615  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
616 
617  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
618  void set(T val)
619  {
620  auto&& field = get_vmcs_field(addr, name, exists());
621  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
622  }
623 
624  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
625  void set_if_exists(T val, bool verbose = false) noexcept
626  {
627  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
628  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
629  }
630  }
631 }
632 
633 namespace guest_ia32_pat
634 {
635  constexpr const auto addr = 0x0000000000002804UL;
636  constexpr const auto name = "guest_ia32_pat";
637 
638  inline auto exists() noexcept
639  {
642  }
643 
644  inline auto get()
645  { return get_vmcs_field(addr, name, exists()); }
646 
647  inline auto get_if_exists(bool verbose = false) noexcept
648  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
649 
650  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
651  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
652 
653  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
654  void set_if_exists(T val, bool verbose = false) noexcept
655  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
656 
657  namespace pa0
658  {
659  constexpr const auto mask = 0x00000000000000FFUL;
660  constexpr const auto from = 0;
661  constexpr const auto name = "pa0";
662 
663  inline auto get()
664  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
665 
666  inline auto get_if_exists(bool verbose = false) noexcept
667  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
668 
669  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
670  void set(T val)
671  {
672  auto&& field = get_vmcs_field(addr, name, exists());
673  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
674  }
675 
676  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
677  void set_if_exists(T val, bool verbose = false) noexcept
678  {
679  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
680  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
681  }
682 
683  namespace memory_type
684  {
685  constexpr const auto mask = 0x0000000000000007UL;
686  constexpr const auto from = 0;
687  constexpr const auto name = "memory_type";
688 
689  inline auto get()
690  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
691 
692  inline auto get_if_exists(bool verbose = false) noexcept
693  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
694 
695  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
696  void set(T val)
697  {
698  auto&& field = get_vmcs_field(addr, name, exists());
699  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
700  }
701 
702  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
703  void set_if_exists(T val, bool verbose = false) noexcept
704  {
705  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
706  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
707  }
708  }
709 
710  namespace reserved
711  {
712  constexpr const auto mask = 0x00000000000000F8UL;
713  constexpr const auto from = 3;
714  constexpr const auto name = "reserved";
715 
716  inline auto get()
717  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
718 
719  inline auto get_if_exists(bool verbose = false) noexcept
720  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
721 
722  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
723  void set(T val)
724  {
725  auto&& field = get_vmcs_field(addr, name, exists());
726  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
727  }
728 
729  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
730  void set_if_exists(T val, bool verbose = false) noexcept
731  {
732  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
733  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
734  }
735  }
736 
737  }
738 
739  namespace pa1
740  {
741  constexpr const auto mask = 0x000000000000FF00UL;
742  constexpr const auto from = 8;
743  constexpr const auto name = "pa1";
744 
745  inline auto get()
746  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
747 
748  inline auto get_if_exists(bool verbose = false) noexcept
749  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
750 
751  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
752  void set(T val)
753  {
754  auto&& field = get_vmcs_field(addr, name, exists());
755  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
756  }
757 
758  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
759  void set_if_exists(T val, bool verbose = false) noexcept
760  {
761  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
762  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
763  }
764 
765  namespace memory_type
766  {
767  constexpr const auto mask = 0x0000000000000700UL;
768  constexpr const auto from = 8;
769  constexpr const auto name = "memory_type";
770 
771  inline auto get()
772  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
773 
774  inline auto get_if_exists(bool verbose = false) noexcept
775  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
776 
777  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
778  void set(T val)
779  {
780  auto&& field = get_vmcs_field(addr, name, exists());
781  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
782  }
783 
784  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
785  void set_if_exists(T val, bool verbose = false) noexcept
786  {
787  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
788  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
789  }
790  }
791 
792  namespace reserved
793  {
794  constexpr const auto mask = 0x000000000000F800UL;
795  constexpr const auto from = 11;
796  constexpr const auto name = "reserved";
797 
798  inline auto get()
799  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
800 
801  inline auto get_if_exists(bool verbose = false) noexcept
802  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
803 
804  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
805  void set(T val)
806  {
807  auto&& field = get_vmcs_field(addr, name, exists());
808  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
809  }
810 
811  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
812  void set_if_exists(T val, bool verbose = false) noexcept
813  {
814  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
815  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
816  }
817  }
818  }
819 
820  namespace pa2
821  {
822  constexpr const auto mask = 0x0000000000FF0000UL;
823  constexpr const auto from = 16;
824  constexpr const auto name = "pa2";
825 
826  inline auto get()
827  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
828 
829  inline auto get_if_exists(bool verbose = false) noexcept
830  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
831 
832  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
833  void set(T val)
834  {
835  auto&& field = get_vmcs_field(addr, name, exists());
836  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
837  }
838 
839  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
840  void set_if_exists(T val, bool verbose = false) noexcept
841  {
842  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
843  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
844  }
845 
846  namespace memory_type
847  {
848  constexpr const auto mask = 0x0000000000070000UL;
849  constexpr const auto from = 16;
850  constexpr const auto name = "memory_type";
851 
852  inline auto get()
853  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
854 
855  inline auto get_if_exists(bool verbose = false) noexcept
856  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
857 
858  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
859  void set(T val)
860  {
861  auto&& field = get_vmcs_field(addr, name, exists());
862  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
863  }
864 
865  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
866  void set_if_exists(T val, bool verbose = false) noexcept
867  {
868  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
869  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
870  }
871  }
872 
873  namespace reserved
874  {
875  constexpr const auto mask = 0x0000000000F80000UL;
876  constexpr const auto from = 19;
877  constexpr const auto name = "reserved";
878 
879  inline auto get()
880  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
881 
882  inline auto get_if_exists(bool verbose = false) noexcept
883  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
884 
885  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
886  void set(T val)
887  {
888  auto&& field = get_vmcs_field(addr, name, exists());
889  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
890  }
891 
892  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
893  void set_if_exists(T val, bool verbose = false) noexcept
894  {
895  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
896  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
897  }
898  }
899  }
900 
901  namespace pa3
902  {
903  constexpr const auto mask = 0x00000000FF000000UL;
904  constexpr const auto from = 24;
905  constexpr const auto name = "pa3";
906 
907  inline auto get()
908  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
909 
910  inline auto get_if_exists(bool verbose = false) noexcept
911  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
912 
913  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
914  void set(T val)
915  {
916  auto&& field = get_vmcs_field(addr, name, exists());
917  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
918  }
919 
920  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
921  void set_if_exists(T val, bool verbose = false) noexcept
922  {
923  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
924  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
925  }
926 
927  namespace memory_type
928  {
929  constexpr const auto mask = 0x0000000007000000UL;
930  constexpr const auto from = 24;
931  constexpr const auto name = "memory_type";
932 
933  inline auto get()
934  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
935 
936  inline auto get_if_exists(bool verbose = false) noexcept
937  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
938 
939  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
940  void set(T val)
941  {
942  auto&& field = get_vmcs_field(addr, name, exists());
943  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
944  }
945 
946  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
947  void set_if_exists(T val, bool verbose = false) noexcept
948  {
949  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
950  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
951  }
952  }
953 
954  namespace reserved
955  {
956  constexpr const auto mask = 0x00000000F8000000UL;
957  constexpr const auto from = 27;
958  constexpr const auto name = "reserved";
959 
960  inline auto get()
961  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
962 
963  inline auto get_if_exists(bool verbose = false) noexcept
964  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
965 
966  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
967  void set(T val)
968  {
969  auto&& field = get_vmcs_field(addr, name, exists());
970  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
971  }
972 
973  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
974  void set_if_exists(T val, bool verbose = false) noexcept
975  {
976  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
977  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
978  }
979  }
980  }
981 
982  namespace pa4
983  {
984  constexpr const auto mask = 0x000000FF00000000UL;
985  constexpr const auto from = 32;
986  constexpr const auto name = "pa4";
987 
988  inline auto get()
989  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
990 
991  inline auto get_if_exists(bool verbose = false) noexcept
992  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
993 
994  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
995  void set(T val)
996  {
997  auto&& field = get_vmcs_field(addr, name, exists());
998  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
999  }
1000 
1001  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1002  void set_if_exists(T val, bool verbose = false) noexcept
1003  {
1004  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1005  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
1006  }
1007 
1008  namespace memory_type
1009  {
1010  constexpr const auto mask = 0x0000000700000000UL;
1011  constexpr const auto from = 32;
1012  constexpr const auto name = "memory_type";
1013 
1014  inline auto get()
1015  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1016 
1017  inline auto get_if_exists(bool verbose = false) noexcept
1018  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1019 
1020  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1021  void set(T val)
1022  {
1023  auto&& field = get_vmcs_field(addr, name, exists());
1024  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
1025  }
1026 
1027  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1028  void set_if_exists(T val, bool verbose = false) noexcept
1029  {
1030  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1031  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
1032  }
1033  }
1034 
1035  namespace reserved
1036  {
1037  constexpr const auto mask = 0x000000F800000000UL;
1038  constexpr const auto from = 35;
1039  constexpr const auto name = "reserved";
1040 
1041  inline auto get()
1042  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1043 
1044  inline auto get_if_exists(bool verbose = false) noexcept
1045  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1046 
1047  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1048  void set(T val)
1049  {
1050  auto&& field = get_vmcs_field(addr, name, exists());
1051  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
1052  }
1053 
1054  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1055  void set_if_exists(T val, bool verbose = false) noexcept
1056  {
1057  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1058  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
1059  }
1060  }
1061  }
1062 
1063  namespace pa5
1064  {
1065  constexpr const auto mask = 0x0000FF0000000000UL;
1066  constexpr const auto from = 40;
1067  constexpr const auto name = "pa5";
1068 
1069  inline auto get()
1070  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1071 
1072  inline auto get_if_exists(bool verbose = false) noexcept
1073  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1074 
1075  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1076  void set(T val)
1077  {
1078  auto&& field = get_vmcs_field(addr, name, exists());
1079  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
1080  }
1081 
1082  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1083  void set_if_exists(T val, bool verbose = false) noexcept
1084  {
1085  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1086  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
1087  }
1088 
1089  namespace memory_type
1090  {
1091  constexpr const auto mask = 0x0000070000000000UL;
1092  constexpr const auto from = 40;
1093  constexpr const auto name = "memory_type";
1094 
1095  inline auto get()
1096  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1097 
1098  inline auto get_if_exists(bool verbose = false) noexcept
1099  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1100 
1101  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1102  void set(T val)
1103  {
1104  auto&& field = get_vmcs_field(addr, name, exists());
1105  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
1106  }
1107 
1108  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1109  void set_if_exists(T val, bool verbose = false) noexcept
1110  {
1111  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1112  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
1113  }
1114  }
1115 
1116  namespace reserved
1117  {
1118  constexpr const auto mask = 0x0000F80000000000UL;
1119  constexpr const auto from = 43;
1120  constexpr const auto name = "reserved";
1121 
1122  inline auto get()
1123  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1124 
1125  inline auto get_if_exists(bool verbose = false) noexcept
1126  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1127 
1128  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1129  void set(T val)
1130  {
1131  auto&& field = get_vmcs_field(addr, name, exists());
1132  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
1133  }
1134 
1135  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1136  void set_if_exists(T val, bool verbose = false) noexcept
1137  {
1138  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1139  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
1140  }
1141  }
1142  }
1143 
1144  namespace pa6
1145  {
1146  constexpr const auto mask = 0x00FF000000000000UL;
1147  constexpr const auto from = 48;
1148  constexpr const auto name = "pa6";
1149 
1150  inline auto get()
1151  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1152 
1153  inline auto get_if_exists(bool verbose = false) noexcept
1154  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1155 
1156  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1157  void set(T val)
1158  {
1159  auto&& field = get_vmcs_field(addr, name, exists());
1160  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
1161  }
1162 
1163  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1164  void set_if_exists(T val, bool verbose = false) noexcept
1165  {
1166  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1167  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
1168  }
1169 
1170  namespace memory_type
1171  {
1172  constexpr const auto mask = 0x0007000000000000UL;
1173  constexpr const auto from = 48;
1174  constexpr const auto name = "memory_type";
1175 
1176  inline auto get()
1177  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1178 
1179  inline auto get_if_exists(bool verbose = false) noexcept
1180  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1181 
1182  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1183  void set(T val)
1184  {
1185  auto&& field = get_vmcs_field(addr, name, exists());
1186  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
1187  }
1188 
1189  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1190  void set_if_exists(T val, bool verbose = false) noexcept
1191  {
1192  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1193  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
1194  }
1195  }
1196 
1197  namespace reserved
1198  {
1199  constexpr const auto mask = 0x00F8000000000000UL;
1200  constexpr const auto from = 51;
1201  constexpr const auto name = "reserved";
1202 
1203  inline auto get()
1204  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1205 
1206  inline auto get_if_exists(bool verbose = false) noexcept
1207  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1208 
1209  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1210  void set(T val)
1211  {
1212  auto&& field = get_vmcs_field(addr, name, exists());
1213  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
1214  }
1215 
1216  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1217  void set_if_exists(T val, bool verbose = false) noexcept
1218  {
1219  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1220  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
1221  }
1222  }
1223  }
1224 
1225  namespace pa7
1226  {
1227  constexpr const auto mask = 0xFF00000000000000UL;
1228  constexpr const auto from = 56;
1229  constexpr const auto name = "pa7";
1230 
1231  inline auto get()
1232  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1233 
1234  inline auto get_if_exists(bool verbose = false) noexcept
1235  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1236 
1237  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1238  void set(T val)
1239  {
1240  auto&& field = get_vmcs_field(addr, name, exists());
1241  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
1242  }
1243 
1244  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1245  void set_if_exists(T val, bool verbose = false) noexcept
1246  {
1247  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1248  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
1249  }
1250 
1251  namespace memory_type
1252  {
1253  constexpr const auto mask = 0x0700000000000000UL;
1254  constexpr const auto from = 56;
1255  constexpr const auto name = "memory_type";
1256 
1257  inline auto get()
1258  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1259 
1260  inline auto get_if_exists(bool verbose = false) noexcept
1261  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1262 
1263  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1264  void set(T val)
1265  {
1266  auto&& field = get_vmcs_field(addr, name, exists());
1267  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
1268  }
1269 
1270  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1271  void set_if_exists(T val, bool verbose = false) noexcept
1272  {
1273  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1274  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
1275  }
1276  }
1277 
1278  namespace reserved
1279  {
1280  constexpr const auto mask = 0xF800000000000000UL;
1281  constexpr const auto from = 59;
1282  constexpr const auto name = "reserved";
1283 
1284  inline auto get()
1285  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1286 
1287  inline auto get_if_exists(bool verbose = false) noexcept
1288  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1289 
1290  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1291  void set(T val)
1292  {
1293  auto&& field = get_vmcs_field(addr, name, exists());
1294  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
1295  }
1296 
1297  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1298  void set_if_exists(T val, bool verbose = false) noexcept
1299  {
1300  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1301  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
1302  }
1303  }
1304  }
1305 }
1306 
1307 namespace guest_ia32_efer
1308 {
1309  constexpr const auto addr = 0x0000000000002806UL;
1310  constexpr const auto name = "guest_ia32_efer";
1311 
1312  inline auto exists() noexcept
1313  {
1316  }
1317 
1318  inline auto get()
1319  { return get_vmcs_field(addr, name, exists()); }
1320 
1321  inline auto get_if_exists(bool verbose = false) noexcept
1322  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1323 
1324  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1325  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
1326 
1327  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1328  void set_if_exists(T val, bool verbose = false) noexcept
1329  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
1330 
1331  namespace sce
1332  {
1333  constexpr const auto mask = 0x0000000000000001UL;
1334  constexpr const auto from = 0;
1335  constexpr const auto name = "sce";
1336 
1337  inline auto is_enabled()
1338  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1339 
1340  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1341  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1342 
1343  inline auto is_disabled()
1344  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1345 
1346  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1347  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1348 
1349  inline void enable()
1350  {
1351  auto&& field = get_vmcs_field(addr, name, exists());
1352  set_vmcs_field(set_bit(field, from), addr, name, exists());
1353  }
1354 
1355  inline void enable_if_exists(bool verbose = false) noexcept
1356  {
1357  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1358  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1359  }
1360 
1361  inline void disable()
1362  {
1363  auto&& field = get_vmcs_field(addr, name, exists());
1364  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1365  }
1366 
1367  inline void disable_if_exists(bool verbose = false) noexcept
1368  {
1369  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1370  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1371  }
1372  }
1373 
1374  namespace lme
1375  {
1376  constexpr const auto mask = 0x0000000000000100UL;
1377  constexpr const auto from = 8;
1378  constexpr const auto name = "lme";
1379 
1380  inline auto is_enabled()
1381  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1382 
1383  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1384  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1385 
1386  inline auto is_disabled()
1387  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1388 
1389  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1390  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1391 
1392  inline void enable()
1393  {
1394  auto&& field = get_vmcs_field(addr, name, exists());
1395  set_vmcs_field(set_bit(field, from), addr, name, exists());
1396  }
1397 
1398  inline void enable_if_exists(bool verbose = false) noexcept
1399  {
1400  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1401  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1402  }
1403 
1404  inline void disable()
1405  {
1406  auto&& field = get_vmcs_field(addr, name, exists());
1407  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1408  }
1409 
1410  inline void disable_if_exists(bool verbose = false) noexcept
1411  {
1412  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1413  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1414  }
1415  }
1416 
1417  namespace lma
1418  {
1419  constexpr const auto mask = 0x0000000000000400UL;
1420  constexpr const auto from = 10;
1421  constexpr const auto name = "lma";
1422 
1423  inline auto is_enabled()
1424  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1425 
1426  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1427  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1428 
1429  inline auto is_disabled()
1430  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1431 
1432  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1433  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1434 
1435  inline void enable()
1436  {
1437  auto&& field = get_vmcs_field(addr, name, exists());
1438  set_vmcs_field(set_bit(field, from), addr, name, exists());
1439  }
1440 
1441  inline void enable_if_exists(bool verbose = false) noexcept
1442  {
1443  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1444  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1445  }
1446 
1447  inline void disable()
1448  {
1449  auto&& field = get_vmcs_field(addr, name, exists());
1450  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1451  }
1452 
1453  inline void disable_if_exists(bool verbose = false) noexcept
1454  {
1455  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1456  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1457  }
1458  }
1459 
1460  namespace nxe
1461  {
1462  constexpr const auto mask = 0x0000000000000800UL;
1463  constexpr const auto from = 11;
1464  constexpr const auto name = "nxe";
1465 
1466  inline auto is_enabled()
1467  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1468 
1469  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1470  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1471 
1472  inline auto is_disabled()
1473  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1474 
1475  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1476  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1477 
1478  inline void enable()
1479  {
1480  auto&& field = get_vmcs_field(addr, name, exists());
1481  set_vmcs_field(set_bit(field, from), addr, name, exists());
1482  }
1483 
1484  inline void enable_if_exists(bool verbose = false) noexcept
1485  {
1486  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1487  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1488  }
1489 
1490  inline void disable()
1491  {
1492  auto&& field = get_vmcs_field(addr, name, exists());
1493  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1494  }
1495 
1496  inline void disable_if_exists(bool verbose = false) noexcept
1497  {
1498  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1499  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1500  }
1501  }
1502 
1503  namespace reserved
1504  {
1505  constexpr const auto mask = 0xFFFFFFFFFFFFF2FEUL;
1506  constexpr const auto from = 0;
1507  constexpr const auto name = "reserved";
1508 
1509  inline auto get()
1510  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1511 
1512  inline auto get_if_exists(bool verbose = false) noexcept
1513  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1514 
1515  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1516  void set(T val)
1517  {
1518  auto&& field = get_vmcs_field(addr, name, exists());
1519  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
1520  }
1521 
1522  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1523  void set_if_exists(T val, bool verbose = false) noexcept
1524  {
1525  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1526  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
1527  }
1528  }
1529 }
1530 
1531 namespace guest_ia32_perf_global_ctrl
1532 {
1533  constexpr const auto addr = 0x0000000000002808UL;
1534  constexpr const auto name = "guest_ia32_perf_global_ctrl";
1535 
1536  inline auto exists() noexcept
1538 
1539  inline auto get()
1540  { return get_vmcs_field(addr, name, exists()); }
1541 
1542  inline auto get_if_exists(bool verbose = false) noexcept
1543  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1544 
1545  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1546  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
1547 
1548  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1549  void set_if_exists(T val, bool verbose = false) noexcept
1550  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
1551 
1552  namespace reserved
1553  {
1554  constexpr const auto mask = 0xFFFFFFF8FFFFFFFCUL;
1555  constexpr const auto from = 0;
1556 
1557  inline auto get()
1558  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
1559 
1560  inline auto get_if_exists(bool verbose = false) noexcept
1561  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
1562 
1563  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1564  void set(T val)
1565  {
1566  auto&& field = get_vmcs_field(addr, name, exists());
1567  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
1568  }
1569 
1570  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1571  void set_if_exists(T val, bool verbose = false) noexcept
1572  {
1573  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1574  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
1575  }
1576  }
1577 }
1578 
1579 namespace guest_pdpte0
1580 {
1581  constexpr const auto addr = 0x000000000000280AUL;
1582  constexpr const auto name = "guest_pdpte0";
1583 
1584  inline auto exists() noexcept
1585  {
1588  }
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  namespace present
1604  {
1605  constexpr const auto mask = 0x0000000000000001UL;
1606  constexpr const auto from = 0;
1607  constexpr const auto name = "present";
1608 
1609  inline auto is_enabled()
1610  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1611 
1612  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1613  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1614 
1615  inline auto is_disabled()
1616  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1617 
1618  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1619  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1620 
1621  inline void enable()
1622  {
1623  auto&& field = get_vmcs_field(addr, name, exists());
1624  set_vmcs_field(set_bit(field, from), addr, name, exists());
1625  }
1626 
1627  inline void enable_if_exists(bool verbose = false) noexcept
1628  {
1629  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1630  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1631  }
1632 
1633  inline void disable()
1634  {
1635  auto&& field = get_vmcs_field(addr, name, exists());
1636  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1637  }
1638 
1639  inline void disable_if_exists(bool verbose = false) noexcept
1640  {
1641  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1642  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1643  }
1644  }
1645 
1646  namespace reserved
1647  {
1648  constexpr const auto from = 0;
1649  constexpr const auto name = "reserved";
1650 
1651  inline auto mask() noexcept
1652  {
1653  auto phys_len = x64::cpuid::addr_size::phys::get();
1654  auto upper = 0xFFFFFFFFFFFFFFFFULL << phys_len;
1655  return (upper | 0x1E6ULL);
1656  }
1657 
1658  inline auto get()
1659  { return get_bits(get_vmcs_field(addr, name, exists()), mask()) >> from; }
1660 
1661  inline auto get_if_exists(bool verbose = false) noexcept
1662  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask()) >> from; }
1663 
1664  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1665  void set(T val)
1666  {
1667  auto&& field = get_vmcs_field(addr, name, exists());
1668  set_vmcs_field(set_bits(field, mask(), (val << from)), addr, name, exists());
1669  }
1670 
1671  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1672  void set_if_exists(T val, bool verbose = false) noexcept
1673  {
1674  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1675  set_vmcs_field_if_exists(set_bits(field, mask(), (val << from)), addr, name, verbose, exists());
1676  }
1677  }
1678 
1679  namespace pwt
1680  {
1681  constexpr const auto mask = 0x0000000000000008UL;
1682  constexpr const auto from = 3;
1683  constexpr const auto name = "pwt";
1684 
1685  inline auto is_enabled()
1686  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1687 
1688  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1689  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1690 
1691  inline auto is_disabled()
1692  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1693 
1694  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1695  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1696 
1697  inline void enable()
1698  {
1699  auto&& field = get_vmcs_field(addr, name, exists());
1700  set_vmcs_field(set_bit(field, from), addr, name, exists());
1701  }
1702 
1703  inline void enable_if_exists(bool verbose = false) noexcept
1704  {
1705  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1706  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1707  }
1708 
1709  inline void disable()
1710  {
1711  auto&& field = get_vmcs_field(addr, name, exists());
1712  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1713  }
1714 
1715  inline void disable_if_exists(bool verbose = false) noexcept
1716  {
1717  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1718  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1719  }
1720  }
1721 
1722  namespace pcd
1723  {
1724  constexpr const auto mask = 0x0000000000000010UL;
1725  constexpr const auto from = 4;
1726  constexpr const auto name = "pcd";
1727 
1728  inline auto is_enabled()
1729  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1730 
1731  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1732  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1733 
1734  inline auto is_disabled()
1735  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1736 
1737  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1738  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1739 
1740  inline void enable()
1741  {
1742  auto&& field = get_vmcs_field(addr, name, exists());
1743  set_vmcs_field(set_bit(field, from), addr, name, exists());
1744  }
1745 
1746  inline void enable_if_exists(bool verbose = false) noexcept
1747  {
1748  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1749  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1750  }
1751 
1752  inline void disable()
1753  {
1754  auto&& field = get_vmcs_field(addr, name, exists());
1755  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1756  }
1757 
1758  inline void disable_if_exists(bool verbose = false) noexcept
1759  {
1760  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1761  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1762  }
1763  }
1764 
1765  namespace page_directory_addr
1766  {
1767  constexpr const auto from = 12;
1768  constexpr const auto name = "page_directory_addr";
1769 
1770  inline auto mask() noexcept
1771  {
1772  auto phys_len = x64::cpuid::addr_size::phys::get();
1773  auto upper = 0xFFFFFFFFFFFFFFFFULL << from;
1774  return (~(0xFFFFFFFFFFFFFFFFULL << phys_len) & upper);
1775  }
1776 
1777  inline auto get()
1778  { return get_bits(get_vmcs_field(addr, name, exists()), mask()) >> from; }
1779 
1780  inline auto get_if_exists(bool verbose = false) noexcept
1781  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask()) >> from; }
1782 
1783  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1784  void set(T val)
1785  {
1786  auto&& field = get_vmcs_field(addr, name, exists());
1787  set_vmcs_field(set_bits(field, mask(), (val << from)), addr, name, exists());
1788  }
1789 
1790  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1791  void set_if_exists(T val, bool verbose = false) noexcept
1792  {
1793  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1794  set_vmcs_field_if_exists(set_bits(field, mask(), (val << from)), addr, name, verbose, exists());
1795  }
1796  }
1797 }
1798 
1799 namespace guest_pdpte1
1800 {
1801  constexpr const auto addr = 0x000000000000280CUL;
1802  constexpr const auto name = "guest_pdpte1";
1803 
1804  inline auto exists() noexcept
1805  {
1808  }
1809 
1810  inline auto get()
1811  { return get_vmcs_field(addr, name, exists()); }
1812 
1813  inline auto get_if_exists(bool verbose = false) noexcept
1814  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
1815 
1816  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1817  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
1818 
1819  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1820  void set_if_exists(T val, bool verbose = false) noexcept
1821  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
1822 
1823  namespace present
1824  {
1825  constexpr const auto mask = 0x0000000000000001UL;
1826  constexpr const auto from = 0;
1827  constexpr const auto name = "present";
1828 
1829  inline auto is_enabled()
1830  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1831 
1832  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1833  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1834 
1835  inline auto is_disabled()
1836  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1837 
1838  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1839  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1840 
1841  inline void enable()
1842  {
1843  auto&& field = get_vmcs_field(addr, name, exists());
1844  set_vmcs_field(set_bit(field, from), addr, name, exists());
1845  }
1846 
1847  inline void enable_if_exists(bool verbose = false) noexcept
1848  {
1849  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1850  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1851  }
1852 
1853  inline void disable()
1854  {
1855  auto&& field = get_vmcs_field(addr, name, exists());
1856  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1857  }
1858 
1859  inline void disable_if_exists(bool verbose = false) noexcept
1860  {
1861  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1862  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1863  }
1864  }
1865 
1866  namespace reserved
1867  {
1868  constexpr const auto from = 0;
1869  constexpr const auto name = "reserved";
1870 
1871  inline auto mask() noexcept
1872  {
1873  auto phys_len = x64::cpuid::addr_size::phys::get();
1874  auto upper = 0xFFFFFFFFFFFFFFFFULL << phys_len;
1875  return (upper | 0x1E6ULL);
1876  }
1877 
1878  inline auto get()
1879  { return get_bits(get_vmcs_field(addr, name, exists()), mask()) >> from; }
1880 
1881  inline auto get_if_exists(bool verbose = false) noexcept
1882  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask()) >> from; }
1883 
1884  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1885  void set(T val)
1886  {
1887  auto&& field = get_vmcs_field(addr, name, exists());
1888  set_vmcs_field(set_bits(field, mask(), (val << from)), addr, name, exists());
1889  }
1890 
1891  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
1892  void set_if_exists(T val, bool verbose = false) noexcept
1893  {
1894  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1895  set_vmcs_field_if_exists(set_bits(field, mask(), (val << from)), addr, name, verbose, exists());
1896  }
1897  }
1898 
1899  namespace pwt
1900  {
1901  constexpr const auto mask = 0x0000000000000008UL;
1902  constexpr const auto from = 3;
1903  constexpr const auto name = "pwt";
1904 
1905  inline auto is_enabled()
1906  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1907 
1908  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1909  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1910 
1911  inline auto is_disabled()
1912  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1913 
1914  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1915  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1916 
1917  inline void enable()
1918  {
1919  auto&& field = get_vmcs_field(addr, name, exists());
1920  set_vmcs_field(set_bit(field, from), addr, name, exists());
1921  }
1922 
1923  inline void enable_if_exists(bool verbose = false) noexcept
1924  {
1925  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1926  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1927  }
1928 
1929  inline void disable()
1930  {
1931  auto&& field = get_vmcs_field(addr, name, exists());
1932  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1933  }
1934 
1935  inline void disable_if_exists(bool verbose = false) noexcept
1936  {
1937  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1938  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1939  }
1940  }
1941 
1942  namespace pcd
1943  {
1944  constexpr const auto mask = 0x0000000000000010UL;
1945  constexpr const auto from = 4;
1946  constexpr const auto name = "pcd";
1947 
1948  inline auto is_enabled()
1949  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
1950 
1951  inline auto is_enabled_if_exists(bool verbose = false) noexcept
1952  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1953 
1954  inline auto is_disabled()
1955  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
1956 
1957  inline auto is_disabled_if_exists(bool verbose = false) noexcept
1958  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
1959 
1960  inline void enable()
1961  {
1962  auto&& field = get_vmcs_field(addr, name, exists());
1963  set_vmcs_field(set_bit(field, from), addr, name, exists());
1964  }
1965 
1966  inline void enable_if_exists(bool verbose = false) noexcept
1967  {
1968  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1969  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
1970  }
1971 
1972  inline void disable()
1973  {
1974  auto&& field = get_vmcs_field(addr, name, exists());
1975  set_vmcs_field(clear_bit(field, from), addr, name, exists());
1976  }
1977 
1978  inline void disable_if_exists(bool verbose = false) noexcept
1979  {
1980  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
1981  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
1982  }
1983  }
1984 
1985  namespace page_directory_addr
1986  {
1987  constexpr const auto from = 12;
1988  constexpr const auto name = "page_directory_addr";
1989 
1990  inline auto mask() noexcept
1991  {
1992  auto phys_len = x64::cpuid::addr_size::phys::get();
1993  auto upper = 0xFFFFFFFFFFFFFFFFULL << from;
1994  return (~(0xFFFFFFFFFFFFFFFFULL << phys_len) & upper);
1995  }
1996 
1997  inline auto get()
1998  { return get_bits(get_vmcs_field(addr, name, exists()), mask()) >> from; }
1999 
2000  inline auto get_if_exists(bool verbose = false) noexcept
2001  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask()) >> from; }
2002 
2003  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2004  void set(T val)
2005  {
2006  auto&& field = get_vmcs_field(addr, name, exists());
2007  set_vmcs_field(set_bits(field, mask(), (val << from)), addr, name, exists());
2008  }
2009 
2010  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2011  void set_if_exists(T val, bool verbose = false) noexcept
2012  {
2013  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2014  set_vmcs_field_if_exists(set_bits(field, mask(), (val << from)), addr, name, verbose, exists());
2015  }
2016  }
2017 }
2018 
2019 namespace guest_pdpte2
2020 {
2021  constexpr const auto addr = 0x000000000000280EUL;
2022  constexpr const auto name = "guest_pdpte2";
2023 
2024  inline auto exists() noexcept
2025  {
2028  }
2029 
2030  inline auto get()
2031  { return get_vmcs_field(addr, name, exists()); }
2032 
2033  inline auto get_if_exists(bool verbose = false) noexcept
2034  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
2035 
2036  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2037  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
2038 
2039  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2040  void set_if_exists(T val, bool verbose = false) noexcept
2041  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
2042 
2043  namespace present
2044  {
2045  constexpr const auto mask = 0x0000000000000001UL;
2046  constexpr const auto from = 0;
2047  constexpr const auto name = "present";
2048 
2049  inline auto is_enabled()
2050  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
2051 
2052  inline auto is_enabled_if_exists(bool verbose = false) noexcept
2053  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2054 
2055  inline auto is_disabled()
2056  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
2057 
2058  inline auto is_disabled_if_exists(bool verbose = false) noexcept
2059  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2060 
2061  inline void enable()
2062  {
2063  auto&& field = get_vmcs_field(addr, name, exists());
2064  set_vmcs_field(set_bit(field, from), addr, name, exists());
2065  }
2066 
2067  inline void enable_if_exists(bool verbose = false) noexcept
2068  {
2069  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2070  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
2071  }
2072 
2073  inline void disable()
2074  {
2075  auto&& field = get_vmcs_field(addr, name, exists());
2076  set_vmcs_field(clear_bit(field, from), addr, name, exists());
2077  }
2078 
2079  inline void disable_if_exists(bool verbose = false) noexcept
2080  {
2081  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2082  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
2083  }
2084  }
2085 
2086  namespace reserved
2087  {
2088  constexpr const auto from = 0;
2089  constexpr const auto name = "reserved";
2090 
2091  inline auto mask() noexcept
2092  {
2093  auto phys_len = x64::cpuid::addr_size::phys::get();
2094  auto upper = 0xFFFFFFFFFFFFFFFFULL << phys_len;
2095  return (upper | 0x1E6ULL);
2096  }
2097 
2098  inline auto get()
2099  { return get_bits(get_vmcs_field(addr, name, exists()), mask()) >> from; }
2100 
2101  inline auto get_if_exists(bool verbose = false) noexcept
2102  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask()) >> from; }
2103 
2104  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2105  void set(T val)
2106  {
2107  auto&& field = get_vmcs_field(addr, name, exists());
2108  set_vmcs_field(set_bits(field, mask(), (val << from)), addr, name, exists());
2109  }
2110 
2111  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2112  void set_if_exists(T val, bool verbose = false) noexcept
2113  {
2114  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2115  set_vmcs_field_if_exists(set_bits(field, mask(), (val << from)), addr, name, verbose, exists());
2116  }
2117  }
2118 
2119  namespace pwt
2120  {
2121  constexpr const auto mask = 0x0000000000000008UL;
2122  constexpr const auto from = 3;
2123  constexpr const auto name = "pwt";
2124 
2125  inline auto is_enabled()
2126  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
2127 
2128  inline auto is_enabled_if_exists(bool verbose = false) noexcept
2129  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2130 
2131  inline auto is_disabled()
2132  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
2133 
2134  inline auto is_disabled_if_exists(bool verbose = false) noexcept
2135  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2136 
2137  inline void enable()
2138  {
2139  auto&& field = get_vmcs_field(addr, name, exists());
2140  set_vmcs_field(set_bit(field, from), addr, name, exists());
2141  }
2142 
2143  inline void enable_if_exists(bool verbose = false) noexcept
2144  {
2145  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2146  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
2147  }
2148 
2149  inline void disable()
2150  {
2151  auto&& field = get_vmcs_field(addr, name, exists());
2152  set_vmcs_field(clear_bit(field, from), addr, name, exists());
2153  }
2154 
2155  inline void disable_if_exists(bool verbose = false) noexcept
2156  {
2157  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2158  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
2159  }
2160  }
2161 
2162  namespace pcd
2163  {
2164  constexpr const auto mask = 0x0000000000000010UL;
2165  constexpr const auto from = 4;
2166  constexpr const auto name = "pcd";
2167 
2168  inline auto is_enabled()
2169  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
2170 
2171  inline auto is_enabled_if_exists(bool verbose = false) noexcept
2172  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2173 
2174  inline auto is_disabled()
2175  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
2176 
2177  inline auto is_disabled_if_exists(bool verbose = false) noexcept
2178  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2179 
2180  inline void enable()
2181  {
2182  auto&& field = get_vmcs_field(addr, name, exists());
2183  set_vmcs_field(set_bit(field, from), addr, name, exists());
2184  }
2185 
2186  inline void enable_if_exists(bool verbose = false) noexcept
2187  {
2188  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2189  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
2190  }
2191 
2192  inline void disable()
2193  {
2194  auto&& field = get_vmcs_field(addr, name, exists());
2195  set_vmcs_field(clear_bit(field, from), addr, name, exists());
2196  }
2197 
2198  inline void disable_if_exists(bool verbose = false) noexcept
2199  {
2200  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2201  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
2202  }
2203  }
2204 
2205  namespace page_directory_addr
2206  {
2207  constexpr const auto from = 12;
2208  constexpr const auto name = "page_directory_addr";
2209 
2210  inline auto mask() noexcept
2211  {
2212  auto phys_len = x64::cpuid::addr_size::phys::get();
2213  auto upper = 0xFFFFFFFFFFFFFFFFULL << from;
2214  return (~(0xFFFFFFFFFFFFFFFFULL << phys_len) & upper);
2215  }
2216 
2217  inline auto get()
2218  { return get_bits(get_vmcs_field(addr, name, exists()), mask()) >> from; }
2219 
2220  inline auto get_if_exists(bool verbose = false) noexcept
2221  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask()) >> from; }
2222 
2223  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2224  void set(T val)
2225  {
2226  auto&& field = get_vmcs_field(addr, name, exists());
2227  set_vmcs_field(set_bits(field, mask(), (val << from)), addr, name, exists());
2228  }
2229 
2230  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2231  void set_if_exists(T val, bool verbose = false) noexcept
2232  {
2233  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2234  set_vmcs_field_if_exists(set_bits(field, mask(), (val << from)), addr, name, verbose, exists());
2235  }
2236  }
2237 }
2238 
2239 namespace guest_pdpte3
2240 {
2241  constexpr const auto addr = 0x0000000000002810UL;
2242  constexpr const auto name = "guest_pdpte3";
2243 
2244  inline auto exists() noexcept
2245  {
2248  }
2249 
2250  inline auto get()
2251  { return get_vmcs_field(addr, name, exists()); }
2252 
2253  inline auto get_if_exists(bool verbose = false) noexcept
2254  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
2255 
2256  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2257  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
2258 
2259  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2260  void set_if_exists(T val, bool verbose = false) noexcept
2261  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
2262 
2263  namespace present
2264  {
2265  constexpr const auto mask = 0x0000000000000001UL;
2266  constexpr const auto from = 0;
2267  constexpr const auto name = "present";
2268 
2269  inline auto is_enabled()
2270  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
2271 
2272  inline auto is_enabled_if_exists(bool verbose = false) noexcept
2273  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2274 
2275  inline auto is_disabled()
2276  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
2277 
2278  inline auto is_disabled_if_exists(bool verbose = false) noexcept
2279  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2280 
2281  inline void enable()
2282  {
2283  auto&& field = get_vmcs_field(addr, name, exists());
2284  set_vmcs_field(set_bit(field, from), addr, name, exists());
2285  }
2286 
2287  inline void enable_if_exists(bool verbose = false) noexcept
2288  {
2289  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2290  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
2291  }
2292 
2293  inline void disable()
2294  {
2295  auto&& field = get_vmcs_field(addr, name, exists());
2296  set_vmcs_field(clear_bit(field, from), addr, name, exists());
2297  }
2298 
2299  inline void disable_if_exists(bool verbose = false) noexcept
2300  {
2301  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2302  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
2303  }
2304  }
2305 
2306  namespace reserved
2307  {
2308  constexpr const auto from = 0;
2309  constexpr const auto name = "reserved";
2310 
2311  inline auto mask() noexcept
2312  {
2313  auto phys_len = x64::cpuid::addr_size::phys::get();
2314  auto upper = 0xFFFFFFFFFFFFFFFFULL << phys_len;
2315  return (upper | 0x1E6ULL);
2316  }
2317 
2318  inline auto get()
2319  { return get_bits(get_vmcs_field(addr, name, exists()), mask()) >> from; }
2320 
2321  inline auto get_if_exists(bool verbose = false) noexcept
2322  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask()) >> from; }
2323 
2324  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2325  void set(T val)
2326  {
2327  auto&& field = get_vmcs_field(addr, name, exists());
2328  set_vmcs_field(set_bits(field, mask(), (val << from)), addr, name, exists());
2329  }
2330 
2331  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2332  void set_if_exists(T val, bool verbose = false) noexcept
2333  {
2334  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2335  set_vmcs_field_if_exists(set_bits(field, mask(), (val << from)), addr, name, verbose, exists());
2336  }
2337  }
2338 
2339  namespace pwt
2340  {
2341  constexpr const auto mask = 0x0000000000000008UL;
2342  constexpr const auto from = 3;
2343  constexpr const auto name = "pwt";
2344 
2345  inline auto is_enabled()
2346  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
2347 
2348  inline auto is_enabled_if_exists(bool verbose = false) noexcept
2349  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2350 
2351  inline auto is_disabled()
2352  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
2353 
2354  inline auto is_disabled_if_exists(bool verbose = false) noexcept
2355  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2356 
2357  inline void enable()
2358  {
2359  auto&& field = get_vmcs_field(addr, name, exists());
2360  set_vmcs_field(set_bit(field, from), addr, name, exists());
2361  }
2362 
2363  inline void enable_if_exists(bool verbose = false) noexcept
2364  {
2365  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2366  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
2367  }
2368 
2369  inline void disable()
2370  {
2371  auto&& field = get_vmcs_field(addr, name, exists());
2372  set_vmcs_field(clear_bit(field, from), addr, name, exists());
2373  }
2374 
2375  inline void disable_if_exists(bool verbose = false) noexcept
2376  {
2377  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2378  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
2379  }
2380  }
2381 
2382  namespace pcd
2383  {
2384  constexpr const auto mask = 0x0000000000000010UL;
2385  constexpr const auto from = 4;
2386  constexpr const auto name = "pcd";
2387 
2388  inline auto is_enabled()
2389  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
2390 
2391  inline auto is_enabled_if_exists(bool verbose = false) noexcept
2392  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2393 
2394  inline auto is_disabled()
2395  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
2396 
2397  inline auto is_disabled_if_exists(bool verbose = false) noexcept
2398  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2399 
2400  inline void enable()
2401  {
2402  auto&& field = get_vmcs_field(addr, name, exists());
2403  set_vmcs_field(set_bit(field, from), addr, name, exists());
2404  }
2405 
2406  inline void enable_if_exists(bool verbose = false) noexcept
2407  {
2408  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2409  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
2410  }
2411 
2412  inline void disable()
2413  {
2414  auto&& field = get_vmcs_field(addr, name, exists());
2415  set_vmcs_field(clear_bit(field, from), addr, name, exists());
2416  }
2417 
2418  inline void disable_if_exists(bool verbose = false) noexcept
2419  {
2420  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2421  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
2422  }
2423  }
2424 
2425  namespace page_directory_addr
2426  {
2427  constexpr const auto from = 12;
2428  constexpr const auto name = "page_directory_addr";
2429 
2430  inline auto mask() noexcept
2431  {
2432  auto phys_len = x64::cpuid::addr_size::phys::get();
2433  auto upper = 0xFFFFFFFFFFFFFFFFULL << from;
2434  return (~(0xFFFFFFFFFFFFFFFFULL << phys_len) & upper);
2435  }
2436 
2437  inline auto get()
2438  { return get_bits(get_vmcs_field(addr, name, exists()), mask()) >> from; }
2439 
2440  inline auto get_if_exists(bool verbose = false) noexcept
2441  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask()) >> from; }
2442 
2443  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2444  void set(T val)
2445  {
2446  auto&& field = get_vmcs_field(addr, name, exists());
2447  set_vmcs_field(set_bits(field, mask(), (val << from)), addr, name, exists());
2448  }
2449 
2450  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2451  void set_if_exists(T val, bool verbose = false) noexcept
2452  {
2453  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2454  set_vmcs_field_if_exists(set_bits(field, mask(), (val << from)), addr, name, verbose, exists());
2455  }
2456  }
2457 }
2458 
2459 namespace guest_ia32_bndcfgs
2460 {
2461  constexpr const auto addr = 0x0000000000002812UL;
2462  constexpr const auto name = "guest_ia32_bndcfgs";
2463 
2464  inline auto exists() noexcept
2465  {
2468  }
2469 
2470  inline auto get()
2471  { return get_vmcs_field(addr, name, exists()); }
2472 
2473  inline auto get_if_exists(bool verbose = false) noexcept
2474  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
2475 
2476  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2477  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
2478 
2479  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2480  void set_if_exists(T val, bool verbose = false) noexcept
2481  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
2482 
2483  namespace en
2484  {
2485  constexpr const auto mask = 0x0000000000000001UL;
2486  constexpr const auto from = 0;
2487  constexpr const auto name = "en";
2488 
2489  inline auto is_enabled()
2490  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
2491 
2492  inline auto is_enabled_if_exists(bool verbose = false) noexcept
2493  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2494 
2495  inline auto is_disabled()
2496  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
2497 
2498  inline auto is_disabled_if_exists(bool verbose = false) noexcept
2499  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2500 
2501  inline void enable()
2502  {
2503  auto&& field = get_vmcs_field(addr, name, exists());
2504  set_vmcs_field(set_bit(field, from), addr, name, exists());
2505  }
2506 
2507  inline void enable_if_exists(bool verbose = false) noexcept
2508  {
2509  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2510  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
2511  }
2512 
2513  inline void disable()
2514  {
2515  auto&& field = get_vmcs_field(addr, name, exists());
2516  set_vmcs_field(clear_bit(field, from), addr, name, exists());
2517  }
2518 
2519  inline void disable_if_exists(bool verbose = false) noexcept
2520  {
2521  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2522  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
2523  }
2524  }
2525 
2526  namespace bndpreserve
2527  {
2528  constexpr const auto mask = 0x0000000000000002UL;
2529  constexpr const auto from = 1;
2530  constexpr const auto name = "bndpreserve";
2531 
2532  inline auto is_enabled()
2533  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
2534 
2535  inline auto is_enabled_if_exists(bool verbose = false) noexcept
2536  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2537 
2538  inline auto is_disabled()
2539  { return is_bit_cleared(get_vmcs_field(addr, name, exists()), from); }
2540 
2541  inline auto is_disabled_if_exists(bool verbose = false) noexcept
2542  { return is_bit_cleared(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
2543 
2544  inline void enable()
2545  {
2546  auto&& field = get_vmcs_field(addr, name, exists());
2547  set_vmcs_field(set_bit(field, from), addr, name, exists());
2548  }
2549 
2550  inline void enable_if_exists(bool verbose = false) noexcept
2551  {
2552  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2553  set_vmcs_field_if_exists(set_bit(field, from), addr, name, verbose, exists());
2554  }
2555 
2556  inline void disable()
2557  {
2558  auto&& field = get_vmcs_field(addr, name, exists());
2559  set_vmcs_field(clear_bit(field, from), addr, name, exists());
2560  }
2561 
2562  inline void disable_if_exists(bool verbose = false) noexcept
2563  {
2564  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2565  set_vmcs_field_if_exists(clear_bit(field, from), addr, name, verbose, exists());
2566  }
2567  }
2568 
2569  namespace reserved
2570  {
2571  constexpr const auto mask = 0x0000000000000FFCUL;
2572  constexpr const auto from = 0;
2573  constexpr const auto name = "reserved";
2574 
2575  inline auto get()
2576  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
2577 
2578  inline auto get_if_exists(bool verbose = false) noexcept
2579  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
2580 
2581  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2582  void set(T val)
2583  {
2584  auto&& field = get_vmcs_field(addr, name, exists());
2585  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
2586  }
2587 
2588  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2589  void set_if_exists(T val, bool verbose = false) noexcept
2590  {
2591  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2592  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
2593  }
2594  }
2595 
2596  namespace base_addr_of_bnd_directory
2597  {
2598  constexpr const auto mask = 0xFFFFFFFFFFFFF000UL;
2599  constexpr const auto from = 12;
2600  constexpr const auto name = "base_addr_of_bnd_directory";
2601 
2602  inline auto get()
2603  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
2604 
2605  inline auto get_if_exists(bool verbose = false) noexcept
2606  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
2607 
2608  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2609  void set(T val)
2610  {
2611  auto&& field = get_vmcs_field(addr, name, exists());
2612  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
2613  }
2614 
2615  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
2616  void set_if_exists(T val, bool verbose = false) noexcept
2617  {
2618  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
2619  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
2620  }
2621  }
2622 }
2623 
2624 }
2625 }
2626 
2627 // *INDENT-ON*
2628 
2629 #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
auto is_allowed1() 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
void set_if_exists(T val, bool verbose=false) noexcept
void set_if_exists(T val, bool verbose=false) noexcept
auto upper(T ptr) noexcept
Definition: upper_lower.h:55
auto is_allowed1() noexcept
auto is_allowed1() 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 set_if_exists(T val, bool verbose=false) noexcept
void uint64_t uint64_t uint64_t *rdx noexcept
void set_if_exists(T val, bool verbose=false) noexcept
auto is_bit_cleared(T t, B b) noexcept
Definition: bitmanip.h:54
auto is_allowed1() noexcept
auto clear_bit(T t, B b) noexcept
Definition: bitmanip.h:36
constexpr const auto reserved
Definition: vcpuid.h:33
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
auto get_bits(T t, M m) noexcept
Definition: bitmanip.h:65
void set_if_exists(T val, bool verbose=false) noexcept
void set_if_exists(T val, bool verbose=false) noexcept
auto get() noexcept
Definition: cpuid_x64.h:89
auto get_vmcs_field(T addr, const char *name, bool exists)
auto is_bit_set(T t, B b) noexcept
Definition: bitmanip.h:48
auto set_bits(T t, M m, V v) noexcept
Definition: bitmanip.h:72