vmcs_intel_x64_16bit_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_16BIT_GUEST_STATE_FIELDS_H
24 #define VMCS_INTEL_X64_16BIT_GUEST_STATE_FIELDS_H
25 
26 #include <vmcs/vmcs_intel_x64.h>
28 
35 
36 // *INDENT-OFF*
37 
38 namespace intel_x64
39 {
40 namespace vmcs
41 {
42 
43 namespace guest_es_selector
44 {
45  constexpr const auto addr = 0x0000000000000800UL;
46  constexpr const auto name = "guest_es_selector";
47 
48  inline bool exists() noexcept
49  { return true; }
50 
51  inline auto get()
52  { return get_vmcs_field(addr, name, exists()); }
53 
54  inline auto get_if_exists(bool verbose = false) noexcept
55  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
56 
57  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
58  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
59 
60  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
61  void set_if_exists(T val, bool verbose = false) noexcept
62  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
63 
64  namespace rpl
65  {
66  constexpr const auto mask = 0x00000003U;
67  constexpr const auto from = 0;
68  constexpr const auto name = "rpl";
69 
70  inline auto get()
71  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
72 
73  inline auto get_if_exists(bool verbose = false) noexcept
74  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
75 
76  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
77  void set(T val)
78  {
79  auto&& field = get_vmcs_field(addr, name, exists());
80  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
81  }
82 
83  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
84  void set_if_exists(T val, bool verbose = false) noexcept
85  {
86  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
87  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
88  }
89  }
90 
91  namespace ti
92  {
93  constexpr const auto mask = 0x00000004U;
94  constexpr const auto from = 2;
95  constexpr const auto name = "ti";
96 
97  inline auto get()
98  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
99 
100  inline auto get_if_exists(bool verbose = false) noexcept
101  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
102 
103  inline void set(bool b)
104  {
105  auto&& field = get_vmcs_field(addr, name, exists());
106  set_vmcs_field(b ? set_bit(field, from) : clear_bit(field, from), addr, name, exists());
107  }
108 
109  inline void set_if_exists(bool b, bool verbose = false) noexcept
110  {
111  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
112  set_vmcs_field_if_exists(b ? set_bit(field, from) : clear_bit(field, from), addr, name, verbose, exists());
113  }
114  }
115 
116  namespace index
117  {
118  constexpr const auto mask = 0x0000FFF8U;
119  constexpr const auto from = 3;
120  constexpr const auto name = "index";
121 
122  inline auto get()
123  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
124 
125  inline auto get_if_exists(bool verbose = false) noexcept
126  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
127 
128  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
129  void set(T val)
130  {
131  auto&& field = get_vmcs_field(addr, name, exists());
132  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
133  }
134 
135  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
136  void set_if_exists(T val, bool verbose = false) noexcept
137  {
138  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
139  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
140  }
141  }
142 }
143 
144 namespace guest_cs_selector
145 {
146  constexpr const auto addr = 0x0000000000000802UL;
147  constexpr const auto name = "guest_cs_selector";
148 
149  inline bool exists() noexcept
150  { return true; }
151 
152  inline auto get()
153  { return get_vmcs_field(addr, name, exists()); }
154 
155  inline auto get_if_exists(bool verbose = false) noexcept
156  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
157 
158  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
159  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
160 
161  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
162  void set_if_exists(T val, bool verbose = false) noexcept
163  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
164 
165  namespace rpl
166  {
167  constexpr const auto mask = 0x00000003U;
168  constexpr const auto from = 0;
169  constexpr const auto name = "rpl";
170 
171  inline auto get()
172  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
173 
174  inline auto get_if_exists(bool verbose = false) noexcept
175  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
176 
177  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
178  void set(T val)
179  {
180  auto&& field = get_vmcs_field(addr, name, exists());
181  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
182  }
183 
184  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
185  void set_if_exists(T val, bool verbose = false) noexcept
186  {
187  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
188  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
189  }
190  }
191 
192  namespace ti
193  {
194  constexpr const auto mask = 0x00000004U;
195  constexpr const auto from = 2;
196  constexpr const auto name = "ti";
197 
198  inline auto get()
199  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
200 
201  inline auto get_if_exists(bool verbose = false) noexcept
202  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
203 
204  inline void set(bool b)
205  {
206  auto&& field = get_vmcs_field(addr, name, exists());
207  set_vmcs_field(b ? set_bit(field, from) : clear_bit(field, from), addr, name, exists());
208  }
209 
210  inline void set_if_exists(bool b, bool verbose = false) noexcept
211  {
212  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
213  set_vmcs_field_if_exists(b ? set_bit(field, from) : clear_bit(field, from), addr, name, verbose, exists());
214  }
215  }
216 
217  namespace index
218  {
219  constexpr const auto mask = 0x0000FFF8U;
220  constexpr const auto from = 3;
221  constexpr const auto name = "index";
222 
223  inline auto get()
224  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
225 
226  inline auto get_if_exists(bool verbose = false) noexcept
227  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
228 
229  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
230  void set(T val)
231  {
232  auto&& field = get_vmcs_field(addr, name, exists());
233  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
234  }
235 
236  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
237  void set_if_exists(T val, bool verbose = false) noexcept
238  {
239  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
240  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
241  }
242  }
243 }
244 
245 namespace guest_ss_selector
246 {
247  constexpr const auto addr = 0x0000000000000804UL;
248  constexpr const auto name = "guest_ss_selector";
249 
250  inline bool exists() noexcept
251  { return true; }
252 
253  inline auto get()
254  { return get_vmcs_field(addr, name, exists()); }
255 
256  inline auto get_if_exists(bool verbose = false) noexcept
257  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
258 
259  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
260  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
261 
262  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
263  void set_if_exists(T val, bool verbose = false) noexcept
264  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
265 
266  namespace rpl
267  {
268  constexpr const auto mask = 0x00000003U;
269  constexpr const auto from = 0;
270  constexpr const auto name = "rpl";
271 
272  inline auto get()
273  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
274 
275  inline auto get_if_exists(bool verbose = false) noexcept
276  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
277 
278  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
279  void set(T val)
280  {
281  auto&& field = get_vmcs_field(addr, name, exists());
282  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
283  }
284 
285  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
286  void set_if_exists(T val, bool verbose = false) noexcept
287  {
288  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
289  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
290  }
291  }
292 
293  namespace ti
294  {
295  constexpr const auto mask = 0x00000004U;
296  constexpr const auto from = 2;
297  constexpr const auto name = "ti";
298 
299  inline auto get()
300  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
301 
302  inline auto get_if_exists(bool verbose = false) noexcept
303  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
304 
305  inline void set(bool b)
306  {
307  auto&& field = get_vmcs_field(addr, name, exists());
308  set_vmcs_field(b ? set_bit(field, from) : clear_bit(field, from), addr, name, exists());
309  }
310 
311  inline void set_if_exists(bool b, bool verbose = false) noexcept
312  {
313  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
314  set_vmcs_field_if_exists(b ? set_bit(field, from) : clear_bit(field, from), addr, name, verbose, exists());
315  }
316  }
317 
318  namespace index
319  {
320  constexpr const auto mask = 0x0000FFF8U;
321  constexpr const auto from = 3;
322  constexpr const auto name = "index";
323 
324  inline auto get()
325  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
326 
327  inline auto get_if_exists(bool verbose = false) noexcept
328  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
329 
330  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
331  void set(T val)
332  {
333  auto&& field = get_vmcs_field(addr, name, exists());
334  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
335  }
336 
337  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
338  void set_if_exists(T val, bool verbose = false) noexcept
339  {
340  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
341  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
342  }
343  }
344 }
345 
346 namespace guest_ds_selector
347 {
348  constexpr const auto addr = 0x0000000000000806UL;
349  constexpr const auto name = "guest_ds_selector";
350 
351  inline bool exists() noexcept
352  { return true; }
353 
354  inline auto get()
355  { return get_vmcs_field(addr, name, exists()); }
356 
357  inline auto get_if_exists(bool verbose = false) noexcept
358  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
359 
360  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
361  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
362 
363  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
364  void set_if_exists(T val, bool verbose = false) noexcept
365  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
366 
367  namespace rpl
368  {
369  constexpr const auto mask = 0x00000003U;
370  constexpr const auto from = 0;
371  constexpr const auto name = "rpl";
372 
373  inline auto get()
374  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
375 
376  inline auto get_if_exists(bool verbose = false) noexcept
377  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
378 
379  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
380  void set(T val)
381  {
382  auto&& field = get_vmcs_field(addr, name, exists());
383  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
384  }
385 
386  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
387  void set_if_exists(T val, bool verbose = false) noexcept
388  {
389  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
390  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
391  }
392  }
393 
394  namespace ti
395  {
396  constexpr const auto mask = 0x00000004U;
397  constexpr const auto from = 2;
398  constexpr const auto name = "ti";
399 
400  inline auto get()
401  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
402 
403  inline auto get_if_exists(bool verbose = false) noexcept
404  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
405 
406  inline void set(bool b)
407  {
408  auto&& field = get_vmcs_field(addr, name, exists());
409  set_vmcs_field(b ? set_bit(field, from) : clear_bit(field, from), addr, name, exists());
410  }
411 
412  inline void set_if_exists(bool b, bool verbose = false) noexcept
413  {
414  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
415  set_vmcs_field_if_exists(b ? set_bit(field, from) : clear_bit(field, from), addr, name, verbose, exists());
416  }
417  }
418 
419  namespace index
420  {
421  constexpr const auto mask = 0x0000FFF8U;
422  constexpr const auto from = 3;
423  constexpr const auto name = "index";
424 
425  inline auto get()
426  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
427 
428  inline auto get_if_exists(bool verbose = false) noexcept
429  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
430 
431  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
432  void set(T val)
433  {
434  auto&& field = get_vmcs_field(addr, name, exists());
435  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
436  }
437 
438  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
439  void set_if_exists(T val, bool verbose = false) noexcept
440  {
441  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
442  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
443  }
444  }
445 }
446 
447 namespace guest_fs_selector
448 {
449  constexpr const auto addr = 0x0000000000000808UL;
450  constexpr const auto name = "guest_fs_selector";
451 
452  inline bool exists() noexcept
453  { return true; }
454 
455  inline auto get()
456  { return get_vmcs_field(addr, name, exists()); }
457 
458  inline auto get_if_exists(bool verbose = false) noexcept
459  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
460 
461  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
462  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
463 
464  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
465  void set_if_exists(T val, bool verbose = false) noexcept
466  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
467 
468  namespace rpl
469  {
470  constexpr const auto mask = 0x00000003U;
471  constexpr const auto from = 0;
472  constexpr const auto name = "rpl";
473 
474  inline auto get()
475  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
476 
477  inline auto get_if_exists(bool verbose = false) noexcept
478  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
479 
480  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
481  void set(T val)
482  {
483  auto&& field = get_vmcs_field(addr, name, exists());
484  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
485  }
486 
487  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
488  void set_if_exists(T val, bool verbose = false) noexcept
489  {
490  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
491  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
492  }
493  }
494 
495  namespace ti
496  {
497  constexpr const auto mask = 0x00000004U;
498  constexpr const auto from = 2;
499  constexpr const auto name = "ti";
500 
501  inline auto get()
502  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
503 
504  inline auto get_if_exists(bool verbose = false) noexcept
505  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
506 
507  inline void set(bool b)
508  {
509  auto&& field = get_vmcs_field(addr, name, exists());
510  set_vmcs_field(b ? set_bit(field, from) : clear_bit(field, from), addr, name, exists());
511  }
512 
513  inline void set_if_exists(bool b, bool verbose = false) noexcept
514  {
515  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
516  set_vmcs_field_if_exists(b ? set_bit(field, from) : clear_bit(field, from), addr, name, verbose, exists());
517  }
518  }
519 
520  namespace index
521  {
522  constexpr const auto mask = 0x0000FFF8U;
523  constexpr const auto from = 3;
524  constexpr const auto name = "index";
525 
526  inline auto get()
527  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
528 
529  inline auto get_if_exists(bool verbose = false) noexcept
530  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
531 
532  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
533  void set(T val)
534  {
535  auto&& field = get_vmcs_field(addr, name, exists());
536  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
537  }
538 
539  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
540  void set_if_exists(T val, bool verbose = false) noexcept
541  {
542  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
543  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
544  }
545  }
546 }
547 
548 namespace guest_gs_selector
549 {
550  constexpr const auto addr = 0x000000000000080AUL;
551  constexpr const auto name = "guest_gs_selector";
552 
553  inline bool exists() noexcept
554  { return true; }
555 
556  inline auto get()
557  { return get_vmcs_field(addr, name, exists()); }
558 
559  inline auto get_if_exists(bool verbose = false) noexcept
560  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
561 
562  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
563  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
564 
565  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
566  void set_if_exists(T val, bool verbose = false) noexcept
567  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
568 
569  namespace rpl
570  {
571  constexpr const auto mask = 0x00000003U;
572  constexpr const auto from = 0;
573  constexpr const auto name = "rpl";
574 
575  inline auto get()
576  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
577 
578  inline auto get_if_exists(bool verbose = false) noexcept
579  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
580 
581  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
582  void set(T val)
583  {
584  auto&& field = get_vmcs_field(addr, name, exists());
585  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
586  }
587 
588  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
589  void set_if_exists(T val, bool verbose = false) noexcept
590  {
591  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
592  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
593  }
594  }
595 
596  namespace ti
597  {
598  constexpr const auto mask = 0x00000004U;
599  constexpr const auto from = 2;
600  constexpr const auto name = "ti";
601 
602  inline auto get()
603  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
604 
605  inline auto get_if_exists(bool verbose = false) noexcept
606  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
607 
608  inline void set(bool b)
609  {
610  auto&& field = get_vmcs_field(addr, name, exists());
611  set_vmcs_field(b ? set_bit(field, from) : clear_bit(field, from), addr, name, exists());
612  }
613 
614  inline void set_if_exists(bool b, bool verbose = false) noexcept
615  {
616  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
617  set_vmcs_field_if_exists(b ? set_bit(field, from) : clear_bit(field, from), addr, name, verbose, exists());
618  }
619  }
620 
621  namespace index
622  {
623  constexpr const auto mask = 0x0000FFF8U;
624  constexpr const auto from = 3;
625  constexpr const auto name = "index";
626 
627  inline auto get()
628  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
629 
630  inline auto get_if_exists(bool verbose = false) noexcept
631  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
632 
633  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
634  void set(T val)
635  {
636  auto&& field = get_vmcs_field(addr, name, exists());
637  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
638  }
639 
640  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
641  void set_if_exists(T val, bool verbose = false) noexcept
642  {
643  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
644  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
645  }
646  }
647 }
648 
649 namespace guest_ldtr_selector
650 {
651  constexpr const auto addr = 0x000000000000080CUL;
652  constexpr const auto name = "guest_ldtr_selector";
653 
654  inline bool exists() noexcept
655  { return true; }
656 
657  inline auto get()
658  { return get_vmcs_field(addr, name, exists()); }
659 
660  inline auto get_if_exists(bool verbose = false) noexcept
661  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
662 
663  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
664  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
665 
666  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
667  void set_if_exists(T val, bool verbose = false) noexcept
668  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
669 
670  namespace rpl
671  {
672  constexpr const auto mask = 0x00000003U;
673  constexpr const auto from = 0;
674  constexpr const auto name = "rpl";
675 
676  inline auto get()
677  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
678 
679  inline auto get_if_exists(bool verbose = false) noexcept
680  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
681 
682  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
683  void set(T val)
684  {
685  auto&& field = get_vmcs_field(addr, name, exists());
686  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
687  }
688 
689  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
690  void set_if_exists(T val, bool verbose = false) noexcept
691  {
692  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
693  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
694  }
695  }
696 
697  namespace ti
698  {
699  constexpr const auto mask = 0x00000004U;
700  constexpr const auto from = 2;
701  constexpr const auto name = "ti";
702 
703  inline auto get()
704  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
705 
706  inline auto get_if_exists(bool verbose = false) noexcept
707  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
708 
709  inline void set(bool b)
710  {
711  auto&& field = get_vmcs_field(addr, name, exists());
712  set_vmcs_field(b ? set_bit(field, from) : clear_bit(field, from), addr, name, exists());
713  }
714 
715  inline void set_if_exists(bool b, bool verbose = false) noexcept
716  {
717  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
718  set_vmcs_field_if_exists(b ? set_bit(field, from) : clear_bit(field, from), addr, name, verbose, exists());
719  }
720  }
721 
722  namespace index
723  {
724  constexpr const auto mask = 0x0000FFF8U;
725  constexpr const auto from = 3;
726  constexpr const auto name = "index";
727 
728  inline auto get()
729  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
730 
731  inline auto get_if_exists(bool verbose = false) noexcept
732  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
733 
734  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
735  void set(T val)
736  {
737  auto&& field = get_vmcs_field(addr, name, exists());
738  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
739  }
740 
741  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
742  void set_if_exists(T val, bool verbose = false) noexcept
743  {
744  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
745  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
746  }
747  }
748 }
749 
750 namespace guest_tr_selector
751 {
752  constexpr const auto addr = 0x000000000000080EUL;
753  constexpr const auto name = "guest_tr_selector";
754 
755  inline bool exists() noexcept
756  { return true; }
757 
758  inline auto get()
759  { return get_vmcs_field(addr, name, exists()); }
760 
761  inline auto get_if_exists(bool verbose = false) noexcept
762  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
763 
764  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
765  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
766 
767  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
768  void set_if_exists(T val, bool verbose = false) noexcept
769  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
770 
771  namespace rpl
772  {
773  constexpr const auto mask = 0x00000003U;
774  constexpr const auto from = 0;
775  constexpr const auto name = "rpl";
776 
777  inline auto get()
778  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
779 
780  inline auto get_if_exists(bool verbose = false) noexcept
781  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
782 
783  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
784  void set(T val)
785  {
786  auto&& field = get_vmcs_field(addr, name, exists());
787  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
788  }
789 
790  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
791  void set_if_exists(T val, bool verbose = false) noexcept
792  {
793  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
794  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
795  }
796  }
797 
798  namespace ti
799  {
800  constexpr const auto mask = 0x00000004U;
801  constexpr const auto from = 2;
802  constexpr const auto name = "ti";
803 
804  inline auto get()
805  { return is_bit_set(get_vmcs_field(addr, name, exists()), from); }
806 
807  inline auto get_if_exists(bool verbose = false) noexcept
808  { return is_bit_set(get_vmcs_field_if_exists(addr, name, verbose, exists()), from); }
809 
810  inline void set(bool b)
811  {
812  auto&& field = get_vmcs_field(addr, name, exists());
813  set_vmcs_field(b ? set_bit(field, from) : clear_bit(field, from), addr, name, exists());
814  }
815 
816  inline void set_if_exists(bool b, bool verbose = false) noexcept
817  {
818  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
819  set_vmcs_field_if_exists(b ? set_bit(field, from) : clear_bit(field, from), addr, name, verbose, exists());
820  }
821  }
822 
823  namespace index
824  {
825  constexpr const auto mask = 0x0000FFF8U;
826  constexpr const auto from = 3;
827  constexpr const auto name = "index";
828 
829  inline auto get()
830  { return get_bits(get_vmcs_field(addr, name, exists()), mask) >> from; }
831 
832  inline auto get_if_exists(bool verbose = false) noexcept
833  { return get_bits(get_vmcs_field_if_exists(addr, name, verbose, exists()), mask) >> from; }
834 
835  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
836  void set(T val)
837  {
838  auto&& field = get_vmcs_field(addr, name, exists());
839  set_vmcs_field(set_bits(field, mask, (val << from)), addr, name, exists());
840  }
841 
842  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
843  void set_if_exists(T val, bool verbose = false) noexcept
844  {
845  auto&& field = get_vmcs_field_if_exists(addr, name, verbose, exists());
846  set_vmcs_field_if_exists(set_bits(field, mask, (val << from)), addr, name, verbose, exists());
847  }
848  }
849 }
850 
851 namespace guest_interrupt_status
852 {
853  constexpr const auto addr = 0x0000000000000810UL;
854  constexpr const auto name = "guest_interrupt_status";
855 
856  inline bool exists() noexcept
857  {
860  }
861 
862  inline auto get()
863  { return get_vmcs_field(addr, name, exists()); }
864 
865  inline auto get_if_exists(bool verbose = false) noexcept
866  { return get_vmcs_field_if_exists(addr, name, verbose, exists()); }
867 
868  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
869  void set(T val) { set_vmcs_field(val, addr, name, exists()); }
870 
871  template<class T, class = typename std::enable_if<std::is_integral<T>::value>::type>
872  void set_if_exists(T val, bool verbose = false) noexcept
873  { set_vmcs_field_if_exists(val, addr, name, verbose, exists()); }
874 }
875 
876 }
877 }
878 
879 // *INDENT-OFF*
880 
881 #endif
auto get_vmcs_field_if_exists(T addr, const char *name, bool verbose, bool exists)
void set_if_exists(bool b, 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(bool b, bool verbose=false) noexcept
void set_if_exists(T val, bool verbose=false) noexcept
void set_if_exists(bool b, 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(bool b, bool verbose=false) noexcept
void set_if_exists(T val, bool verbose=false) noexcept
void set_if_exists(T val, bool verbose=false) noexcept
auto set_vmcs_field_if_exists(V val, A addr, const char *name, bool verbose, bool exists) noexcept
void set_if_exists(bool b, bool verbose=false) noexcept
void uint64_t uint64_t uint64_t *rdx noexcept
auto index(const T virt, const F from)
void set_if_exists(bool b, 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(bool b, 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 clear_bit(T t, B b) noexcept
Definition: bitmanip.h:36
void set_if_exists(T val, bool verbose=false) noexcept
auto set_vmcs_field(V val, A addr, const char *name, bool exists)
auto set_bit(T t, B b) noexcept
Definition: bitmanip.h:30
void set_if_exists(T val, bool verbose=false) noexcept
auto get_bits(T t, M m) noexcept
Definition: bitmanip.h:65
void set_if_exists(T val, bool verbose=false) noexcept
auto get_vmcs_field(T addr, const char *name, bool exists)
void set_if_exists(bool b, bool verbose=false) noexcept
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
void set_if_exists(T val, bool verbose=false) noexcept