test_vmcs_intel_x64.cpp
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 #include <gsl/gsl>
24 
25 #include <test.h>
26 
44 
45 #include <intrinsics/tss_x64.h>
46 #include <intrinsics/rflags_x64.h>
50 
51 using namespace x64;
52 using namespace intel_x64;
53 using namespace msrs;
54 using namespace vmcs;
55 
56 extern bool g_vmread_fails;
57 extern bool g_vmwrite_fails;
58 extern bool g_vmclear_fails;
59 extern bool g_vmload_fails;
60 extern size_t g_new_throws_bad_alloc;
61 
62 extern void setup_check_control_vmx_controls_all_paths(std::vector<struct control_flow_path> &cfg);
63 extern void setup_check_host_state_all_paths(std::vector<struct control_flow_path> &cfg);
64 extern void setup_check_guest_state_all_paths(std::vector<struct control_flow_path> &cfg);
65 
66 static struct control_flow_path path;
67 
68 static std::map<uint64_t, const char *> vm_instruction_error_codes
69 {
70  {
71  {1U, "VMCALL executed in VMX root operation"},
72  {2U, "VMCLEAR with invalid physical address"},
73  {3U, "VMCLEAR with VMXON pointer"},
74  {4U, "VMLAUNCH with non-clear VMCS"},
75  {5U, "VMRESUME with non-launched VMCS"},
76  {6U, "VMRESUME after VMXOFF (VMXOFF AND VMXON between VMLAUNCH and VMRESUME)"},
77  {7U, "VM entry with invalid control field(s)"},
78  {8U, "VM entry with invalid host-state field(s)"},
79  {9U, "VMPTRLD with invalid physical address"},
80  {10U, "VMPTRLD with VMXON pointer"},
81  {11U, "VMPTRLD with incorrect VMCS revision identifier"},
82  {12U, "VMREAD/VMWRITE from/to unsupported VMCS component"},
83  {13U, "VMWRITE to read-only VMCS component"},
84  {15U, "VMXON executed in VMX root operation"},
85  {16U, "VM entry with invalid executive-VMCS pointer"},
86  {17U, "VM entry with non-launched executive VMCS"},
87  {
88  18U, "VM entry with executive-VMCS pointer not VMXON pointer "
89  "(when attempting to deactivate the dual-monitor treatment of SMIs and SMM)"
90  },
91  {
92  19U, "VMCALL with non-clear VMCS (when attempting to activate"
93  " the dual-monitor treatment of SMIs and SMM)"
94  },
95  {20U, "VMCALL with invalid VM-exit control fields"},
96  {
97  22U, "VMCALL with incorrect MSEG revision identifier (when attempting "
98  "to activate the dual-monitor treatment of SMIs and SMM)"
99  },
100  {23U, "VMXOFF under dual-monitor treatment of SMIs and SMM"},
101  {
102  24U, "VMCALL with invalid SMM-monitor features (when attempting to "
103  "activate the dual-monitor treatment of SMIs and SMM)"
104  },
105  {
106  25U, "VM entry with invalid VM-execution control fields in executive"
107  " VMCS (when attempting to return from SMM)"
108  },
109  {26U, "VM entry with events blocked by MOV SS"},
110  {28U, "Invalid operand to INVEPT/INVVPID"},
111  {29U, "Unknown VM-instruction error"}
112  }
113 };
114 
115 static std::map<uint64_t, std::string> exit_reasons
116 {
117  {
118  {vmcs::exit_reason::basic_exit_reason::exception_or_non_maskable_interrupt, "exception_or_non_maskable_interrupt"_s},
151  {vmcs::exit_reason::basic_exit_reason::vm_entry_failure_invalid_guest_state, "vm_entry_failure_invalid_guest_state"_s},
152  {vmcs::exit_reason::basic_exit_reason::vm_entry_failure_msr_loading, "vm_entry_failure_msr_loading"_s},
157  {vmcs::exit_reason::basic_exit_reason::vm_entry_failure_machine_check_event, "vm_entry_failure_machine_check_event"_s},
167  {vmcs::exit_reason::basic_exit_reason::vmx_preemption_timer_expired, "vmx_preemption_timer_expired"_s},
178  {0x0000BEEF, "unknown"_s}
179  }
180 };
181 
182 static void
183 vmcs_promote_fail(bool state_save)
184 {
185  (void) state_save;
186  return;
187 }
188 
189 static void
190 vmcs_resume_fail(state_save_intel_x64 *state_save)
191 {
192  (void) state_save;
193  return;
194 }
195 
196 static void
197 setup_check_all_paths(std::vector<struct control_flow_path> &cfg)
198 {
199  std::vector<struct control_flow_path> sub_cfg;
200 
204 
205  path.setup = [sub_cfg]
206  {
207  for (const auto &sub_path : sub_cfg)
208  sub_path.setup();
209  };
210  path.throws_exception = false;
211  cfg.push_back(path);
212 }
213 
214 static void
215 setup_launch_success_msrs()
216 {
217  g_msrs[msrs::ia32_vmx_basic::addr] = 0x7FFFFFFUL;
218  g_msrs[msrs::ia32_vmx_true_pinbased_ctls::addr] = 0xffffffff00000000UL;
219  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
220  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
221  g_msrs[msrs::ia32_vmx_true_exit_ctls::addr] = 0xffffffff00000000UL;
222  g_msrs[msrs::ia32_vmx_true_entry_ctls::addr] = 0xffffffff00000000UL;
223 
225  g_msrs[msrs::ia32_vmx_cr0_fixed1::addr] = 0xffffffffffffffffUL;
227  g_msrs[msrs::ia32_vmx_cr4_fixed1::addr] = 0xffffffffffffffffUL;
228 
230 }
231 
232 static void
233 setup_vmcs_x64_state_intrinsics(MockRepository &mocks, vmcs_intel_x64_state *state_in)
234 {
235  mocks.OnCall(state_in, vmcs_intel_x64_state::es).Return(0x10);
236  mocks.OnCall(state_in, vmcs_intel_x64_state::cs).Return(0x10);
237  mocks.OnCall(state_in, vmcs_intel_x64_state::ss).Return(0x10);
238  mocks.OnCall(state_in, vmcs_intel_x64_state::ds).Return(0x10);
239  mocks.OnCall(state_in, vmcs_intel_x64_state::fs).Return(0x10);
240  mocks.OnCall(state_in, vmcs_intel_x64_state::gs).Return(0x10);
241  mocks.OnCall(state_in, vmcs_intel_x64_state::ldtr).Return(0x10);
242  mocks.OnCall(state_in, vmcs_intel_x64_state::tr).Return(0x10);
243 
244  mocks.OnCall(state_in, vmcs_intel_x64_state::gdt_limit).Return(0);
245  mocks.OnCall(state_in, vmcs_intel_x64_state::idt_limit).Return(0);
246 
247  mocks.OnCall(state_in, vmcs_intel_x64_state::es_limit).Return(0);
248  mocks.OnCall(state_in, vmcs_intel_x64_state::cs_limit).Return(0xFFFFFFFF);
249  mocks.OnCall(state_in, vmcs_intel_x64_state::ss_limit).Return(0xFFFFFFFF);
250  mocks.OnCall(state_in, vmcs_intel_x64_state::ds_limit).Return(0);
251  mocks.OnCall(state_in, vmcs_intel_x64_state::fs_limit).Return(0xFFFFFFFF);
252  mocks.OnCall(state_in, vmcs_intel_x64_state::gs_limit).Return(0xFFFFFFFF);
253  mocks.OnCall(state_in, vmcs_intel_x64_state::ldtr_limit).Return(0);
254  mocks.OnCall(state_in, vmcs_intel_x64_state::tr_limit).Return(sizeof(tss_x64));
255 
256  mocks.OnCall(state_in, vmcs_intel_x64_state::es_access_rights).Return(access_rights::unusable);
259  mocks.OnCall(state_in, vmcs_intel_x64_state::ds_access_rights).Return(access_rights::unusable);
264 
265  auto cr0 = 0UL;
266  cr0 |= cr0::paging::mask;
268 
269  auto cr4 = 0UL;
271 
272  auto rflags = 0UL;
275 
276  mocks.OnCall(state_in, vmcs_intel_x64_state::cr0).Return(cr0);
277  mocks.OnCall(state_in, vmcs_intel_x64_state::cr3).Return(0);
278  mocks.OnCall(state_in, vmcs_intel_x64_state::cr4).Return(cr4);
279  mocks.OnCall(state_in, vmcs_intel_x64_state::dr7).Return(0);
280  mocks.OnCall(state_in, vmcs_intel_x64_state::rflags).Return(rflags);
281  mocks.OnCall(state_in, vmcs_intel_x64_state::gdt_base).Return(0);
282  mocks.OnCall(state_in, vmcs_intel_x64_state::idt_base).Return(0);
283 
284  mocks.OnCall(state_in, vmcs_intel_x64_state::es_base).Return(0);
285  mocks.OnCall(state_in, vmcs_intel_x64_state::cs_base).Return(0);
286  mocks.OnCall(state_in, vmcs_intel_x64_state::ss_base).Return(0);
287  mocks.OnCall(state_in, vmcs_intel_x64_state::ds_base).Return(0);
288  mocks.OnCall(state_in, vmcs_intel_x64_state::ds_base).Return(0);
289  mocks.OnCall(state_in, vmcs_intel_x64_state::fs_base).Return(0);
290  mocks.OnCall(state_in, vmcs_intel_x64_state::gs_base).Return(0);
291  mocks.OnCall(state_in, vmcs_intel_x64_state::ldtr_base).Return(0);
292  mocks.OnCall(state_in, vmcs_intel_x64_state::tr_base).Return(0);
293 
294  auto efer = 0UL;
297 
298  mocks.OnCall(state_in, vmcs_intel_x64_state::ia32_debugctl_msr).Return(0);
299  mocks.OnCall(state_in, vmcs_intel_x64_state::ia32_pat_msr).Return(0);
300  mocks.OnCall(state_in, vmcs_intel_x64_state::ia32_efer_msr).Return(efer);
301  mocks.OnCall(state_in, vmcs_intel_x64_state::ia32_perf_global_ctrl_msr).Return(0);
302  mocks.OnCall(state_in, vmcs_intel_x64_state::ia32_sysenter_cs_msr).Return(0);
303  mocks.OnCall(state_in, vmcs_intel_x64_state::ia32_sysenter_esp_msr).Return(0);
304  mocks.OnCall(state_in, vmcs_intel_x64_state::ia32_sysenter_eip_msr).Return(0);
305  mocks.OnCall(state_in, vmcs_intel_x64_state::ia32_fs_base_msr).Return(0);
306  mocks.OnCall(state_in, vmcs_intel_x64_state::ia32_gs_base_msr).Return(0);
307 
308  mocks.OnCall(state_in, vmcs_intel_x64_state::is_guest).Return(false);
309  mocks.OnCall(state_in, vmcs_intel_x64_state::dump);
310 }
311 
312 static void
313 setup_vmcs_intrinsics(MockRepository &mocks, memory_manager_x64 *mm)
314 {
315  mocks.OnCallFunc(memory_manager_x64::instance).Return(mm);
318 }
319 
320 void
321 vmcs_ut::test_launch_success()
322 {
323  MockRepository mocks;
324  auto mm = mocks.Mock<memory_manager_x64>();
325  auto host_state = mocks.Mock<vmcs_intel_x64_state>();
326  auto guest_state = mocks.Mock<vmcs_intel_x64_state>();
327 
328  setup_vmcs_intrinsics(mocks, mm);
329  setup_vmcs_x64_state_intrinsics(mocks, host_state);
330  setup_vmcs_x64_state_intrinsics(mocks, guest_state);
331  setup_launch_success_msrs();
332 
333  RUN_UNITTEST_WITH_MOCKS(mocks, [&]
334  {
336 
337  this->expect_no_exception([&] { vmcs.launch(host_state, guest_state); });
338  });
339 }
340 
341 void
342 vmcs_ut::test_launch_vmlaunch_failure()
343 {
344  MockRepository mocks;
345  auto mm = mocks.Mock<memory_manager_x64>();
346  auto host_state = mocks.Mock<vmcs_intel_x64_state>();
347  auto guest_state = mocks.Mock<vmcs_intel_x64_state>();
348 
349  setup_vmcs_intrinsics(mocks, mm);
350  setup_vmcs_x64_state_intrinsics(mocks, host_state);
351  setup_vmcs_x64_state_intrinsics(mocks, guest_state);
352 
353  mocks.OnCall(guest_state, vmcs_intel_x64_state::is_guest).Return(true);
354  mocks.OnCallFunc(__vmwrite).Return(true);
355  Call &launch_call = mocks.ExpectCallFunc(vmcs_launch);
356  mocks.OnCallFunc(__vmwrite).After(launch_call).Do(__vmwrite);
357 
358  RUN_UNITTEST_WITH_MOCKS(mocks, [&]
359  {
361  std::vector<struct control_flow_path> cfg;
362 
363  setup_check_all_paths(cfg);
364 
365  for (const auto &sub_path : cfg)
366  sub_path.setup();
367 
368  this->expect_exception([&] { vmcs.launch(host_state, guest_state); }, ""_ut_ree);
369  });
370 }
371 
372 void
373 vmcs_ut::test_launch_vmlaunch_demote_failure()
374 {
375  MockRepository mocks;
376  auto mm = mocks.Mock<memory_manager_x64>();
377  auto host_state = mocks.Mock<vmcs_intel_x64_state>();
378  auto guest_state = mocks.Mock<vmcs_intel_x64_state>();
379 
380  setup_vmcs_intrinsics(mocks, mm);
381  setup_vmcs_x64_state_intrinsics(mocks, host_state);
382  setup_vmcs_x64_state_intrinsics(mocks, guest_state);
383 
384  mocks.OnCallFunc(__vmwrite).Return(true);
385  Call &launch_call = mocks.ExpectCallFunc(__vmlaunch_demote).Return(false);
386  mocks.OnCallFunc(__vmwrite).After(launch_call).Do(__vmwrite);
387 
388  RUN_UNITTEST_WITH_MOCKS(mocks, [&]
389  {
391  std::vector<struct control_flow_path> cfg;
392 
393  setup_check_all_paths(cfg);
394 
395  for (const auto &sub_path : cfg)
396  sub_path.setup();
397 
398  this->expect_exception([&] { vmcs.launch(host_state, guest_state); }, ""_ut_ree);
399  });
400 }
401 
402 void
403 vmcs_ut::test_launch_create_vmcs_region_failure()
404 {
405  MockRepository mocks;
406  auto mm = mocks.Mock<memory_manager_x64>();
407  auto host_state = mocks.Mock<vmcs_intel_x64_state>();
408  auto guest_state = mocks.Mock<vmcs_intel_x64_state>();
409 
410  setup_vmcs_intrinsics(mocks, mm);
411  setup_vmcs_x64_state_intrinsics(mocks, host_state);
412  setup_vmcs_x64_state_intrinsics(mocks, guest_state);
413 
414  auto ___ = gsl::finally([&]
415  { g_virt_to_phys_return_nullptr = false; });
416 
418 
419  RUN_UNITTEST_WITH_MOCKS(mocks, [&]
420  {
422  this->expect_exception([&]{ vmcs.launch(host_state, guest_state); }, ""_ut_ffe);
423  });
424 }
425 
426 void
427 vmcs_ut::test_launch_create_exit_handler_stack_failure()
428 {
429  MockRepository mocks;
430  auto mm = mocks.Mock<memory_manager_x64>();
431  auto host_state = mocks.Mock<vmcs_intel_x64_state>();
432  auto guest_state = mocks.Mock<vmcs_intel_x64_state>();
433 
434  setup_vmcs_intrinsics(mocks, mm);
435 
436  RUN_UNITTEST_WITH_MOCKS(mocks, [&]
437  {
439 
440  auto ___ = gsl::finally([&]
441  { g_new_throws_bad_alloc = 0; });
442 
444 
445  this->expect_exception([&] { vmcs.launch(host_state, guest_state); }, ""_ut_bae);
446  });
447 }
448 
449 void
450 vmcs_ut::test_launch_clear_failure()
451 {
452  MockRepository mocks;
453  auto mm = mocks.Mock<memory_manager_x64>();
454  auto host_state = mocks.Mock<vmcs_intel_x64_state>();
455  auto guest_state = mocks.Mock<vmcs_intel_x64_state>();
456 
457  setup_vmcs_intrinsics(mocks, mm);
458 
459  RUN_UNITTEST_WITH_MOCKS(mocks, [&]
460  {
462 
463  auto ___ = gsl::finally([&]
464  { g_vmclear_fails = false; });
465 
466  g_vmclear_fails = true;
467  this->expect_exception([&]{ vmcs.launch(host_state, guest_state); }, ""_ut_ree);
468  });
469 }
470 
471 void
472 vmcs_ut::test_launch_load_failure()
473 {
474  MockRepository mocks;
475  auto mm = mocks.Mock<memory_manager_x64>();
476  auto host_state = mocks.Mock<vmcs_intel_x64_state>();
477  auto guest_state = mocks.Mock<vmcs_intel_x64_state>();
478 
479  setup_vmcs_intrinsics(mocks, mm);
480 
481  RUN_UNITTEST_WITH_MOCKS(mocks, [&]
482  {
484 
485  auto ___ = gsl::finally([&]
486  { g_vmload_fails = false; });
487 
488  g_vmload_fails = true;
489  this->expect_exception([&]{ vmcs.launch(host_state, guest_state); }, ""_ut_ree);
490  });
491 }
492 
493 void
494 vmcs_ut::test_promote_failure()
495 {
496  MockRepository mocks;
497  mocks.OnCallFunc(vmcs_promote).Do(vmcs_promote_fail);
498 
499  RUN_UNITTEST_WITH_MOCKS(mocks, [&]
500  {
502 
503  this->expect_exception([&] { vmcs.promote(); }, ""_ut_ree);
504  });
505 }
506 
507 void
508 vmcs_ut::test_resume_failure()
509 {
510  MockRepository mocks;
511  mocks.OnCallFunc(vmcs_resume).Do(vmcs_resume_fail);
512 
513  RUN_UNITTEST_WITH_MOCKS(mocks, [&]
514  {
516  this->expect_exception([&] { vmcs.resume(); }, ""_ut_ree);
517  });
518 }
519 
520 void
521 vmcs_ut::test_get_vmcs_field()
522 {
523  constexpr const auto name = "field";
524  auto exists = true;
525 
526  this->expect_exception([&] { get_vmcs_field(0U, name, !exists); }, ""_ut_lee);
527 
528  g_vmcs_fields[0U] = 42U;
529  this->expect_true(get_vmcs_field(0U, name, exists) == 42U);
530 }
531 
532 void
533 vmcs_ut::test_get_vmcs_field_if_exists()
534 {
535  constexpr const auto name = "field";
536 
537  auto exists = true;
538  auto verbose = true;
539  g_vmcs_fields[0U] = 42U;
540 
541  this->expect_true(get_vmcs_field_if_exists(0U, name, verbose, !exists) == 0U);
542  this->expect_true(get_vmcs_field_if_exists(0U, name, verbose, exists) == 42U);
543 }
544 
545 void
546 vmcs_ut::test_set_vmcs_field()
547 {
548  constexpr const auto name("field");
549  auto exists = true;
550  g_vmcs_fields[0U] = 0U;
551 
552  this->expect_exception([&] { set_vmcs_field(1U, 0U, name, !exists); }, ""_ut_lee);
553  this->expect_true(g_vmcs_fields[0U] == 0U);
554 
555  this->expect_no_exception([&] { set_vmcs_field(1U, 0U, name, exists); });
556  this->expect_true(g_vmcs_fields[0U] == 1U);
557 }
558 
559 void
560 vmcs_ut::test_set_vmcs_field_if_exists()
561 {
562  constexpr const auto name("field");
563  auto exists = true;
564  auto verbose = true;
565  g_vmcs_fields[0U] = 42U;
566 
567  this->expect_no_exception([&] { set_vmcs_field_if_exists(0U, 0U, name, !verbose, !exists); });
568  this->expect_true(g_vmcs_fields[0U] == 42U);
569 
570  this->expect_no_exception([&] { set_vmcs_field_if_exists(0U, 0U, name, verbose, !exists); });
571  this->expect_true(g_vmcs_fields[0U] == 42U);
572 
573  this->expect_no_exception([&] { set_vmcs_field_if_exists(0U, 0U, name, !verbose, exists); });
574  this->expect_true(g_vmcs_fields[0U] == 0U);
575 
576  this->expect_no_exception([&] { set_vmcs_field_if_exists(1U, 0U, name, verbose, exists); });
577  this->expect_true(g_vmcs_fields[0U] == 1U);
578 }
579 
580 void
581 vmcs_ut::test_set_vm_control()
582 {
583  constexpr const auto name = "control";
584  auto exists = true;
585  auto mask = 0x0000000000000040UL;
586  auto ctls_addr = 0UL;
587  auto msr_addr = 0U;
588 
589  this->expect_exception([&] { set_vm_control(1UL, msr_addr, ctls_addr, name, mask, !exists); }, ""_ut_lee);
590 
591  g_msrs[msr_addr] = ~mask;
592  this->expect_no_exception([&] { set_vm_control(0UL, msr_addr, ctls_addr, name, mask, exists); });
593  this->expect_true((g_vmcs_fields[ctls_addr] & mask) == 0UL);
594 
595  g_msrs[msr_addr] = mask;
596  this->expect_exception([&] { set_vm_control(0UL, msr_addr, ctls_addr, name, mask, exists); }, ""_ut_lee);
597 
598  g_msrs[msr_addr] = mask << 32;
599  this->expect_no_exception([&] { set_vm_control(1UL, msr_addr, ctls_addr, name, mask, exists); });
600  this->expect_true((g_vmcs_fields[ctls_addr] & mask) != 0UL);
601 
602  g_msrs[msr_addr] = ~(mask << 32);
603  this->expect_exception([&] { set_vm_control(1UL, msr_addr, ctls_addr, name, mask, exists); }, ""_ut_lee);
604 }
605 
606 void
607 vmcs_ut::test_set_vm_control_if_allowed()
608 {
609  constexpr const auto name = "control";
610  auto exists = true;
611  auto verbose = true;
612  auto mask = 0x0000000000000040UL;
613  auto ctls_addr = 0UL;
614  auto msr_addr = 0U;
615 
616  this->expect_no_exception([&] { set_vm_control_if_allowed(1UL, msr_addr, ctls_addr, name, mask, verbose, !exists); });
617 
618  g_vmcs_fields[ctls_addr] = mask;
619  g_msrs[msr_addr] = ~mask;
620 
621  this->expect_no_exception([&] { set_vm_control_if_allowed(0UL, msr_addr, ctls_addr, name, mask, verbose, exists); });
622  this->expect_true((g_vmcs_fields[ctls_addr] & mask) == 0UL);
623 
624  g_msrs[msr_addr] = mask;
625  this->expect_no_exception([&] { set_vm_control_if_allowed(0UL, msr_addr, ctls_addr, name, mask, verbose, exists); });
626 
627  g_msrs[msr_addr] = mask << 32;
628  this->expect_no_exception([&] { set_vm_control_if_allowed(1UL, msr_addr, ctls_addr, name, mask, verbose, exists); });
629  this->expect_true((g_vmcs_fields[ctls_addr] & mask) != 0UL);
630 
631  g_msrs[msr_addr] = ~(mask << 32);
632  this->expect_no_exception([&] { set_vm_control_if_allowed(1UL, msr_addr, ctls_addr, name, mask, verbose, exists); });
633 }
634 
635 void
636 vmcs_ut::test_set_vm_function_control()
637 {
638  constexpr const auto name = "control";
639  auto exists = true;
640  auto mask = 0x0000000000000040UL;
641  auto ctls_addr = 0UL;
642  auto msr_addr = 0U;
643 
644  this->expect_exception([&] { set_vm_function_control(true, msr_addr, ctls_addr, name, mask, !exists); }, ""_ut_lee);
645  this->expect_no_exception([&] { set_vm_function_control(false, msr_addr, ctls_addr, name, mask, exists); });
646 
647  g_msrs[msr_addr] = mask;
648  this->expect_no_exception([&] { set_vm_function_control(true, msr_addr, ctls_addr, name, mask, exists); });
649 
650  g_msrs[msr_addr] = ~mask;
651  this->expect_exception([&] { set_vm_function_control(true, msr_addr, ctls_addr, name, mask, exists); }, ""_ut_lee);
652 }
653 
654 void
655 vmcs_ut::test_set_vm_function_control_if_allowed()
656 {
657  constexpr const auto name = "control";
658  auto exists = true;
659  auto verbose = true;
660  auto mask = 0x0000000000000040UL;
661  auto ctls_addr = 0UL;
662  auto msr_addr = 0U;
663 
664  this->expect_no_exception([&] { set_vm_function_control_if_allowed(true, msr_addr, ctls_addr, name, mask, verbose, !exists); });
665  this->expect_no_exception([&] { set_vm_function_control_if_allowed(false, msr_addr, ctls_addr, name, mask, verbose, exists); });
666 
667  g_msrs[msr_addr] = mask;
668  this->expect_no_exception([&] { set_vm_function_control_if_allowed(true, msr_addr, ctls_addr, name, mask, verbose, exists); });
669 
670  g_msrs[msr_addr] = ~mask;
671  this->expect_no_exception([&] { set_vm_function_control_if_allowed(true, msr_addr, ctls_addr, name, mask, verbose, exists); });
672 }
673 
674 void
675 vmcs_ut::test_vmcs_vm_instruction_error_description()
676 {
677  using namespace vmcs::vm_instruction_error;
678 
679  bool exists = true;
680 
681  this->expect_exception([&] { vm_instruction_error_description(0UL, !exists); }, ""_ut_lee);
682  this->expect_true(vm_instruction_error_description(1UL, exists) == "VMCALL executed in VMX root operation"_s);
683 }
684 
685 void
686 vmcs_ut::test_vmcs_vm_instruction_error_description_if_exists()
687 {
688  using namespace vmcs::vm_instruction_error;
689 
690  bool exists = true;
691  bool verbose = true;
692 
693  this->expect_no_exception([&] { vm_instruction_error_description_if_exists(0UL, verbose, !exists); });
694  this->expect_true(vm_instruction_error_description_if_exists(0UL, verbose, !exists) == ""_s);
695  this->expect_true(vm_instruction_error_description_if_exists(1UL, verbose, exists) == "VMCALL executed in VMX root operation"_s);
696 }
697 
698 void
699 vmcs_ut::test_vmcs_exit_reason_basic_exit_reason_description()
700 {
701  using namespace vmcs::exit_reason;
702 
703  bool exists = true;
704 
705  this->expect_exception([&] { basic_exit_reason::basic_exit_reason_description(0UL, !exists); }, ""_ut_lee);
707 }
708 
709 void
710 vmcs_ut::test_vmcs_exit_reason_basic_exit_reason_description_if_exists()
711 {
712  using namespace vmcs::exit_reason;
713 
714  bool exists = true;
715  bool verbose = true;
716 
718  this->expect_true(basic_exit_reason::basic_exit_reason_description_if_exists(0UL, verbose, !exists) == ""_s);
720 }
721 
722 void
723 vmcs_ut::test_vmcs_virtual_processor_identifier()
724 {
728 
730  this->expect_true(vmcs::virtual_processor_identifier::get() == 100UL);
731 
734 
737  this->expect_exception([&] { vmcs::virtual_processor_identifier::set(1UL); }, ""_ut_lee);
738  this->expect_exception([&] { vmcs::virtual_processor_identifier::get(); }, ""_ut_lee);
741 
743  this->expect_true(vmcs::virtual_processor_identifier::get() == 200UL);
744 }
745 
746 void
747 vmcs_ut::test_vmcs_posted_interrupt_notification_vector()
748 {
751 
753  this->expect_true(vmcs::posted_interrupt_notification_vector::get() == 100UL);
754 
757 
760 }
761 
762 void
763 vmcs_ut::test_vmcs_eptp_index()
764 {
768 
769  vmcs::eptp_index::set(100UL);
770  this->expect_true(vmcs::eptp_index::get() == 100UL);
771 
774 
777  this->expect_exception([&] { vmcs::eptp_index::set(1UL); }, ""_ut_lee);
778  this->expect_exception([&] { vmcs::eptp_index::get(); }, ""_ut_lee);
781 
783  this->expect_true(vmcs::eptp_index::get() == 200UL);
784 }
785 
786 void
787 vmcs_ut::test_vmcs_guest_es_selector()
788 {
790  this->expect_true(vmcs::guest_es_selector::get() == 100UL);
792 
795 }
796 
797 void
798 vmcs_ut::test_vmcs_guest_es_selector_rpl()
799 {
801  this->expect_true(vmcs::guest_es_selector::rpl::get() == 1UL);
802 
804  this->expect_true(vmcs::guest_es_selector::rpl::get() == 0UL);
805 
808 
811 }
812 
813 void
814 vmcs_ut::test_vmcs_guest_es_selector_ti()
815 {
817  this->expect_true(vmcs::guest_es_selector::ti::get());
818 
820  this->expect_false(vmcs::guest_es_selector::ti::get());
821 
824 
827 }
828 
829 void
830 vmcs_ut::test_vmcs_guest_es_selector_index()
831 {
833  this->expect_true(vmcs::guest_es_selector::index::get() == 1UL);
834 
836  this->expect_true(vmcs::guest_es_selector::index::get() == 0UL);
837 
840 
843 }
844 
845 void
846 vmcs_ut::test_vmcs_guest_cs_selector()
847 {
849 
850  this->expect_true(vmcs::guest_cs_selector::get() == 100UL);
852 
855 }
856 
857 void
858 vmcs_ut::test_vmcs_guest_cs_selector_rpl()
859 {
861  this->expect_true(vmcs::guest_cs_selector::rpl::get() == 1UL);
862 
864  this->expect_true(vmcs::guest_cs_selector::rpl::get() == 0UL);
865 
868 
871 }
872 
873 void
874 vmcs_ut::test_vmcs_guest_cs_selector_ti()
875 {
877  this->expect_true(vmcs::guest_cs_selector::ti::get());
878 
880  this->expect_false(vmcs::guest_cs_selector::ti::get());
881 
884 
887 }
888 
889 void
890 vmcs_ut::test_vmcs_guest_cs_selector_index()
891 {
893  this->expect_true(vmcs::guest_cs_selector::index::get() == 1UL);
894 
896  this->expect_true(vmcs::guest_cs_selector::index::get() == 0UL);
897 
900 
903 }
904 
905 void
906 vmcs_ut::test_vmcs_guest_ss_selector()
907 {
909 
910  this->expect_true(vmcs::guest_ss_selector::get() == 100UL);
912 
915 }
916 
917 void
918 vmcs_ut::test_vmcs_guest_ss_selector_rpl()
919 {
921  this->expect_true(vmcs::guest_ss_selector::rpl::get() == 1UL);
922 
924  this->expect_true(vmcs::guest_ss_selector::rpl::get() == 0UL);
925 
928 
931 }
932 
933 void
934 vmcs_ut::test_vmcs_guest_ss_selector_ti()
935 {
937  this->expect_true(vmcs::guest_ss_selector::ti::get());
938 
940  this->expect_false(vmcs::guest_ss_selector::ti::get());
941 
944 
947 }
948 
949 void
950 vmcs_ut::test_vmcs_guest_ss_selector_index()
951 {
953  this->expect_true(vmcs::guest_ss_selector::index::get() == 1UL);
954 
956  this->expect_true(vmcs::guest_ss_selector::index::get() == 0UL);
957 
960 
963 }
964 
965 void
966 vmcs_ut::test_vmcs_guest_ds_selector()
967 {
969 
970  this->expect_true(vmcs::guest_ds_selector::get() == 100UL);
972 
975 }
976 
977 void
978 vmcs_ut::test_vmcs_guest_ds_selector_rpl()
979 {
981  this->expect_true(vmcs::guest_ds_selector::rpl::get() == 1UL);
982 
984  this->expect_true(vmcs::guest_ds_selector::rpl::get() == 0UL);
985 
988 
991 }
992 
993 void
994 vmcs_ut::test_vmcs_guest_ds_selector_ti()
995 {
997  this->expect_true(vmcs::guest_ds_selector::ti::get());
998 
1000  this->expect_false(vmcs::guest_ds_selector::ti::get());
1001 
1004 
1007 }
1008 
1009 void
1010 vmcs_ut::test_vmcs_guest_ds_selector_index()
1011 {
1013  this->expect_true(vmcs::guest_ds_selector::index::get() == 1UL);
1014 
1016  this->expect_true(vmcs::guest_ds_selector::index::get() == 0UL);
1017 
1020 
1023 }
1024 
1025 void
1026 vmcs_ut::test_vmcs_guest_fs_selector()
1027 {
1029 
1030  this->expect_true(vmcs::guest_fs_selector::get() == 100UL);
1032 
1035 }
1036 
1037 void
1038 vmcs_ut::test_vmcs_guest_fs_selector_rpl()
1039 {
1041  this->expect_true(vmcs::guest_fs_selector::rpl::get() == 1UL);
1042 
1044  this->expect_true(vmcs::guest_fs_selector::rpl::get() == 0UL);
1045 
1048 
1051 }
1052 
1053 void
1054 vmcs_ut::test_vmcs_guest_fs_selector_ti()
1055 {
1057  this->expect_true(vmcs::guest_fs_selector::ti::get());
1058 
1060  this->expect_false(vmcs::guest_fs_selector::ti::get());
1061 
1064 
1067 }
1068 
1069 void
1070 vmcs_ut::test_vmcs_guest_fs_selector_index()
1071 {
1073  this->expect_true(vmcs::guest_fs_selector::index::get() == 1UL);
1074 
1076  this->expect_true(vmcs::guest_fs_selector::index::get() == 0UL);
1077 
1080 
1083 }
1084 
1085 void
1086 vmcs_ut::test_vmcs_guest_gs_selector()
1087 {
1089 
1090  this->expect_true(vmcs::guest_gs_selector::get() == 100UL);
1092 
1095 }
1096 
1097 void
1098 vmcs_ut::test_vmcs_guest_gs_selector_rpl()
1099 {
1101  this->expect_true(vmcs::guest_gs_selector::rpl::get() == 1UL);
1102 
1104  this->expect_true(vmcs::guest_gs_selector::rpl::get() == 0UL);
1105 
1108 
1111 }
1112 
1113 void
1114 vmcs_ut::test_vmcs_guest_gs_selector_ti()
1115 {
1117  this->expect_true(vmcs::guest_gs_selector::ti::get());
1118 
1120  this->expect_false(vmcs::guest_gs_selector::ti::get());
1121 
1124 
1127 }
1128 
1129 void
1130 vmcs_ut::test_vmcs_guest_gs_selector_index()
1131 {
1133  this->expect_true(vmcs::guest_gs_selector::index::get() == 1UL);
1134 
1136  this->expect_true(vmcs::guest_gs_selector::index::get() == 0UL);
1137 
1140 
1143 }
1144 
1145 void
1146 vmcs_ut::test_vmcs_guest_ldtr_selector()
1147 {
1149 
1150  this->expect_true(vmcs::guest_ldtr_selector::get() == 100UL);
1152 
1155 }
1156 
1157 void
1158 vmcs_ut::test_vmcs_guest_ldtr_selector_rpl()
1159 {
1161  this->expect_true(vmcs::guest_ldtr_selector::rpl::get() == 1UL);
1162 
1164  this->expect_true(vmcs::guest_ldtr_selector::rpl::get() == 0UL);
1165 
1168 
1171 }
1172 
1173 void
1174 vmcs_ut::test_vmcs_guest_ldtr_selector_ti()
1175 {
1177  this->expect_true(vmcs::guest_ldtr_selector::ti::get());
1178 
1180  this->expect_false(vmcs::guest_ldtr_selector::ti::get());
1181 
1184 
1187 }
1188 
1189 void
1190 vmcs_ut::test_vmcs_guest_ldtr_selector_index()
1191 {
1193  this->expect_true(vmcs::guest_ldtr_selector::index::get() == 1UL);
1194 
1196  this->expect_true(vmcs::guest_ldtr_selector::index::get() == 0UL);
1197 
1200 
1203 }
1204 
1205 void
1206 vmcs_ut::test_vmcs_guest_tr_selector()
1207 {
1209 
1210  this->expect_true(vmcs::guest_tr_selector::get() == 100UL);
1212 
1215 }
1216 
1217 void
1218 vmcs_ut::test_vmcs_guest_tr_selector_rpl()
1219 {
1221  this->expect_true(vmcs::guest_tr_selector::rpl::get() == 1UL);
1222 
1224  this->expect_true(vmcs::guest_tr_selector::rpl::get() == 0UL);
1225 
1228 
1231 }
1232 
1233 void
1234 vmcs_ut::test_vmcs_guest_tr_selector_ti()
1235 {
1237  this->expect_true(vmcs::guest_tr_selector::ti::get());
1238 
1240  this->expect_false(vmcs::guest_tr_selector::ti::get());
1241 
1244 
1247 }
1248 
1249 void
1250 vmcs_ut::test_vmcs_guest_tr_selector_index()
1251 {
1253  this->expect_true(vmcs::guest_tr_selector::index::get() == 1UL);
1254 
1256  this->expect_true(vmcs::guest_tr_selector::index::get() == 0UL);
1257 
1260 
1263 }
1264 
1265 void
1266 vmcs_ut::test_vmcs_guest_interrupt_status()
1267 {
1270 
1272 
1274  this->expect_true(vmcs::guest_interrupt_status::get() == 100UL);
1275 
1278 
1281  this->expect_exception([&] { vmcs::guest_interrupt_status::set(1UL); }, ""_ut_lee);
1282  this->expect_exception([&] { vmcs::guest_interrupt_status::get(); }, ""_ut_lee);
1285 
1287  this->expect_true(vmcs::guest_interrupt_status::get() == 200UL);
1288 }
1289 
1290 void
1291 vmcs_ut::test_vmcs_host_es_selector()
1292 {
1294 
1295  this->expect_true(vmcs::host_es_selector::get() == 100UL);
1297 
1299 
1301 }
1302 
1303 void
1304 vmcs_ut::test_vmcs_host_es_selector_rpl()
1305 {
1307  this->expect_true(vmcs::host_es_selector::rpl::get() == 1UL);
1308 
1310  this->expect_true(vmcs::host_es_selector::rpl::get() == 0UL);
1311 
1314 
1317 }
1318 
1319 void
1320 vmcs_ut::test_vmcs_host_es_selector_ti()
1321 {
1323  this->expect_true(vmcs::host_es_selector::ti::get());
1324 
1326  this->expect_false(vmcs::host_es_selector::ti::get());
1327 
1330 
1333 }
1334 
1335 void
1336 vmcs_ut::test_vmcs_host_es_selector_index()
1337 {
1339  this->expect_true(vmcs::host_es_selector::index::get() == 1UL);
1340 
1342  this->expect_true(vmcs::host_es_selector::index::get() == 0UL);
1343 
1346 
1349 }
1350 
1351 void
1352 vmcs_ut::test_vmcs_host_cs_selector()
1353 {
1355 
1356  this->expect_true(vmcs::host_cs_selector::get() == 100UL);
1358 
1360 
1362 }
1363 
1364 void
1365 vmcs_ut::test_vmcs_host_cs_selector_rpl()
1366 {
1368  this->expect_true(vmcs::host_cs_selector::rpl::get() == 1UL);
1369 
1371  this->expect_true(vmcs::host_cs_selector::rpl::get() == 0UL);
1372 
1375 
1378 }
1379 
1380 void
1381 vmcs_ut::test_vmcs_host_cs_selector_ti()
1382 {
1384  this->expect_true(vmcs::host_cs_selector::ti::get());
1385 
1387  this->expect_false(vmcs::host_cs_selector::ti::get());
1388 
1391 
1394 }
1395 
1396 void
1397 vmcs_ut::test_vmcs_host_cs_selector_index()
1398 {
1400  this->expect_true(vmcs::host_cs_selector::index::get() == 1UL);
1401 
1403  this->expect_true(vmcs::host_cs_selector::index::get() == 0UL);
1404 
1407 
1410 }
1411 
1412 void
1413 vmcs_ut::test_vmcs_host_ss_selector()
1414 {
1416 
1417  this->expect_true(vmcs::host_ss_selector::get() == 100UL);
1419 
1421 
1423 }
1424 
1425 void
1426 vmcs_ut::test_vmcs_host_ss_selector_rpl()
1427 {
1429  this->expect_true(vmcs::host_ss_selector::rpl::get() == 1UL);
1430 
1432  this->expect_true(vmcs::host_ss_selector::rpl::get() == 0UL);
1433 
1436 
1439 }
1440 
1441 void
1442 vmcs_ut::test_vmcs_host_ss_selector_ti()
1443 {
1445  this->expect_true(vmcs::host_ss_selector::ti::get());
1446 
1448  this->expect_false(vmcs::host_ss_selector::ti::get());
1449 
1452 
1455 }
1456 
1457 void
1458 vmcs_ut::test_vmcs_host_ss_selector_index()
1459 {
1461  this->expect_true(vmcs::host_ss_selector::index::get() == 1UL);
1462 
1464  this->expect_true(vmcs::host_ss_selector::index::get() == 0UL);
1465 
1468 
1471 }
1472 
1473 void
1474 vmcs_ut::test_vmcs_host_ds_selector()
1475 {
1477 
1478  this->expect_true(vmcs::host_ds_selector::get() == 100UL);
1480 
1482 
1484 }
1485 
1486 void
1487 vmcs_ut::test_vmcs_host_ds_selector_rpl()
1488 {
1490  this->expect_true(vmcs::host_ds_selector::rpl::get() == 1UL);
1491 
1493  this->expect_true(vmcs::host_ds_selector::rpl::get() == 0UL);
1494 
1497 
1500 }
1501 
1502 void
1503 vmcs_ut::test_vmcs_host_ds_selector_ti()
1504 {
1506  this->expect_true(vmcs::host_ds_selector::ti::get());
1507 
1509  this->expect_false(vmcs::host_ds_selector::ti::get());
1510 
1513 
1516 }
1517 
1518 void
1519 vmcs_ut::test_vmcs_host_ds_selector_index()
1520 {
1522  this->expect_true(vmcs::host_ds_selector::index::get() == 1UL);
1523 
1525  this->expect_true(vmcs::host_ds_selector::index::get() == 0UL);
1526 
1529 
1532 }
1533 
1534 void
1535 vmcs_ut::test_vmcs_host_fs_selector()
1536 {
1538 
1539  this->expect_true(vmcs::host_fs_selector::get() == 100UL);
1541 
1543 
1545 }
1546 
1547 void
1548 vmcs_ut::test_vmcs_host_fs_selector_rpl()
1549 {
1551  this->expect_true(vmcs::host_fs_selector::rpl::get() == 1UL);
1552 
1554  this->expect_true(vmcs::host_fs_selector::rpl::get() == 0UL);
1555 
1558 
1561 }
1562 
1563 void
1564 vmcs_ut::test_vmcs_host_fs_selector_ti()
1565 {
1567  this->expect_true(vmcs::host_fs_selector::ti::get());
1568 
1570  this->expect_false(vmcs::host_fs_selector::ti::get());
1571 
1574 
1577 }
1578 
1579 void
1580 vmcs_ut::test_vmcs_host_fs_selector_index()
1581 {
1583  this->expect_true(vmcs::host_fs_selector::index::get() == 1UL);
1584 
1586  this->expect_true(vmcs::host_fs_selector::index::get() == 0UL);
1587 
1590 
1593 }
1594 
1595 void
1596 vmcs_ut::test_vmcs_host_gs_selector()
1597 {
1599 
1600  this->expect_true(vmcs::host_gs_selector::get() == 100UL);
1602 
1604 
1606 }
1607 
1608 void
1609 vmcs_ut::test_vmcs_host_gs_selector_rpl()
1610 {
1612  this->expect_true(vmcs::host_gs_selector::rpl::get() == 1UL);
1613 
1615  this->expect_true(vmcs::host_gs_selector::rpl::get() == 0UL);
1616 
1619 
1622 }
1623 
1624 void
1625 vmcs_ut::test_vmcs_host_gs_selector_ti()
1626 {
1628  this->expect_true(vmcs::host_gs_selector::ti::get());
1629 
1631  this->expect_false(vmcs::host_gs_selector::ti::get());
1632 
1635 
1638 }
1639 
1640 void
1641 vmcs_ut::test_vmcs_host_gs_selector_index()
1642 {
1644  this->expect_true(vmcs::host_gs_selector::index::get() == 1UL);
1645 
1647  this->expect_true(vmcs::host_gs_selector::index::get() == 0UL);
1648 
1651 
1654 }
1655 
1656 void
1657 vmcs_ut::test_vmcs_host_tr_selector()
1658 {
1660 
1661  this->expect_true(vmcs::host_tr_selector::get() == 100UL);
1663 
1665 
1667 }
1668 
1669 void
1670 vmcs_ut::test_vmcs_host_tr_selector_rpl()
1671 {
1673  this->expect_true(vmcs::host_tr_selector::rpl::get() == 1UL);
1674 
1676  this->expect_true(vmcs::host_tr_selector::rpl::get() == 0UL);
1677 
1680 
1683 }
1684 
1685 void
1686 vmcs_ut::test_vmcs_host_tr_selector_ti()
1687 {
1689  this->expect_true(vmcs::host_tr_selector::ti::get());
1690 
1692  this->expect_false(vmcs::host_tr_selector::ti::get());
1693 
1696 
1699 }
1700 
1701 void
1702 vmcs_ut::test_vmcs_host_tr_selector_index()
1703 {
1705  this->expect_true(vmcs::host_tr_selector::index::get() == 1UL);
1706 
1708  this->expect_true(vmcs::host_tr_selector::index::get() == 0UL);
1709 
1712 
1715 }
1716 
1717 void
1718 vmcs_ut::test_vmcs_address_of_io_bitmap_a()
1719 {
1721 
1723  this->expect_true(vmcs::address_of_io_bitmap_a::get() == 1UL);
1724 
1727 }
1728 
1729 void
1730 vmcs_ut::test_vmcs_address_of_io_bitmap_b()
1731 {
1733 
1735  this->expect_true(vmcs::address_of_io_bitmap_b::get() == 1UL);
1736 
1739 }
1740 
1741 void
1742 vmcs_ut::test_vmcs_address_of_msr_bitmap()
1743 {
1746 
1748  this->expect_true(vmcs::address_of_msr_bitmap::get() == 1UL);
1749 
1752 }
1753 
1754 void
1755 vmcs_ut::test_vmcs_vm_exit_msr_store_address()
1756 {
1758 
1760  this->expect_true(vmcs::vm_exit_msr_store_address::get() == 1UL);
1761 
1764 }
1765 
1766 void
1767 vmcs_ut::test_vmcs_vm_exit_msr_load_address()
1768 {
1770 
1772  this->expect_true(vmcs::vm_exit_msr_load_address::get() == 1UL);
1773 
1776 }
1777 
1778 void
1779 vmcs_ut::test_vmcs_vm_entry_msr_load_address()
1780 {
1782 
1784  this->expect_true(vmcs::vm_entry_msr_load_address::get() == 1UL);
1785 
1788 }
1789 
1790 void
1791 vmcs_ut::test_vmcs_executive_vmcs_pointer()
1792 {
1794 
1796  this->expect_true(vmcs::executive_vmcs_pointer::get() == 1UL);
1797 
1800 }
1801 
1802 void
1803 vmcs_ut::test_vmcs_pml_address()
1804 {
1808 
1810  this->expect_true(vmcs::pml_address::get() == 1UL);
1811 
1814 
1817 
1818  this->expect_exception([&] { vmcs::pml_address::set(42U); }, ""_ut_lee);
1819  this->expect_exception([&] { vmcs::pml_address::get(); }, ""_ut_lee);
1820 
1823  this->expect_true(g_vmcs_fields[vmcs::pml_address::addr] == 0UL);
1824 }
1825 
1826 void
1827 vmcs_ut::test_vmcs_tsc_offset()
1828 {
1830 
1831  vmcs::tsc_offset::set(1UL);
1832  this->expect_true(vmcs::tsc_offset::get() == 1UL);
1833 
1836 }
1837 
1838 void
1839 vmcs_ut::test_vmcs_virtual_apic_address()
1840 {
1843 
1845  this->expect_true(vmcs::virtual_apic_address::get() == 1UL);
1846 
1849 }
1850 
1851 void
1852 vmcs_ut::test_vmcs_apic_access_address()
1853 {
1857 
1859  this->expect_true(vmcs::apic_access_address::get() == 1UL);
1860 
1863 
1866 
1867  this->expect_exception([&] { vmcs::apic_access_address::set(42U); }, ""_ut_lee);
1868  this->expect_exception([&] { vmcs::apic_access_address::get(); }, ""_ut_lee);
1869 
1872  this->expect_true(g_vmcs_fields[vmcs::apic_access_address::addr] == 0UL);
1873 }
1874 
1875 void
1876 vmcs_ut::test_vmcs_posted_interrupt_descriptor_address()
1877 {
1880 
1882  this->expect_true(vmcs::posted_interrupt_descriptor_address::get() == 1UL);
1883 
1886 }
1887 
1888 void
1889 vmcs_ut::test_vmcs_vm_function_controls()
1890 {
1894 
1896  this->expect_true(vmcs::vm_function_controls::get() == 1UL);
1897 
1900 
1903 
1904  this->expect_exception([&] { vmcs::vm_function_controls::set(42U); }, ""_ut_lee);
1905  this->expect_exception([&] { vmcs::vm_function_controls::get(); }, ""_ut_lee);
1906 
1909  this->expect_true(g_vmcs_fields[vmcs::vm_function_controls::addr] == 0UL);
1910 }
1911 
1912 void
1913 vmcs_ut::test_vmcs_vm_function_controls_eptp_switching()
1914 {
1918 
1921 
1924 
1927 
1930 }
1931 
1932 void
1933 vmcs_ut::test_vmcs_vm_function_controls_reserved()
1934 {
1937 
1939  this->expect_true(vmcs::vm_function_controls::reserved::get() == 0xEU);
1940 
1943 }
1944 
1945 void
1946 vmcs_ut::test_vmcs_ept_pointer()
1947 {
1951 
1953  this->expect_true(vmcs::ept_pointer::get() == 1UL);
1954 
1957 
1960 
1961  this->expect_exception([&] { vmcs::ept_pointer::set(42U); }, ""_ut_lee);
1962  this->expect_exception([&] { vmcs::ept_pointer::get(); }, ""_ut_lee);
1963 
1966  this->expect_true(g_vmcs_fields[vmcs::ept_pointer::addr] == 0UL);
1967 }
1968 
1969 void
1970 vmcs_ut::test_vmcs_ept_pointer_memory_type()
1971 {
1974 
1976  this->expect_true(vmcs::ept_pointer::memory_type::get() == vmcs::ept_pointer::memory_type::uncacheable);
1977 
1980 
1982  this->expect_exception([&] { vmcs::ept_pointer::memory_type::set(42U); }, ""_ut_lee);
1983  this->expect_exception([&] { vmcs::ept_pointer::memory_type::get(); }, ""_ut_lee);
1984 
1987 }
1988 
1989 void
1990 vmcs_ut::test_vmcs_ept_pointer_page_walk_length_minus_one()
1991 {
1994 
1996  this->expect_true(vmcs::ept_pointer::page_walk_length_minus_one::get() == 2UL);
1997 
2000 
2003  this->expect_exception([&] { vmcs::ept_pointer::page_walk_length_minus_one::get(); }, ""_ut_lee);
2004 
2007 }
2008 
2009 void
2010 vmcs_ut::test_vmcs_ept_pointer_accessed_and_dirty_flags()
2011 {
2014 
2017 
2020 
2023 
2026 }
2027 
2028 void
2029 vmcs_ut::test_vmcs_ept_pointer_phys_addr()
2030 {
2033 
2034  vmcs::ept_pointer::phys_addr::set(0x0000ABCDEF123000UL);
2035  this->expect_true(vmcs::ept_pointer::phys_addr::get() == 0x0000ABCDEF123000UL);
2036 
2039 }
2040 
2041 void
2042 vmcs_ut::test_vmcs_ept_pointer_reserved()
2043 {
2046 
2048  this->expect_true(vmcs::ept_pointer::reserved::get() == 0x80U);
2049 
2052 }
2053 
2054 void
2055 vmcs_ut::test_vmcs_eoi_exit_bitmap_0()
2056 {
2060 
2062  this->expect_true(vmcs::eoi_exit_bitmap_0::get() == 1UL);
2063 
2066 
2069 
2070  this->expect_exception([&] { vmcs::eoi_exit_bitmap_0::set(42U); }, ""_ut_lee);
2071  this->expect_exception([&] { vmcs::eoi_exit_bitmap_0::get(); }, ""_ut_lee);
2072 
2075  this->expect_true(g_vmcs_fields[vmcs::eoi_exit_bitmap_0::addr] == 0UL);
2076 }
2077 
2078 void
2079 vmcs_ut::test_vmcs_eoi_exit_bitmap_1()
2080 {
2084 
2086  this->expect_true(vmcs::eoi_exit_bitmap_1::get() == 1UL);
2087 
2090 
2093 
2094  this->expect_exception([&] { vmcs::eoi_exit_bitmap_1::set(42U); }, ""_ut_lee);
2095  this->expect_exception([&] { vmcs::eoi_exit_bitmap_1::get(); }, ""_ut_lee);
2096 
2099  this->expect_true(g_vmcs_fields[vmcs::eoi_exit_bitmap_1::addr] == 0UL);
2100 }
2101 
2102 void
2103 vmcs_ut::test_vmcs_eoi_exit_bitmap_2()
2104 {
2108 
2110  this->expect_true(vmcs::eoi_exit_bitmap_2::get() == 1UL);
2111 
2114 
2117 
2118  this->expect_exception([&] { vmcs::eoi_exit_bitmap_2::set(42U); }, ""_ut_lee);
2119  this->expect_exception([&] { vmcs::eoi_exit_bitmap_2::get(); }, ""_ut_lee);
2120 
2123  this->expect_true(g_vmcs_fields[vmcs::eoi_exit_bitmap_2::addr] == 0UL);
2124 }
2125 
2126 void
2127 vmcs_ut::test_vmcs_eoi_exit_bitmap_3()
2128 {
2132 
2134  this->expect_true(vmcs::eoi_exit_bitmap_3::get() == 1UL);
2135 
2138 
2141 
2142  this->expect_exception([&] { vmcs::eoi_exit_bitmap_3::set(42U); }, ""_ut_lee);
2143  this->expect_exception([&] { vmcs::eoi_exit_bitmap_3::get(); }, ""_ut_lee);
2144 
2147  this->expect_true(g_vmcs_fields[vmcs::eoi_exit_bitmap_3::addr] == 0UL);
2148 }
2149 
2150 void
2151 vmcs_ut::test_vmcs_eptp_list_address()
2152 {
2157 
2159  this->expect_true(vmcs::eptp_list_address::get() == 1UL);
2160 
2163 
2166 
2167  this->expect_exception([&] { vmcs::eptp_list_address::set(42U); }, ""_ut_lee);
2168  this->expect_exception([&] { vmcs::eptp_list_address::get(); }, ""_ut_lee);
2169 
2172  this->expect_true(g_vmcs_fields[vmcs::eptp_list_address::addr] == 0UL);
2173 }
2174 
2175 void
2176 vmcs_ut::test_vmcs_vmread_bitmap_address()
2177 {
2181 
2183  this->expect_true(vmcs::vmread_bitmap_address::get() == 1UL);
2184 
2187 
2190 
2191  this->expect_exception([&] { vmcs::vmread_bitmap_address::set(42U); }, ""_ut_lee);
2192  this->expect_exception([&] { vmcs::vmread_bitmap_address::get(); }, ""_ut_lee);
2193 
2196  this->expect_true(g_vmcs_fields[vmcs::vmread_bitmap_address::addr] == 0UL);
2197 }
2198 
2199 void
2200 vmcs_ut::test_vmcs_vmwrite_bitmap_address()
2201 {
2205 
2207  this->expect_true(vmcs::vmwrite_bitmap_address::get() == 1UL);
2208 
2211 
2214 
2215  this->expect_exception([&] { vmcs::vmwrite_bitmap_address::set(42U); }, ""_ut_lee);
2216  this->expect_exception([&] { vmcs::vmwrite_bitmap_address::get(); }, ""_ut_lee);
2217 
2220  this->expect_true(g_vmcs_fields[vmcs::vmwrite_bitmap_address::addr] == 0UL);
2221 }
2222 
2223 void
2224 vmcs_ut::test_vmcs_virtualization_exception_information_address()
2225 {
2229 
2231  this->expect_true(vmcs::virtualization_exception_information_address::get() == 1UL);
2232 
2235 
2238 
2240  this->expect_exception([&] { vmcs::virtualization_exception_information_address::get(); }, ""_ut_lee);
2241 
2245 }
2246 
2247 void
2248 vmcs_ut::test_vmcs_xss_exiting_bitmap()
2249 {
2253 
2255  this->expect_true(vmcs::xss_exiting_bitmap::get() == 1UL);
2256 
2259 
2262 
2263  this->expect_exception([&] { vmcs::xss_exiting_bitmap::set(42U); }, ""_ut_lee);
2264  this->expect_exception([&] { vmcs::xss_exiting_bitmap::get(); }, ""_ut_lee);
2265 
2268  this->expect_true(g_vmcs_fields[vmcs::xss_exiting_bitmap::addr] == 0UL);
2269 }
2270 
2271 void
2272 vmcs_ut::test_vmcs_vmcs_link_pointer()
2273 {
2275 
2277  this->expect_true(vmcs::vmcs_link_pointer::get() == 1UL);
2278 
2281 }
2282 
2283 void
2284 vmcs_ut::test_vmcs_guest_ia32_debugctl()
2285 {
2287 
2289  this->expect_true(vmcs::guest_ia32_debugctl::get() == 1UL);
2290 
2293 }
2294 
2295 void
2296 vmcs_ut::test_vmcs_guest_ia32_debugctl_lbr()
2297 {
2300 
2303 
2306 
2309 }
2310 
2311 void
2312 vmcs_ut::test_vmcs_guest_ia32_debugctl_btf()
2313 {
2316 
2319 
2322 
2325 }
2326 
2327 void
2328 vmcs_ut::test_vmcs_guest_ia32_debugctl_tr()
2329 {
2332 
2335 
2338 
2341 }
2342 
2343 void
2344 vmcs_ut::test_vmcs_guest_ia32_debugctl_bts()
2345 {
2348 
2351 
2354 
2357 }
2358 
2359 void
2360 vmcs_ut::test_vmcs_guest_ia32_debugctl_btint()
2361 {
2364 
2367 
2370 
2373 }
2374 
2375 void
2376 vmcs_ut::test_vmcs_guest_ia32_debugctl_bt_off_os()
2377 {
2380 
2383 
2386 
2389 }
2390 
2391 void
2392 vmcs_ut::test_vmcs_guest_ia32_debugctl_bt_off_user()
2393 {
2396 
2399 
2402 
2405 }
2406 
2407 void
2408 vmcs_ut::test_vmcs_guest_ia32_debugctl_freeze_lbrs_on_pmi()
2409 {
2412 
2415 
2418 
2421 }
2422 
2423 
2424 void
2425 vmcs_ut::test_vmcs_guest_ia32_debugctl_freeze_perfmon_on_pmi()
2426 {
2429 
2432 
2435 
2438 }
2439 
2440 void
2441 vmcs_ut::test_vmcs_guest_ia32_debugctl_enable_uncore_pmi()
2442 {
2445 
2448 
2451 
2454 }
2455 
2456 void
2457 vmcs_ut::test_vmcs_guest_ia32_debugctl_freeze_while_smm()
2458 {
2461 
2464 
2467 
2470 }
2471 
2472 void
2473 vmcs_ut::test_vmcs_guest_ia32_debugctl_rtm_debug()
2474 {
2477 
2480 
2483 
2486 }
2487 
2488 void
2489 vmcs_ut::test_vmcs_guest_ia32_debugctl_reserved()
2490 {
2492  this->expect_true(vmcs::guest_ia32_debugctl::reserved::get() == 0xCU);
2493 
2496 }
2497 
2498 void
2499 vmcs_ut::test_vmcs_guest_ia32_pat()
2500 {
2503 
2505  this->expect_true(vmcs::guest_ia32_pat::get() == 1UL);
2506 
2509 }
2510 
2511 void
2512 vmcs_ut::test_vmcs_guest_ia32_pat_pa0()
2513 {
2515 
2517  this->expect_true(vmcs::guest_ia32_pat::pa0::get() == 1UL);
2518 
2521 }
2522 
2523 void
2524 vmcs_ut::test_vmcs_guest_ia32_pat_pa0_memory_type()
2525 {
2526  using namespace vmcs::guest_ia32_pat;
2528 
2530  this->expect_true(pa0::memory_type::get() == x64::memory_type::uncacheable);
2531 
2533  this->expect_true(pa0::memory_type::get() == x64::memory_type::write_combining);
2534 
2536  this->expect_true(pa0::memory_type::get() == x64::memory_type::write_through);
2537 
2540 
2543 
2546 }
2547 
2548 void
2549 vmcs_ut::test_vmcs_guest_ia32_pat_pa0_reserved()
2550 {
2552 
2554  this->expect_true(vmcs::guest_ia32_pat::pa0::reserved::get() == 1UL);
2555 
2558 }
2559 
2560 void
2561 vmcs_ut::test_vmcs_guest_ia32_pat_pa1()
2562 {
2564 
2566  this->expect_true(vmcs::guest_ia32_pat::pa1::get() == 1UL);
2567 
2570 }
2571 
2572 void
2573 vmcs_ut::test_vmcs_guest_ia32_pat_pa1_memory_type()
2574 {
2575  using namespace vmcs::guest_ia32_pat;
2577 
2579  this->expect_true(pa1::memory_type::get() == x64::memory_type::uncacheable);
2580 
2582  this->expect_true(pa1::memory_type::get() == x64::memory_type::write_combining);
2583 
2585  this->expect_true(pa1::memory_type::get() == x64::memory_type::write_through);
2586 
2589 
2592 
2595 }
2596 
2597 void
2598 vmcs_ut::test_vmcs_guest_ia32_pat_pa1_reserved()
2599 {
2601 
2603  this->expect_true(vmcs::guest_ia32_pat::pa1::reserved::get() == 1UL);
2604 
2607 }
2608 
2609 void
2610 vmcs_ut::test_vmcs_guest_ia32_pat_pa2()
2611 {
2613 
2615  this->expect_true(vmcs::guest_ia32_pat::pa2::get() == 1UL);
2616 
2619 }
2620 
2621 void
2622 vmcs_ut::test_vmcs_guest_ia32_pat_pa2_memory_type()
2623 {
2624  using namespace vmcs::guest_ia32_pat;
2626 
2628  this->expect_true(pa2::memory_type::get() == x64::memory_type::uncacheable);
2629 
2631  this->expect_true(pa2::memory_type::get() == x64::memory_type::write_combining);
2632 
2634  this->expect_true(pa2::memory_type::get() == x64::memory_type::write_through);
2635 
2638 
2641 
2644 }
2645 
2646 void
2647 vmcs_ut::test_vmcs_guest_ia32_pat_pa2_reserved()
2648 {
2650 
2652  this->expect_true(vmcs::guest_ia32_pat::pa2::reserved::get() == 1UL);
2653 
2656 }
2657 
2658 void
2659 vmcs_ut::test_vmcs_guest_ia32_pat_pa3()
2660 {
2662 
2664  this->expect_true(vmcs::guest_ia32_pat::pa3::get() == 1UL);
2665 
2668 }
2669 
2670 void
2671 vmcs_ut::test_vmcs_guest_ia32_pat_pa3_memory_type()
2672 {
2673  using namespace vmcs::guest_ia32_pat;
2675 
2677  this->expect_true(pa3::memory_type::get() == x64::memory_type::uncacheable);
2678 
2680  this->expect_true(pa3::memory_type::get() == x64::memory_type::write_combining);
2681 
2683  this->expect_true(pa3::memory_type::get() == x64::memory_type::write_through);
2684 
2687 
2690 
2693 }
2694 
2695 void
2696 vmcs_ut::test_vmcs_guest_ia32_pat_pa3_reserved()
2697 {
2699 
2701  this->expect_true(vmcs::guest_ia32_pat::pa3::reserved::get() == 1UL);
2702 
2705 }
2706 
2707 void
2708 vmcs_ut::test_vmcs_guest_ia32_pat_pa4()
2709 {
2711 
2713  this->expect_true(vmcs::guest_ia32_pat::pa4::get() == 1UL);
2714 
2717 }
2718 
2719 void
2720 vmcs_ut::test_vmcs_guest_ia32_pat_pa4_memory_type()
2721 {
2722  using namespace vmcs::guest_ia32_pat;
2724 
2726  this->expect_true(pa4::memory_type::get() == x64::memory_type::uncacheable);
2727 
2729  this->expect_true(pa4::memory_type::get() == x64::memory_type::write_combining);
2730 
2732  this->expect_true(pa4::memory_type::get() == x64::memory_type::write_through);
2733 
2736 
2739 
2742 }
2743 
2744 void
2745 vmcs_ut::test_vmcs_guest_ia32_pat_pa4_reserved()
2746 {
2748 
2750  this->expect_true(vmcs::guest_ia32_pat::pa4::reserved::get() == 1UL);
2751 
2754 }
2755 
2756 void
2757 vmcs_ut::test_vmcs_guest_ia32_pat_pa5()
2758 {
2760 
2762  this->expect_true(vmcs::guest_ia32_pat::pa5::get() == 1UL);
2763 
2766 }
2767 
2768 void
2769 vmcs_ut::test_vmcs_guest_ia32_pat_pa5_memory_type()
2770 {
2771  using namespace vmcs::guest_ia32_pat;
2773 
2775  this->expect_true(pa5::memory_type::get() == x64::memory_type::uncacheable);
2776 
2778  this->expect_true(pa5::memory_type::get() == x64::memory_type::write_combining);
2779 
2781  this->expect_true(pa5::memory_type::get() == x64::memory_type::write_through);
2782 
2785 
2788 
2791 }
2792 
2793 void
2794 vmcs_ut::test_vmcs_guest_ia32_pat_pa5_reserved()
2795 {
2797 
2799  this->expect_true(vmcs::guest_ia32_pat::pa5::reserved::get() == 1UL);
2800 
2803 }
2804 
2805 void
2806 vmcs_ut::test_vmcs_guest_ia32_pat_pa6()
2807 {
2809 
2811  this->expect_true(vmcs::guest_ia32_pat::pa6::get() == 1UL);
2812 
2815 }
2816 
2817 void
2818 vmcs_ut::test_vmcs_guest_ia32_pat_pa6_memory_type()
2819 {
2820  using namespace vmcs::guest_ia32_pat;
2822 
2824  this->expect_true(pa6::memory_type::get() == x64::memory_type::uncacheable);
2825 
2827  this->expect_true(pa6::memory_type::get() == x64::memory_type::write_combining);
2828 
2830  this->expect_true(pa6::memory_type::get() == x64::memory_type::write_through);
2831 
2834 
2837 
2840 }
2841 
2842 void
2843 vmcs_ut::test_vmcs_guest_ia32_pat_pa6_reserved()
2844 {
2846 
2848  this->expect_true(vmcs::guest_ia32_pat::pa6::reserved::get() == 1UL);
2849 
2852 }
2853 
2854 void
2855 vmcs_ut::test_vmcs_guest_ia32_pat_pa7()
2856 {
2858 
2860  this->expect_true(vmcs::guest_ia32_pat::pa7::get() == 1UL);
2861 
2864 }
2865 
2866 void
2867 vmcs_ut::test_vmcs_guest_ia32_pat_pa7_memory_type()
2868 {
2869  using namespace vmcs::guest_ia32_pat;
2871 
2873  this->expect_true(pa7::memory_type::get() == x64::memory_type::uncacheable);
2874 
2876  this->expect_true(pa7::memory_type::get() == x64::memory_type::write_combining);
2877 
2879  this->expect_true(pa7::memory_type::get() == x64::memory_type::write_through);
2880 
2883 
2886 
2889 }
2890 
2891 void
2892 vmcs_ut::test_vmcs_guest_ia32_pat_pa7_reserved()
2893 {
2895 
2897  this->expect_true(vmcs::guest_ia32_pat::pa7::reserved::get() == 1UL);
2898 
2901 }
2902 
2903 void
2904 vmcs_ut::test_vmcs_guest_ia32_efer()
2905 {
2908 
2910  this->expect_true(vmcs::guest_ia32_efer::get() == 1UL);
2911 
2914 }
2915 
2916 void
2917 vmcs_ut::test_vmcs_guest_ia32_efer_sce()
2918 {
2920 
2923 
2926 
2929 
2932 }
2933 
2934 void
2935 vmcs_ut::test_vmcs_guest_ia32_efer_lme()
2936 {
2938 
2941 
2944 
2947 
2950 }
2951 
2952 void
2953 vmcs_ut::test_vmcs_guest_ia32_efer_lma()
2954 {
2956 
2959 
2962 
2965 
2968 }
2969 
2970 void
2971 vmcs_ut::test_vmcs_guest_ia32_efer_nxe()
2972 {
2974 
2977 
2980 
2983 
2986 }
2987 
2988 void
2989 vmcs_ut::test_vmcs_guest_ia32_efer_reserved()
2990 {
2992 
2994  this->expect_true(vmcs::guest_ia32_efer::reserved::get() == 0xEU);
2995 
2998 }
2999 
3000 void
3001 vmcs_ut::test_vmcs_guest_ia32_perf_global_ctrl()
3002 {
3005 
3007  this->expect_true(vmcs::guest_ia32_perf_global_ctrl::get() == 1UL);
3008 
3011 }
3012 
3013 void
3014 vmcs_ut::test_vmcs_guest_ia32_perf_global_ctrl_reserved()
3015 {
3018 
3020  this->expect_true(vmcs::guest_ia32_perf_global_ctrl::reserved::get() == 0xCUL);
3021 
3024 }
3025 
3026 void
3027 vmcs_ut::test_vmcs_guest_pdpte0()
3028 {
3031 
3033 
3035  this->expect_true(vmcs::guest_pdpte0::get() == 1UL);
3036 
3039 }
3040 
3041 void
3042 vmcs_ut::test_vmcs_guest_pdpte0_present()
3043 {
3046 
3049 
3052 
3055 
3058 }
3059 
3060 void
3061 vmcs_ut::test_vmcs_guest_pdpte0_reserved()
3062 {
3065 
3067  this->expect_true(vmcs::guest_pdpte0::reserved::get() == 6U);
3068 
3069  vmcs::guest_pdpte0::reserved::set_if_exists(0x8000000000000000U);
3070  this->expect_true(vmcs::guest_pdpte0::reserved::get_if_exists() == 0x8000000000000000U);
3071 }
3072 
3073 void
3074 vmcs_ut::test_vmcs_guest_pdpte0_pwt()
3075 {
3078 
3081 
3084 
3087 
3090 }
3091 
3092 void
3093 vmcs_ut::test_vmcs_guest_pdpte0_pcd()
3094 {
3097 
3100 
3103 
3106 
3109 }
3110 
3111 void
3112 vmcs_ut::test_vmcs_guest_pdpte0_page_directory_addr()
3113 {
3117 
3119  this->expect_true(vmcs::guest_pdpte0::page_directory_addr::get() == 0x100000000UL);
3120 
3123 }
3124 
3125 void
3126 vmcs_ut::test_vmcs_guest_pdpte1()
3127 {
3130 
3132 
3134  this->expect_true(vmcs::guest_pdpte1::get() == 1UL);
3135 
3138 }
3139 
3140 void
3141 vmcs_ut::test_vmcs_guest_pdpte1_present()
3142 {
3145 
3148 
3151 
3154 
3157 }
3158 
3159 void
3160 vmcs_ut::test_vmcs_guest_pdpte1_reserved()
3161 {
3164 
3166  this->expect_true(vmcs::guest_pdpte1::reserved::get() == 6U);
3167 
3168  vmcs::guest_pdpte1::reserved::set_if_exists(0x8000000000000000U);
3169  this->expect_true(vmcs::guest_pdpte1::reserved::get_if_exists() == 0x8000000000000000U);
3170 }
3171 
3172 void
3173 vmcs_ut::test_vmcs_guest_pdpte1_pwt()
3174 {
3177 
3180 
3183 
3186 
3189 }
3190 
3191 void
3192 vmcs_ut::test_vmcs_guest_pdpte1_pcd()
3193 {
3196 
3199 
3202 
3205 
3208 }
3209 
3210 void
3211 vmcs_ut::test_vmcs_guest_pdpte1_page_directory_addr()
3212 {
3216 
3218  this->expect_true(vmcs::guest_pdpte1::page_directory_addr::get() == 0x100000000UL);
3219 
3222 }
3223 
3224 void
3225 vmcs_ut::test_vmcs_guest_pdpte2()
3226 {
3229 
3231 
3233  this->expect_true(vmcs::guest_pdpte2::get() == 1UL);
3234 
3237 }
3238 
3239 void
3240 vmcs_ut::test_vmcs_guest_pdpte2_present()
3241 {
3244 
3247 
3250 
3253 
3256 }
3257 
3258 void
3259 vmcs_ut::test_vmcs_guest_pdpte2_reserved()
3260 {
3263 
3265  this->expect_true(vmcs::guest_pdpte2::reserved::get() == 6U);
3266 
3267  vmcs::guest_pdpte2::reserved::set_if_exists(0x8000000000000000U);
3268  this->expect_true(vmcs::guest_pdpte2::reserved::get_if_exists() == 0x8000000000000000U);
3269 }
3270 
3271 void
3272 vmcs_ut::test_vmcs_guest_pdpte2_pwt()
3273 {
3276 
3279 
3282 
3285 
3288 }
3289 
3290 void
3291 vmcs_ut::test_vmcs_guest_pdpte2_pcd()
3292 {
3295 
3298 
3301 
3304 
3307 }
3308 
3309 void
3310 vmcs_ut::test_vmcs_guest_pdpte2_page_directory_addr()
3311 {
3315 
3317  this->expect_true(vmcs::guest_pdpte2::page_directory_addr::get() == 0x100000000UL);
3318 
3321 }
3322 
3323 void
3324 vmcs_ut::test_vmcs_guest_pdpte3()
3325 {
3328 
3330 
3332  this->expect_true(vmcs::guest_pdpte3::get() == 1UL);
3333 
3336 }
3337 
3338 void
3339 vmcs_ut::test_vmcs_guest_pdpte3_present()
3340 {
3343 
3346 
3349 
3352 
3355 }
3356 
3357 void
3358 vmcs_ut::test_vmcs_guest_pdpte3_reserved()
3359 {
3362 
3364  this->expect_true(vmcs::guest_pdpte3::reserved::get() == 6U);
3365 
3366  vmcs::guest_pdpte3::reserved::set_if_exists(0x8000000000000000U);
3367  this->expect_true(vmcs::guest_pdpte3::reserved::get_if_exists() == 0x8000000000000000U);
3368 }
3369 
3370 void
3371 vmcs_ut::test_vmcs_guest_pdpte3_pwt()
3372 {
3375 
3378 
3381 
3384 
3387 }
3388 
3389 void
3390 vmcs_ut::test_vmcs_guest_pdpte3_pcd()
3391 {
3394 
3397 
3400 
3403 
3406 }
3407 
3408 void
3409 vmcs_ut::test_vmcs_guest_pdpte3_page_directory_addr()
3410 {
3414 
3416  this->expect_true(vmcs::guest_pdpte3::page_directory_addr::get() == 0x100000000UL);
3417 
3420 }
3421 
3422 void
3423 vmcs_ut::test_vmcs_guest_ia32_bndcfgs()
3424 {
3427 
3431 
3433  this->expect_true(vmcs::guest_ia32_bndcfgs::get() == 1UL);
3434 
3437 }
3438 
3439 void
3440 vmcs_ut::test_vmcs_guest_ia32_bndcfgs_en()
3441 {
3443 
3446 
3449 
3452 
3455 }
3456 
3457 void
3458 vmcs_ut::test_vmcs_guest_ia32_bndcfgs_bndpreserve()
3459 {
3461 
3464 
3467 
3470 
3473 }
3474 
3475 void
3476 vmcs_ut::test_vmcs_guest_ia32_bndcfgs_reserved()
3477 {
3479 
3481  this->expect_true(vmcs::guest_ia32_bndcfgs::reserved::get() == 0xCUL);
3482 
3485 }
3486 
3487 void
3488 vmcs_ut::test_vmcs_guest_ia32_bndcfgs_base_addr_of_bnd_directory()
3489 {
3491 
3493  this->expect_true(vmcs::guest_ia32_bndcfgs::base_addr_of_bnd_directory::get() == 0x100000UL);
3494 
3497 }
3498 
3499 void
3500 vmcs_ut::test_vmcs_guest_physical_address()
3501 {
3505 
3506  g_vmcs_fields[vmcs::guest_physical_address::addr] = 0x1U;
3507  this->expect_true(vmcs::guest_physical_address::get() == 0x1U);
3508 
3509  g_vmcs_fields[vmcs::guest_physical_address::addr] = 0x2U;
3511 
3514  this->expect_exception([&] { vmcs::guest_physical_address::get(); }, ""_ut_lee);
3516 }
3517 
3518 void
3519 vmcs_ut::test_vmcs_host_ia32_pat()
3520 {
3523 
3525  this->expect_true(vmcs::host_ia32_pat::get() == 1UL);
3526 
3529 }
3530 
3531 void
3532 vmcs_ut::test_vmcs_host_ia32_pat_pa0()
3533 {
3535 
3537  this->expect_true(vmcs::host_ia32_pat::pa0::get() == 1UL);
3538 
3541 }
3542 
3543 void
3544 vmcs_ut::test_vmcs_host_ia32_pat_pa0_memory_type()
3545 {
3546  using namespace vmcs::host_ia32_pat;
3548 
3550  this->expect_true(pa0::memory_type::get() == x64::memory_type::uncacheable);
3551 
3553  this->expect_true(pa0::memory_type::get() == x64::memory_type::write_combining);
3554 
3556  this->expect_true(pa0::memory_type::get() == x64::memory_type::write_through);
3557 
3560 
3563 
3566 }
3567 
3568 void
3569 vmcs_ut::test_vmcs_host_ia32_pat_pa0_reserved()
3570 {
3572 
3574  this->expect_true(vmcs::host_ia32_pat::pa0::reserved::get() == 1UL);
3575 
3578 }
3579 
3580 void
3581 vmcs_ut::test_vmcs_host_ia32_pat_pa1()
3582 {
3584 
3586  this->expect_true(vmcs::host_ia32_pat::pa1::get() == 1UL);
3587 
3590 }
3591 
3592 void
3593 vmcs_ut::test_vmcs_host_ia32_pat_pa1_memory_type()
3594 {
3595  using namespace vmcs::host_ia32_pat;
3597 
3599  this->expect_true(pa1::memory_type::get() == x64::memory_type::uncacheable);
3600 
3602  this->expect_true(pa1::memory_type::get() == x64::memory_type::write_combining);
3603 
3605  this->expect_true(pa1::memory_type::get() == x64::memory_type::write_through);
3606 
3609 
3612 
3615 }
3616 
3617 void
3618 vmcs_ut::test_vmcs_host_ia32_pat_pa1_reserved()
3619 {
3621 
3623  this->expect_true(vmcs::host_ia32_pat::pa1::reserved::get() == 1UL);
3624 
3627 }
3628 
3629 void
3630 vmcs_ut::test_vmcs_host_ia32_pat_pa2()
3631 {
3633 
3635  this->expect_true(vmcs::host_ia32_pat::pa2::get() == 1UL);
3636 
3639 }
3640 
3641 void
3642 vmcs_ut::test_vmcs_host_ia32_pat_pa2_memory_type()
3643 {
3644  using namespace vmcs::host_ia32_pat;
3646 
3648  this->expect_true(pa2::memory_type::get() == x64::memory_type::uncacheable);
3649 
3651  this->expect_true(pa2::memory_type::get() == x64::memory_type::write_combining);
3652 
3654  this->expect_true(pa2::memory_type::get() == x64::memory_type::write_through);
3655 
3658 
3661 
3664 }
3665 
3666 void
3667 vmcs_ut::test_vmcs_host_ia32_pat_pa2_reserved()
3668 {
3670 
3672  this->expect_true(vmcs::host_ia32_pat::pa2::reserved::get() == 1UL);
3673 
3676 }
3677 
3678 void
3679 vmcs_ut::test_vmcs_host_ia32_pat_pa3()
3680 {
3682 
3684  this->expect_true(vmcs::host_ia32_pat::pa3::get() == 1UL);
3685 
3688 }
3689 
3690 void
3691 vmcs_ut::test_vmcs_host_ia32_pat_pa3_memory_type()
3692 {
3693  using namespace vmcs::host_ia32_pat;
3695 
3697  this->expect_true(pa3::memory_type::get() == x64::memory_type::uncacheable);
3698 
3700  this->expect_true(pa3::memory_type::get() == x64::memory_type::write_combining);
3701 
3703  this->expect_true(pa3::memory_type::get() == x64::memory_type::write_through);
3704 
3707 
3710 
3713 }
3714 
3715 void
3716 vmcs_ut::test_vmcs_host_ia32_pat_pa3_reserved()
3717 {
3719 
3721  this->expect_true(vmcs::host_ia32_pat::pa3::reserved::get() == 1UL);
3722 
3725 }
3726 
3727 void
3728 vmcs_ut::test_vmcs_host_ia32_pat_pa4()
3729 {
3731 
3733  this->expect_true(vmcs::host_ia32_pat::pa4::get() == 1UL);
3734 
3737 }
3738 
3739 void
3740 vmcs_ut::test_vmcs_host_ia32_pat_pa4_memory_type()
3741 {
3742  using namespace vmcs::host_ia32_pat;
3744 
3746  this->expect_true(pa4::memory_type::get() == x64::memory_type::uncacheable);
3747 
3749  this->expect_true(pa4::memory_type::get() == x64::memory_type::write_combining);
3750 
3752  this->expect_true(pa4::memory_type::get() == x64::memory_type::write_through);
3753 
3756 
3759 
3762 }
3763 
3764 void
3765 vmcs_ut::test_vmcs_host_ia32_pat_pa4_reserved()
3766 {
3768 
3770  this->expect_true(vmcs::host_ia32_pat::pa4::reserved::get() == 1UL);
3771 
3774 }
3775 
3776 void
3777 vmcs_ut::test_vmcs_host_ia32_pat_pa5()
3778 {
3780 
3782  this->expect_true(vmcs::host_ia32_pat::pa5::get() == 1UL);
3783 
3786 }
3787 
3788 void
3789 vmcs_ut::test_vmcs_host_ia32_pat_pa5_memory_type()
3790 {
3791  using namespace vmcs::host_ia32_pat;
3793 
3795  this->expect_true(pa5::memory_type::get() == x64::memory_type::uncacheable);
3796 
3798  this->expect_true(pa5::memory_type::get() == x64::memory_type::write_combining);
3799 
3801  this->expect_true(pa5::memory_type::get() == x64::memory_type::write_through);
3802 
3805 
3808 
3811 }
3812 
3813 void
3814 vmcs_ut::test_vmcs_host_ia32_pat_pa5_reserved()
3815 {
3817 
3819  this->expect_true(vmcs::host_ia32_pat::pa5::reserved::get() == 1UL);
3820 
3823 }
3824 
3825 void
3826 vmcs_ut::test_vmcs_host_ia32_pat_pa6()
3827 {
3829 
3831  this->expect_true(vmcs::host_ia32_pat::pa6::get() == 1UL);
3832 
3835 }
3836 
3837 void
3838 vmcs_ut::test_vmcs_host_ia32_pat_pa6_memory_type()
3839 {
3840  using namespace vmcs::host_ia32_pat;
3842 
3844  this->expect_true(pa6::memory_type::get() == x64::memory_type::uncacheable);
3845 
3847  this->expect_true(pa6::memory_type::get() == x64::memory_type::write_combining);
3848 
3850  this->expect_true(pa6::memory_type::get() == x64::memory_type::write_through);
3851 
3854 
3857 
3860 }
3861 
3862 void
3863 vmcs_ut::test_vmcs_host_ia32_pat_pa6_reserved()
3864 {
3866 
3868  this->expect_true(vmcs::host_ia32_pat::pa6::reserved::get() == 1UL);
3869 
3872 }
3873 
3874 void
3875 vmcs_ut::test_vmcs_host_ia32_pat_pa7()
3876 {
3878 
3880  this->expect_true(vmcs::host_ia32_pat::pa7::get() == 1UL);
3881 
3884 }
3885 
3886 void
3887 vmcs_ut::test_vmcs_host_ia32_pat_pa7_memory_type()
3888 {
3889  using namespace vmcs::host_ia32_pat;
3891 
3893  this->expect_true(pa7::memory_type::get() == x64::memory_type::uncacheable);
3894 
3896  this->expect_true(pa7::memory_type::get() == x64::memory_type::write_combining);
3897 
3899  this->expect_true(pa7::memory_type::get() == x64::memory_type::write_through);
3900 
3903 
3906 
3909 }
3910 
3911 void
3912 vmcs_ut::test_vmcs_host_ia32_pat_pa7_reserved()
3913 {
3915 
3917  this->expect_true(vmcs::host_ia32_pat::pa7::reserved::get() == 1UL);
3918 
3921 }
3922 
3923 void
3924 vmcs_ut::test_vmcs_host_ia32_efer()
3925 {
3928 
3930  this->expect_true(vmcs::host_ia32_efer::get() == 1UL);
3931 
3934 }
3935 
3936 void
3937 vmcs_ut::test_vmcs_host_ia32_efer_sce()
3938 {
3940 
3943 
3946 
3949 
3952 }
3953 
3954 void
3955 vmcs_ut::test_vmcs_host_ia32_efer_lme()
3956 {
3958 
3961 
3964 
3967 
3970 }
3971 
3972 void
3973 vmcs_ut::test_vmcs_host_ia32_efer_lma()
3974 {
3976 
3979 
3982 
3985 
3988 }
3989 
3990 void
3991 vmcs_ut::test_vmcs_host_ia32_efer_nxe()
3992 {
3994 
3997 
4000 
4003 
4006 }
4007 
4008 void
4009 vmcs_ut::test_vmcs_host_ia32_efer_reserved()
4010 {
4012 
4014  this->expect_true(vmcs::host_ia32_efer::reserved::get() == 0xEU);
4015 
4018 }
4019 
4020 void
4021 vmcs_ut::test_vmcs_host_ia32_perf_global_ctrl()
4022 {
4025 
4027  this->expect_true(vmcs::host_ia32_perf_global_ctrl::get() == 1UL);
4028 
4031 }
4032 
4033 void
4034 vmcs_ut::test_vmcs_host_ia32_perf_global_ctrl_reserved()
4035 {
4038 
4040  this->expect_true(vmcs::host_ia32_perf_global_ctrl::reserved::get() == 0xCUL);
4041 
4044 }
4045 
4046 void
4047 vmcs_ut::test_vmcs_guest_rflags()
4048 {
4050 
4051  vmcs::guest_rflags::set(100UL);
4052  this->expect_true(vmcs::guest_rflags::get() == 100UL);
4053 
4056 }
4057 
4058 void
4059 vmcs_ut::test_vmcs_guest_rflags_carry_flag()
4060 {
4063 
4066 
4069 
4072 }
4073 
4074 void
4075 vmcs_ut::test_vmcs_guest_rflags_parity_flag()
4076 {
4079 
4082 
4085 
4088 }
4089 
4090 void
4091 vmcs_ut::test_vmcs_guest_rflags_auxiliary_carry_flag()
4092 {
4095 
4098 
4101 
4104 }
4105 
4106 void
4107 vmcs_ut::test_vmcs_guest_rflags_zero_flag()
4108 {
4111 
4114 
4117 
4120 }
4121 
4122 void
4123 vmcs_ut::test_vmcs_guest_rflags_sign_flag()
4124 {
4127 
4130 
4133 
4136 }
4137 
4138 void
4139 vmcs_ut::test_vmcs_guest_rflags_trap_flag()
4140 {
4143 
4146 
4149 
4152 }
4153 
4154 void
4155 vmcs_ut::test_vmcs_guest_rflags_interrupt_enable_flag()
4156 {
4159 
4162 
4165 
4168 }
4169 
4170 void
4171 vmcs_ut::test_vmcs_guest_rflags_direction_flag()
4172 {
4175 
4178 
4181 
4184 }
4185 
4186 void
4187 vmcs_ut::test_vmcs_guest_rflags_overflow_flag()
4188 {
4191 
4194 
4197 
4200 }
4201 
4202 void
4203 vmcs_ut::test_vmcs_guest_rflags_privilege_level()
4204 {
4206  this->expect_true(vmcs::guest_rflags::privilege_level::get() == 1UL);
4207 
4209  this->expect_true(vmcs::guest_rflags::privilege_level::get() == 2UL);
4210 
4213 
4216 }
4217 
4218 void
4219 vmcs_ut::test_vmcs_guest_rflags_nested_task()
4220 {
4223 
4226 
4229 
4232 }
4233 
4234 void
4235 vmcs_ut::test_vmcs_guest_rflags_resume_flag()
4236 {
4239 
4242 
4245 
4248 }
4249 
4250 void
4251 vmcs_ut::test_vmcs_guest_rflags_virtual_8086_mode()
4252 {
4255 
4258 
4261 
4264 }
4265 
4266 void
4267 vmcs_ut::test_vmcs_guest_rflags_alignment_check_access_control()
4268 {
4271 
4274 
4277 
4280 }
4281 
4282 void
4283 vmcs_ut::test_vmcs_guest_rflags_virtual_interupt_flag()
4284 {
4287 
4290 
4293 
4296 }
4297 
4298 void
4299 vmcs_ut::test_vmcs_guest_rflags_virtual_interupt_pending()
4300 {
4303 
4306 
4309 
4312 }
4313 
4314 void
4315 vmcs_ut::test_vmcs_guest_rflags_id_flag()
4316 {
4319 
4322 
4325 
4328 }
4329 
4330 void
4331 vmcs_ut::test_vmcs_guest_rflags_reserved()
4332 {
4333  vmcs::guest_rflags::reserved::set(0x100000000UL);
4334  this->expect_true(vmcs::guest_rflags::reserved::get() == 0x100000000UL);
4335 
4338 }
4339 
4340 void
4341 vmcs_ut::test_vmcs_guest_rflags_always_disabled()
4342 {
4344  this->expect_true(vmcs::guest_rflags::always_disabled::get() == 0x100000000UL);
4345 
4348 }
4349 
4350 void
4351 vmcs_ut::test_vmcs_guest_rflags_always_enabled()
4352 {
4354  this->expect_true(vmcs::guest_rflags::always_enabled::get() == 2UL);
4355 
4358 }
4359 
4360 void
4361 vmcs_ut::test_vmcs_guest_pending_debug_exceptions()
4362 {
4364 
4366  this->expect_true(vmcs::guest_pending_debug_exceptions::get() == 1UL);
4367 
4370 }
4371 
4372 void
4373 vmcs_ut::test_vmcs_guest_pending_debug_exceptions_b0()
4374 {
4377 
4380 
4383 
4386 }
4387 
4388 void
4389 vmcs_ut::test_vmcs_guest_pending_debug_exceptions_b1()
4390 {
4393 
4396 
4399 
4402 }
4403 
4404 void
4405 vmcs_ut::test_vmcs_guest_pending_debug_exceptions_b2()
4406 {
4409 
4412 
4415 
4418 }
4419 
4420 void
4421 vmcs_ut::test_vmcs_guest_pending_debug_exceptions_b3()
4422 {
4425 
4428 
4431 
4434 }
4435 
4436 void
4437 vmcs_ut::test_vmcs_guest_pending_debug_exceptions_reserved()
4438 {
4440  this->expect_true(vmcs::guest_pending_debug_exceptions::get() == 0x10UL);
4441 
4444 }
4445 
4446 void
4447 vmcs_ut::test_vmcs_guest_pending_debug_exceptions_enabled_breakpoint()
4448 {
4451 
4454 
4457 
4460 }
4461 
4462 void
4463 vmcs_ut::test_vmcs_guest_pending_debug_exceptions_bs()
4464 {
4467 
4470 
4473 
4476 }
4477 
4478 void
4479 vmcs_ut::test_vmcs_guest_pending_debug_exceptions_rtm()
4480 {
4483 
4486 
4489 
4492 }
4493 
4494 void
4495 vmcs_ut::test_vmcs_guest_ia32_sysenter_esp()
4496 {
4498 
4501 
4503  this->expect_true(vmcs::guest_ia32_sysenter_esp::get() == 0xFFFFFFFFU);
4504 }
4505 
4506 void
4507 vmcs_ut::test_vmcs_guest_ia32_sysenter_eip()
4508 {
4510 
4513 
4515  this->expect_true(vmcs::guest_ia32_sysenter_esp::get() == 0xFFFFFFFFU);
4516 }
4517 
4518 void
4519 vmcs_ut::test_vmcs_guest_cr0()
4520 {
4522 
4525 
4526  vmcs::guest_cr0::set(0xFFFFFFFFU);
4527  this->expect_true(vmcs::guest_cr0::get() == 0xFFFFFFFFU);
4528 
4530 }
4531 
4532 void
4533 vmcs_ut::test_vmcs_guest_cr0_protection_enable()
4534 {
4537 
4540 
4543 
4546 }
4547 
4548 void
4549 vmcs_ut::test_vmcs_guest_cr0_monitor_coprocessor()
4550 {
4553 
4556 
4559 
4562 }
4563 
4564 void
4565 vmcs_ut::test_vmcs_guest_cr0_emulation()
4566 {
4569 
4572 
4575 
4578 }
4579 
4580 void
4581 vmcs_ut::test_vmcs_guest_cr0_task_switched()
4582 {
4585 
4588 
4591 
4594 }
4595 
4596 void
4597 vmcs_ut::test_vmcs_guest_cr0_extension_type()
4598 {
4601 
4604 
4607 
4610 }
4611 
4612 void
4613 vmcs_ut::test_vmcs_guest_cr0_numeric_error()
4614 {
4617 
4620 
4623 
4626 }
4627 
4628 void
4629 vmcs_ut::test_vmcs_guest_cr0_write_protect()
4630 {
4633 
4636 
4639 
4642 }
4643 
4644 void
4645 vmcs_ut::test_vmcs_guest_cr0_alignment_mask()
4646 {
4649 
4652 
4655 
4658 }
4659 
4660 void
4661 vmcs_ut::test_vmcs_guest_cr0_not_write_through()
4662 {
4665 
4668 
4671 
4674 }
4675 
4676 void
4677 vmcs_ut::test_vmcs_guest_cr0_cache_disable()
4678 {
4681 
4684 
4687 
4690 }
4691 
4692 void
4693 vmcs_ut::test_vmcs_guest_cr0_paging()
4694 {
4697 
4700 
4703 
4706 }
4707 
4708 void
4709 vmcs_ut::test_vmcs_guest_cr3()
4710 {
4712 
4713  vmcs::guest_cr3::set(100UL);
4714  this->expect_true(vmcs::guest_cr3::get() == 100UL);
4715 
4717  this->expect_true(vmcs::guest_cr3::get_if_exists() == 200UL);
4718 }
4719 
4720 void
4721 vmcs_ut::test_vmcs_guest_cr4()
4722 {
4724 
4727 
4728  vmcs::guest_cr4::set(0xFFFFFFFFU);
4729  this->expect_true(vmcs::guest_cr4::get() == 0xFFFFFFFFU);
4730 
4732 }
4733 
4734 void
4735 vmcs_ut::test_vmcs_guest_cr4_v8086_mode_extensions()
4736 {
4739 
4742 
4745 
4748 }
4749 
4750 void
4751 vmcs_ut::test_vmcs_guest_cr4_protected_mode_virtual_interrupts()
4752 {
4755 
4758 
4761 
4764 }
4765 
4766 void
4767 vmcs_ut::test_vmcs_guest_cr4_time_stamp_disable()
4768 {
4771 
4774 
4777 
4780 }
4781 
4782 void
4783 vmcs_ut::test_vmcs_guest_cr4_debugging_extensions()
4784 {
4787 
4790 
4793 
4796 }
4797 
4798 void
4799 vmcs_ut::test_vmcs_guest_cr4_page_size_extensions()
4800 {
4803 
4806 
4809 
4812 }
4813 
4814 void
4815 vmcs_ut::test_vmcs_guest_cr4_physical_address_extensions()
4816 {
4819 
4822 
4825 
4828 }
4829 
4830 void
4831 vmcs_ut::test_vmcs_guest_cr4_machine_check_enable()
4832 {
4835 
4838 
4841 
4844 }
4845 
4846 void
4847 vmcs_ut::test_vmcs_guest_cr4_page_global_enable()
4848 {
4851 
4854 
4857 
4860 }
4861 
4862 void
4863 vmcs_ut::test_vmcs_guest_cr4_performance_monitor_counter_enable()
4864 {
4867 
4870 
4873 
4876 }
4877 
4878 void
4879 vmcs_ut::test_vmcs_guest_cr4_osfxsr()
4880 {
4883 
4886 
4889 
4892 }
4893 
4894 void
4895 vmcs_ut::test_vmcs_guest_cr4_osxmmexcpt()
4896 {
4899 
4902 
4905 
4908 }
4909 
4910 void
4911 vmcs_ut::test_vmcs_guest_cr4_vmx_enable_bit()
4912 {
4915 
4918 
4921 
4924 }
4925 
4926 void
4927 vmcs_ut::test_vmcs_guest_cr4_smx_enable_bit()
4928 {
4931 
4934 
4937 
4940 }
4941 
4942 void
4943 vmcs_ut::test_vmcs_guest_cr4_fsgsbase_enable_bit()
4944 {
4947 
4950 
4953 
4956 }
4957 
4958 void
4959 vmcs_ut::test_vmcs_guest_cr4_pcid_enable_bit()
4960 {
4963 
4966 
4969 
4972 }
4973 
4974 void
4975 vmcs_ut::test_vmcs_guest_cr4_osxsave()
4976 {
4979 
4982 
4985 
4988 }
4989 
4990 void
4991 vmcs_ut::test_vmcs_guest_cr4_smep_enable_bit()
4992 {
4995 
4998 
5001 
5004 }
5005 
5006 void
5007 vmcs_ut::test_vmcs_guest_cr4_smap_enable_bit()
5008 {
5011 
5014 
5017 
5020 }
5021 
5022 void
5023 vmcs_ut::test_vmcs_guest_cr4_protection_key_enable_bit()
5024 {
5027 
5030 
5033 
5036 }
5037 
5038 void
5039 vmcs_ut::test_vmcs_guest_es_base()
5040 {
5042 
5044  this->expect_true(vmcs::guest_es_base::get() == 1UL);
5045 
5048 }
5049 
5050 void
5051 vmcs_ut::test_vmcs_guest_cs_base()
5052 {
5054 
5056  this->expect_true(vmcs::guest_cs_base::get() == 1UL);
5057 
5060 }
5061 
5062 void
5063 vmcs_ut::test_vmcs_guest_ss_base()
5064 {
5066 
5068  this->expect_true(vmcs::guest_ss_base::get() == 1UL);
5069 
5072 }
5073 
5074 void
5075 vmcs_ut::test_vmcs_guest_ds_base()
5076 {
5078 
5080  this->expect_true(vmcs::guest_ds_base::get() == 1UL);
5081 
5084 }
5085 
5086 void
5087 vmcs_ut::test_vmcs_guest_fs_base()
5088 {
5090 
5092  this->expect_true(vmcs::guest_fs_base::get() == 1UL);
5093 
5096 }
5097 
5098 void
5099 vmcs_ut::test_vmcs_guest_gs_base()
5100 {
5102 
5104  this->expect_true(vmcs::guest_gs_base::get() == 1UL);
5105 
5108 }
5109 
5110 void
5111 vmcs_ut::test_vmcs_guest_ldtr_base()
5112 {
5114 
5116  this->expect_true(vmcs::guest_ldtr_base::get() == 1UL);
5117 
5120 }
5121 
5122 void
5123 vmcs_ut::test_vmcs_guest_tr_base()
5124 {
5126 
5128  this->expect_true(vmcs::guest_tr_base::get() == 1UL);
5129 
5132 }
5133 
5134 void
5135 vmcs_ut::test_vmcs_guest_gdtr_base()
5136 {
5138 
5140  this->expect_true(vmcs::guest_gdtr_base::get() == 1UL);
5141 
5144 }
5145 
5146 void
5147 vmcs_ut::test_vmcs_guest_idtr_base()
5148 {
5150 
5152  this->expect_true(vmcs::guest_idtr_base::get() == 1UL);
5153 
5156 }
5157 
5158 void
5159 vmcs_ut::test_vmcs_guest_dr7()
5160 {
5162 
5163  vmcs::guest_dr7::set(1UL);
5164  this->expect_true(vmcs::guest_dr7::get() == 1UL);
5165 
5168 }
5169 
5170 void
5171 vmcs_ut::test_vmcs_guest_rsp()
5172 {
5174 
5175  vmcs::guest_rsp::set(1UL);
5176  this->expect_true(vmcs::guest_rsp::get() == 1UL);
5177 
5180 }
5181 
5182 void
5183 vmcs_ut::test_vmcs_guest_rip()
5184 {
5186 
5187  vmcs::guest_rip::set(1UL);
5188  this->expect_true(vmcs::guest_rip::get() == 1UL);
5189 
5192 }
5193 
5194 void
5195 vmcs_ut::test_vmcs_host_cr0()
5196 {
5198 
5200  this->expect_true(vmcs::host_cr0::get_if_exists() == 0x2U);
5201 
5202  vmcs::host_cr0::set(0xFFFFFFFFU);
5203  this->expect_true(vmcs::host_cr0::get() == 0xFFFFFFFFU);
5204 
5206 }
5207 
5208 void
5209 vmcs_ut::test_vmcs_host_cr0_protection_enable()
5210 {
5213 
5216 
5219 
5222 }
5223 
5224 void
5225 vmcs_ut::test_vmcs_host_cr0_monitor_coprocessor()
5226 {
5229 
5232 
5235 
5238 }
5239 
5240 void
5241 vmcs_ut::test_vmcs_host_cr0_emulation()
5242 {
5245 
5248 
5251 
5254 }
5255 
5256 void
5257 vmcs_ut::test_vmcs_host_cr0_task_switched()
5258 {
5261 
5264 
5267 
5270 }
5271 
5272 void
5273 vmcs_ut::test_vmcs_host_cr0_extension_type()
5274 {
5277 
5280 
5283 
5286 }
5287 
5288 void
5289 vmcs_ut::test_vmcs_host_cr0_numeric_error()
5290 {
5293 
5296 
5299 
5302 }
5303 
5304 void
5305 vmcs_ut::test_vmcs_host_cr0_write_protect()
5306 {
5309 
5312 
5315 
5318 }
5319 
5320 void
5321 vmcs_ut::test_vmcs_host_cr0_alignment_mask()
5322 {
5325 
5328 
5331 
5334 }
5335 
5336 void
5337 vmcs_ut::test_vmcs_host_cr0_not_write_through()
5338 {
5341 
5344 
5347 
5350 }
5351 
5352 void
5353 vmcs_ut::test_vmcs_host_cr0_cache_disable()
5354 {
5357 
5360 
5363 
5366 }
5367 
5368 void
5369 vmcs_ut::test_vmcs_host_cr0_paging()
5370 {
5373 
5376 
5379 
5382 }
5383 
5384 void
5385 vmcs_ut::test_vmcs_host_cr3()
5386 {
5388 
5390  this->expect_true(vmcs::host_cr3::get_if_exists() == 0x2U);
5391 
5392  vmcs::host_cr3::set(0xFFFFFFFFU);
5393  this->expect_true(vmcs::host_cr3::get() == 0xFFFFFFFFU);
5394 }
5395 
5396 void
5397 vmcs_ut::test_vmcs_host_cr4()
5398 {
5400 
5402  this->expect_true(vmcs::host_cr4::get_if_exists() == 0x2U);
5403 
5404  vmcs::host_cr4::set(0xFFFFFFFFU);
5405  this->expect_true(vmcs::host_cr4::get() == 0xFFFFFFFFU);
5406 
5408 }
5409 
5410 void
5411 vmcs_ut::test_vmcs_host_cr4_v8086_mode_extensions()
5412 {
5415 
5418 
5421 
5424 }
5425 
5426 void
5427 vmcs_ut::test_vmcs_host_cr4_protected_mode_virtual_interrupts()
5428 {
5431 
5434 
5437 
5440 }
5441 
5442 void
5443 vmcs_ut::test_vmcs_host_cr4_time_stamp_disable()
5444 {
5447 
5450 
5453 
5456 }
5457 
5458 void
5459 vmcs_ut::test_vmcs_host_cr4_debugging_extensions()
5460 {
5463 
5466 
5469 
5472 }
5473 
5474 void
5475 vmcs_ut::test_vmcs_host_cr4_page_size_extensions()
5476 {
5479 
5482 
5485 
5488 }
5489 
5490 void
5491 vmcs_ut::test_vmcs_host_cr4_physical_address_extensions()
5492 {
5495 
5498 
5501 
5504 }
5505 
5506 void
5507 vmcs_ut::test_vmcs_host_cr4_machine_check_enable()
5508 {
5511 
5514 
5517 
5520 }
5521 
5522 void
5523 vmcs_ut::test_vmcs_host_cr4_page_global_enable()
5524 {
5527 
5530 
5533 
5536 }
5537 
5538 void
5539 vmcs_ut::test_vmcs_host_cr4_performance_monitor_counter_enable()
5540 {
5543 
5546 
5549 
5552 }
5553 
5554 void
5555 vmcs_ut::test_vmcs_host_cr4_osfxsr()
5556 {
5559 
5562 
5565 
5568 }
5569 
5570 void
5571 vmcs_ut::test_vmcs_host_cr4_osxmmexcpt()
5572 {
5575 
5578 
5581 
5584 }
5585 
5586 void
5587 vmcs_ut::test_vmcs_host_cr4_vmx_enable_bit()
5588 {
5591 
5594 
5597 
5600 }
5601 
5602 void
5603 vmcs_ut::test_vmcs_host_cr4_smx_enable_bit()
5604 {
5607 
5610 
5613 
5616 }
5617 
5618 void
5619 vmcs_ut::test_vmcs_host_cr4_fsgsbase_enable_bit()
5620 {
5623 
5626 
5629 
5632 }
5633 
5634 void
5635 vmcs_ut::test_vmcs_host_cr4_pcid_enable_bit()
5636 {
5639 
5642 
5645 
5648 }
5649 
5650 void
5651 vmcs_ut::test_vmcs_host_cr4_osxsave()
5652 {
5655 
5658 
5661 
5664 }
5665 
5666 void
5667 vmcs_ut::test_vmcs_host_cr4_smep_enable_bit()
5668 {
5671 
5674 
5677 
5680 }
5681 
5682 void
5683 vmcs_ut::test_vmcs_host_cr4_smap_enable_bit()
5684 {
5687 
5690 
5693 
5696 }
5697 
5698 void
5699 vmcs_ut::test_vmcs_host_cr4_protection_key_enable_bit()
5700 {
5703 
5706 
5709 
5712 }
5713 
5714 void
5715 vmcs_ut::test_vmcs_host_fs_base()
5716 {
5718 
5720  this->expect_true(vmcs::host_fs_base::get() == 1UL);
5721 
5724 }
5725 
5726 void
5727 vmcs_ut::test_vmcs_host_gs_base()
5728 {
5730 
5732  this->expect_true(vmcs::host_gs_base::get() == 1UL);
5733 
5736 }
5737 
5738 void
5739 vmcs_ut::test_vmcs_host_tr_base()
5740 {
5742 
5744  this->expect_true(vmcs::host_tr_base::get() == 1UL);
5745 
5748 }
5749 
5750 void
5751 vmcs_ut::test_vmcs_host_gdtr_base()
5752 {
5754 
5756  this->expect_true(vmcs::host_gdtr_base::get() == 1UL);
5757 
5760 }
5761 
5762 void
5763 vmcs_ut::test_vmcs_host_idtr_base()
5764 {
5766 
5768  this->expect_true(vmcs::host_idtr_base::get() == 1UL);
5769 
5772 }
5773 
5774 void
5775 vmcs_ut::test_vmcs_host_ia32_sysenter_esp()
5776 {
5778 
5780  this->expect_true(vmcs::host_ia32_sysenter_esp::get() == 1UL);
5781 
5784 }
5785 
5786 void
5787 vmcs_ut::test_vmcs_host_ia32_sysenter_eip()
5788 {
5790 
5792  this->expect_true(vmcs::host_ia32_sysenter_eip::get() == 1UL);
5793 
5796 }
5797 
5798 void
5799 vmcs_ut::test_vmcs_host_rsp()
5800 {
5802 
5803  vmcs::host_rsp::set(1UL);
5804  this->expect_true(vmcs::host_rsp::get() == 1UL);
5805 
5808 }
5809 
5810 void
5811 vmcs_ut::test_vmcs_host_rip()
5812 {
5814 
5815  vmcs::host_rip::set(1UL);
5816  this->expect_true(vmcs::host_rip::get() == 1UL);
5817 
5820 }
5821 
5822 void
5823 vmcs_ut::test_vmcs_guest_es_limit()
5824 {
5826 
5828  this->expect_true(vmcs::guest_es_limit::get() == 1UL);
5829 
5832 }
5833 
5834 void
5835 vmcs_ut::test_vmcs_guest_cs_limit()
5836 {
5838 
5840  this->expect_true(vmcs::guest_cs_limit::get() == 1UL);
5841 
5844 }
5845 
5846 void
5847 vmcs_ut::test_vmcs_guest_ss_limit()
5848 {
5850 
5852  this->expect_true(vmcs::guest_ss_limit::get() == 1UL);
5853 
5856 }
5857 
5858 
5859 void
5860 vmcs_ut::test_vmcs_guest_ds_limit()
5861 {
5863 
5865  this->expect_true(vmcs::guest_ds_limit::get() == 1UL);
5866 
5869 }
5870 
5871 void
5872 vmcs_ut::test_vmcs_guest_fs_limit()
5873 {
5875 
5877  this->expect_true(vmcs::guest_fs_limit::get() == 1UL);
5878 
5881 }
5882 
5883 void
5884 vmcs_ut::test_vmcs_guest_gs_limit()
5885 {
5887 
5889  this->expect_true(vmcs::guest_gs_limit::get() == 1UL);
5890 
5893 }
5894 
5895 void
5896 vmcs_ut::test_vmcs_guest_ldtr_limit()
5897 {
5899 
5901  this->expect_true(vmcs::guest_ldtr_limit::get() == 1UL);
5902 
5905 }
5906 
5907 void
5908 vmcs_ut::test_vmcs_guest_tr_limit()
5909 {
5911 
5913  this->expect_true(vmcs::guest_tr_limit::get() == 1UL);
5914 
5917 }
5918 
5919 void
5920 vmcs_ut::test_vmcs_guest_gdtr_limit()
5921 {
5923 
5925  this->expect_true(vmcs::guest_gdtr_limit::get() == 1UL);
5926 
5929 }
5930 
5931 void
5932 vmcs_ut::test_vmcs_guest_idtr_limit()
5933 {
5935 
5937  this->expect_true(vmcs::guest_idtr_limit::get() == 1UL);
5938 
5941 }
5942 
5943 void
5944 vmcs_ut::test_vmcs_guest_es_access_rights()
5945 {
5948  this->expect_true(vmcs::guest_es_access_rights::get() == 100UL);
5949 
5952 }
5953 
5954 void
5955 vmcs_ut::test_vmcs_guest_es_access_rights_type()
5956 {
5958  this->expect_true(vmcs::guest_es_access_rights::type::get() == 1UL);
5959 
5962 }
5963 
5964 void
5965 vmcs_ut::test_vmcs_guest_es_access_rights_s()
5966 {
5968  this->expect_true(vmcs::guest_es_access_rights::s::get() == 1UL);
5969 
5972 }
5973 
5974 void
5975 vmcs_ut::test_vmcs_guest_es_access_rights_dpl()
5976 {
5978  this->expect_true(vmcs::guest_es_access_rights::dpl::get() == 1UL);
5979 
5982 }
5983 
5984 void
5985 vmcs_ut::test_vmcs_guest_es_access_rights_present()
5986 {
5988  this->expect_true(vmcs::guest_es_access_rights::present::get() == 1UL);
5989 
5992 }
5993 
5994 void
5995 vmcs_ut::test_vmcs_guest_es_access_rights_avl()
5996 {
5998  this->expect_true(vmcs::guest_es_access_rights::avl::get() == 1UL);
5999 
6002 }
6003 
6004 void
6005 vmcs_ut::test_vmcs_guest_es_access_rights_l()
6006 {
6008  this->expect_true(vmcs::guest_es_access_rights::l::get() == 1UL);
6009 
6012 }
6013 
6014 void
6015 vmcs_ut::test_vmcs_guest_es_access_rights_db()
6016 {
6018  this->expect_true(vmcs::guest_es_access_rights::db::get() == 1UL);
6019 
6022 }
6023 
6024 void
6025 vmcs_ut::test_vmcs_guest_es_access_rights_granularity()
6026 {
6028  this->expect_true(vmcs::guest_es_access_rights::granularity::get() == 1UL);
6029 
6032 }
6033 
6034 void
6035 vmcs_ut::test_vmcs_guest_es_access_rights_reserved()
6036 {
6038  this->expect_true(vmcs::guest_es_access_rights::reserved::get() == 0x00F00U);
6039 
6042 }
6043 
6044 void
6045 vmcs_ut::test_vmcs_guest_es_access_rights_unusable()
6046 {
6048  this->expect_true(vmcs::guest_es_access_rights::unusable::get() == 1UL);
6049 
6052 }
6053 
6054 void
6055 vmcs_ut::test_vmcs_guest_cs_access_rights()
6056 {
6059  this->expect_true(vmcs::guest_cs_access_rights::get() == 100UL);
6060 
6063 }
6064 
6065 void
6066 vmcs_ut::test_vmcs_guest_cs_access_rights_type()
6067 {
6069  this->expect_true(vmcs::guest_cs_access_rights::type::get() == 1UL);
6070 
6073 }
6074 
6075 void
6076 vmcs_ut::test_vmcs_guest_cs_access_rights_s()
6077 {
6079  this->expect_true(vmcs::guest_cs_access_rights::s::get() == 1UL);
6080 
6083 }
6084 
6085 void
6086 vmcs_ut::test_vmcs_guest_cs_access_rights_dpl()
6087 {
6089  this->expect_true(vmcs::guest_cs_access_rights::dpl::get() == 1UL);
6090 
6093 }
6094 
6095 void
6096 vmcs_ut::test_vmcs_guest_cs_access_rights_present()
6097 {
6099  this->expect_true(vmcs::guest_cs_access_rights::present::get() == 1UL);
6100 
6103 }
6104 
6105 void
6106 vmcs_ut::test_vmcs_guest_cs_access_rights_avl()
6107 {
6109  this->expect_true(vmcs::guest_cs_access_rights::avl::get() == 1UL);
6110 
6113 }
6114 
6115 void
6116 vmcs_ut::test_vmcs_guest_cs_access_rights_l()
6117 {
6119  this->expect_true(vmcs::guest_cs_access_rights::l::get() == 1UL);
6120 
6123 }
6124 
6125 void
6126 vmcs_ut::test_vmcs_guest_cs_access_rights_db()
6127 {
6129  this->expect_true(vmcs::guest_cs_access_rights::db::get() == 1UL);
6130 
6133 }
6134 
6135 void
6136 vmcs_ut::test_vmcs_guest_cs_access_rights_granularity()
6137 {
6139  this->expect_true(vmcs::guest_cs_access_rights::granularity::get() == 1UL);
6140 
6143 }
6144 
6145 void
6146 vmcs_ut::test_vmcs_guest_cs_access_rights_reserved()
6147 {
6149  this->expect_true(vmcs::guest_cs_access_rights::reserved::get() == 0x00F00U);
6150 
6153 }
6154 
6155 void
6156 vmcs_ut::test_vmcs_guest_cs_access_rights_unusable()
6157 {
6159  this->expect_true(vmcs::guest_cs_access_rights::unusable::get() == 1UL);
6160 
6163 }
6164 
6165 void
6166 vmcs_ut::test_vmcs_guest_ss_access_rights()
6167 {
6170  this->expect_true(vmcs::guest_ss_access_rights::get() == 100UL);
6171 
6174 }
6175 
6176 void
6177 vmcs_ut::test_vmcs_guest_ss_access_rights_type()
6178 {
6180  this->expect_true(vmcs::guest_ss_access_rights::type::get() == 1UL);
6181 
6184 }
6185 
6186 void
6187 vmcs_ut::test_vmcs_guest_ss_access_rights_s()
6188 {
6190  this->expect_true(vmcs::guest_ss_access_rights::s::get() == 1UL);
6191 
6194 }
6195 
6196 void
6197 vmcs_ut::test_vmcs_guest_ss_access_rights_dpl()
6198 {
6200  this->expect_true(vmcs::guest_ss_access_rights::dpl::get() == 1UL);
6201 
6204 }
6205 
6206 void
6207 vmcs_ut::test_vmcs_guest_ss_access_rights_present()
6208 {
6210  this->expect_true(vmcs::guest_ss_access_rights::present::get() == 1UL);
6211 
6214 }
6215 
6216 void
6217 vmcs_ut::test_vmcs_guest_ss_access_rights_avl()
6218 {
6220  this->expect_true(vmcs::guest_ss_access_rights::avl::get() == 1UL);
6221 
6224 }
6225 
6226 void
6227 vmcs_ut::test_vmcs_guest_ss_access_rights_l()
6228 {
6230  this->expect_true(vmcs::guest_ss_access_rights::l::get() == 1UL);
6231 
6234 }
6235 
6236 void
6237 vmcs_ut::test_vmcs_guest_ss_access_rights_db()
6238 {
6240  this->expect_true(vmcs::guest_ss_access_rights::db::get() == 1UL);
6241 
6244 }
6245 
6246 void
6247 vmcs_ut::test_vmcs_guest_ss_access_rights_granularity()
6248 {
6250  this->expect_true(vmcs::guest_ss_access_rights::granularity::get() == 1UL);
6251 
6254 }
6255 
6256 void
6257 vmcs_ut::test_vmcs_guest_ss_access_rights_reserved()
6258 {
6260  this->expect_true(vmcs::guest_ss_access_rights::reserved::get() == 0x00F00U);
6261 
6264 }
6265 
6266 void
6267 vmcs_ut::test_vmcs_guest_ss_access_rights_unusable()
6268 {
6270  this->expect_true(vmcs::guest_ss_access_rights::unusable::get() == 1UL);
6271 
6274 }
6275 
6276 void
6277 vmcs_ut::test_vmcs_guest_ds_access_rights()
6278 {
6281  this->expect_true(vmcs::guest_ds_access_rights::get() == 100UL);
6282 
6285 }
6286 
6287 void
6288 vmcs_ut::test_vmcs_guest_ds_access_rights_type()
6289 {
6291  this->expect_true(vmcs::guest_ds_access_rights::type::get() == 1UL);
6292 
6295 }
6296 
6297 void
6298 vmcs_ut::test_vmcs_guest_ds_access_rights_s()
6299 {
6301  this->expect_true(vmcs::guest_ds_access_rights::s::get() == 1UL);
6302 
6305 }
6306 
6307 void
6308 vmcs_ut::test_vmcs_guest_ds_access_rights_dpl()
6309 {
6311  this->expect_true(vmcs::guest_ds_access_rights::dpl::get() == 1UL);
6312 
6315 }
6316 
6317 void
6318 vmcs_ut::test_vmcs_guest_ds_access_rights_present()
6319 {
6321  this->expect_true(vmcs::guest_ds_access_rights::present::get() == 1UL);
6322 
6325 }
6326 
6327 void
6328 vmcs_ut::test_vmcs_guest_ds_access_rights_avl()
6329 {
6331  this->expect_true(vmcs::guest_ds_access_rights::avl::get() == 1UL);
6332 
6335 }
6336 
6337 void
6338 vmcs_ut::test_vmcs_guest_ds_access_rights_l()
6339 {
6341  this->expect_true(vmcs::guest_ds_access_rights::l::get() == 1UL);
6342 
6345 }
6346 
6347 void
6348 vmcs_ut::test_vmcs_guest_ds_access_rights_db()
6349 {
6351  this->expect_true(vmcs::guest_ds_access_rights::db::get() == 1UL);
6352 
6355 }
6356 
6357 void
6358 vmcs_ut::test_vmcs_guest_ds_access_rights_granularity()
6359 {
6361  this->expect_true(vmcs::guest_ds_access_rights::granularity::get() == 1UL);
6362 
6365 }
6366 
6367 void
6368 vmcs_ut::test_vmcs_guest_ds_access_rights_reserved()
6369 {
6371  this->expect_true(vmcs::guest_ds_access_rights::reserved::get() == 0x00F00U);
6372 
6375 }
6376 
6377 void
6378 vmcs_ut::test_vmcs_guest_ds_access_rights_unusable()
6379 {
6381  this->expect_true(vmcs::guest_ds_access_rights::unusable::get() == 1UL);
6382 
6385 }
6386 
6387 void
6388 vmcs_ut::test_vmcs_guest_fs_access_rights()
6389 {
6392  this->expect_true(vmcs::guest_fs_access_rights::get() == 100UL);
6393 
6396 }
6397 
6398 void
6399 vmcs_ut::test_vmcs_guest_fs_access_rights_type()
6400 {
6402  this->expect_true(vmcs::guest_fs_access_rights::type::get() == 1UL);
6403 
6406 }
6407 
6408 void
6409 vmcs_ut::test_vmcs_guest_fs_access_rights_s()
6410 {
6412  this->expect_true(vmcs::guest_fs_access_rights::s::get() == 1UL);
6413 
6416 }
6417 
6418 void
6419 vmcs_ut::test_vmcs_guest_fs_access_rights_dpl()
6420 {
6422  this->expect_true(vmcs::guest_fs_access_rights::dpl::get() == 1UL);
6423 
6426 }
6427 
6428 void
6429 vmcs_ut::test_vmcs_guest_fs_access_rights_present()
6430 {
6432  this->expect_true(vmcs::guest_fs_access_rights::present::get() == 1UL);
6433 
6436 }
6437 
6438 void
6439 vmcs_ut::test_vmcs_guest_fs_access_rights_avl()
6440 {
6442  this->expect_true(vmcs::guest_fs_access_rights::avl::get() == 1UL);
6443 
6446 }
6447 
6448 void
6449 vmcs_ut::test_vmcs_guest_fs_access_rights_l()
6450 {
6452  this->expect_true(vmcs::guest_fs_access_rights::l::get() == 1UL);
6453 
6456 }
6457 
6458 void
6459 vmcs_ut::test_vmcs_guest_fs_access_rights_db()
6460 {
6462  this->expect_true(vmcs::guest_fs_access_rights::db::get() == 1UL);
6463 
6466 }
6467 
6468 void
6469 vmcs_ut::test_vmcs_guest_fs_access_rights_granularity()
6470 {
6472  this->expect_true(vmcs::guest_fs_access_rights::granularity::get() == 1UL);
6473 
6476 }
6477 
6478 void
6479 vmcs_ut::test_vmcs_guest_fs_access_rights_reserved()
6480 {
6482  this->expect_true(vmcs::guest_fs_access_rights::reserved::get() == 0x00F00U);
6483 
6486 }
6487 
6488 void
6489 vmcs_ut::test_vmcs_guest_fs_access_rights_unusable()
6490 {
6492  this->expect_true(vmcs::guest_fs_access_rights::unusable::get() == 1UL);
6493 
6496 }
6497 
6498 void
6499 vmcs_ut::test_vmcs_guest_gs_access_rights()
6500 {
6503  this->expect_true(vmcs::guest_gs_access_rights::get() == 100UL);
6504 
6507 }
6508 
6509 void
6510 vmcs_ut::test_vmcs_guest_gs_access_rights_type()
6511 {
6513  this->expect_true(vmcs::guest_gs_access_rights::type::get() == 1UL);
6514 
6517 }
6518 
6519 void
6520 vmcs_ut::test_vmcs_guest_gs_access_rights_s()
6521 {
6523  this->expect_true(vmcs::guest_gs_access_rights::s::get() == 1UL);
6524 
6527 }
6528 
6529 void
6530 vmcs_ut::test_vmcs_guest_gs_access_rights_dpl()
6531 {
6533  this->expect_true(vmcs::guest_gs_access_rights::dpl::get() == 1UL);
6534 
6537 }
6538 
6539 void
6540 vmcs_ut::test_vmcs_guest_gs_access_rights_present()
6541 {
6543  this->expect_true(vmcs::guest_gs_access_rights::present::get() == 1UL);
6544 
6547 }
6548 
6549 void
6550 vmcs_ut::test_vmcs_guest_gs_access_rights_avl()
6551 {
6553  this->expect_true(vmcs::guest_gs_access_rights::avl::get() == 1UL);
6554 
6557 }
6558 
6559 void
6560 vmcs_ut::test_vmcs_guest_gs_access_rights_l()
6561 {
6563  this->expect_true(vmcs::guest_gs_access_rights::l::get() == 1UL);
6564 
6567 }
6568 
6569 void
6570 vmcs_ut::test_vmcs_guest_gs_access_rights_db()
6571 {
6573  this->expect_true(vmcs::guest_gs_access_rights::db::get() == 1UL);
6574 
6577 }
6578 
6579 void
6580 vmcs_ut::test_vmcs_guest_gs_access_rights_granularity()
6581 {
6583  this->expect_true(vmcs::guest_gs_access_rights::granularity::get() == 1UL);
6584 
6587 }
6588 
6589 void
6590 vmcs_ut::test_vmcs_guest_gs_access_rights_reserved()
6591 {
6593  this->expect_true(vmcs::guest_gs_access_rights::reserved::get() == 0x00F00U);
6594 
6597 }
6598 
6599 void
6600 vmcs_ut::test_vmcs_guest_gs_access_rights_unusable()
6601 {
6603  this->expect_true(vmcs::guest_gs_access_rights::unusable::get() == 1UL);
6604 
6607 }
6608 
6609 void
6610 vmcs_ut::test_vmcs_guest_ldtr_access_rights()
6611 {
6614  this->expect_true(vmcs::guest_ldtr_access_rights::get() == 100UL);
6615 
6618 }
6619 
6620 void
6621 vmcs_ut::test_vmcs_guest_ldtr_access_rights_type()
6622 {
6624  this->expect_true(vmcs::guest_ldtr_access_rights::type::get() == 1UL);
6625 
6628 }
6629 
6630 void
6631 vmcs_ut::test_vmcs_guest_ldtr_access_rights_s()
6632 {
6634  this->expect_true(vmcs::guest_ldtr_access_rights::s::get() == 1UL);
6635 
6638 }
6639 
6640 void
6641 vmcs_ut::test_vmcs_guest_ldtr_access_rights_dpl()
6642 {
6644  this->expect_true(vmcs::guest_ldtr_access_rights::dpl::get() == 1UL);
6645 
6648 }
6649 
6650 void
6651 vmcs_ut::test_vmcs_guest_ldtr_access_rights_present()
6652 {
6654  this->expect_true(vmcs::guest_ldtr_access_rights::present::get() == 1UL);
6655 
6658 }
6659 
6660 void
6661 vmcs_ut::test_vmcs_guest_ldtr_access_rights_avl()
6662 {
6664  this->expect_true(vmcs::guest_ldtr_access_rights::avl::get() == 1UL);
6665 
6668 }
6669 
6670 void
6671 vmcs_ut::test_vmcs_guest_ldtr_access_rights_l()
6672 {
6674  this->expect_true(vmcs::guest_ldtr_access_rights::l::get() == 1UL);
6675 
6678 }
6679 
6680 void
6681 vmcs_ut::test_vmcs_guest_ldtr_access_rights_db()
6682 {
6684  this->expect_true(vmcs::guest_ldtr_access_rights::db::get() == 1UL);
6685 
6688 }
6689 
6690 void
6691 vmcs_ut::test_vmcs_guest_ldtr_access_rights_granularity()
6692 {
6694  this->expect_true(vmcs::guest_ldtr_access_rights::granularity::get() == 1UL);
6695 
6698 }
6699 
6700 void
6701 vmcs_ut::test_vmcs_guest_ldtr_access_rights_reserved()
6702 {
6704  this->expect_true(vmcs::guest_ldtr_access_rights::reserved::get() == 0x00F00U);
6705 
6708 }
6709 
6710 void
6711 vmcs_ut::test_vmcs_guest_ldtr_access_rights_unusable()
6712 {
6714  this->expect_true(vmcs::guest_ldtr_access_rights::unusable::get() == 1UL);
6715 
6718 }
6719 
6720 void
6721 vmcs_ut::test_vmcs_guest_tr_access_rights()
6722 {
6725  this->expect_true(vmcs::guest_tr_access_rights::get() == 100UL);
6726 
6729 }
6730 
6731 void
6732 vmcs_ut::test_vmcs_guest_tr_access_rights_type()
6733 {
6735  this->expect_true(vmcs::guest_tr_access_rights::type::get() == 1UL);
6736 
6739 }
6740 
6741 void
6742 vmcs_ut::test_vmcs_guest_tr_access_rights_s()
6743 {
6745  this->expect_true(vmcs::guest_tr_access_rights::s::get() == 1UL);
6746 
6749 }
6750 
6751 void
6752 vmcs_ut::test_vmcs_guest_tr_access_rights_dpl()
6753 {
6755  this->expect_true(vmcs::guest_tr_access_rights::dpl::get() == 1UL);
6756 
6759 }
6760 
6761 void
6762 vmcs_ut::test_vmcs_guest_tr_access_rights_present()
6763 {
6765  this->expect_true(vmcs::guest_tr_access_rights::present::get() == 1UL);
6766 
6769 }
6770 
6771 void
6772 vmcs_ut::test_vmcs_guest_tr_access_rights_avl()
6773 {
6775  this->expect_true(vmcs::guest_tr_access_rights::avl::get() == 1UL);
6776 
6779 }
6780 
6781 void
6782 vmcs_ut::test_vmcs_guest_tr_access_rights_l()
6783 {
6785  this->expect_true(vmcs::guest_tr_access_rights::l::get() == 1UL);
6786 
6789 }
6790 
6791 void
6792 vmcs_ut::test_vmcs_guest_tr_access_rights_db()
6793 {
6795  this->expect_true(vmcs::guest_tr_access_rights::db::get() == 1UL);
6796 
6799 }
6800 
6801 void
6802 vmcs_ut::test_vmcs_guest_tr_access_rights_granularity()
6803 {
6805  this->expect_true(vmcs::guest_tr_access_rights::granularity::get() == 1UL);
6806 
6809 }
6810 
6811 void
6812 vmcs_ut::test_vmcs_guest_tr_access_rights_reserved()
6813 {
6815  this->expect_true(vmcs::guest_tr_access_rights::reserved::get() == 0x00F00U);
6816 
6819 }
6820 
6821 void
6822 vmcs_ut::test_vmcs_guest_tr_access_rights_unusable()
6823 {
6825  this->expect_true(vmcs::guest_tr_access_rights::unusable::get() == 1UL);
6826 
6829 }
6830 
6831 void
6832 vmcs_ut::test_vmcs_guest_interruptibility_state()
6833 {
6835 
6837  this->expect_true(vmcs::guest_interruptibility_state::get() == 1UL);
6838 
6841 }
6842 
6843 void
6844 vmcs_ut::test_vmcs_guest_interruptibility_state_blocking_by_sti()
6845 {
6846  using namespace vmcs::guest_interruptibility_state;
6847 
6848  blocking_by_sti::set(1UL);
6849  this->expect_true(blocking_by_sti::get() == 1UL);
6850 
6853 }
6854 
6855 void
6856 vmcs_ut::test_vmcs_guest_interruptibility_state_blocking_by_mov_ss()
6857 {
6858  using namespace vmcs::guest_interruptibility_state;
6859 
6861  this->expect_true(blocking_by_mov_ss::get() == 1UL);
6862 
6865 }
6866 
6867 void
6868 vmcs_ut::test_vmcs_guest_interruptibility_state_blocking_by_smi()
6869 {
6870  using namespace vmcs::guest_interruptibility_state;
6871 
6872  blocking_by_smi::set(1UL);
6873  this->expect_true(blocking_by_smi::get() == 1UL);
6874 
6877 }
6878 
6879 void
6880 vmcs_ut::test_vmcs_guest_interruptibility_state_blocking_by_nmi()
6881 {
6882  using namespace vmcs::guest_interruptibility_state;
6883 
6884  blocking_by_nmi::set(1UL);
6885  this->expect_true(blocking_by_nmi::get() == 1UL);
6886 
6889 }
6890 
6891 void
6892 vmcs_ut::test_vmcs_guest_interruptibility_state_enclave_interruption()
6893 {
6894  using namespace vmcs::guest_interruptibility_state;
6895 
6897  this->expect_true(enclave_interruption::get() == 1UL);
6898 
6901 }
6902 
6903 void
6904 vmcs_ut::test_vmcs_guest_interruptibility_state_reserved()
6905 {
6906  using namespace vmcs::guest_interruptibility_state;
6907 
6908  reserved::set(1UL);
6909  this->expect_true(reserved::get() == 1UL);
6910 
6912  this->expect_true(reserved::get_if_exists() == 0UL);
6913 }
6914 
6915 void
6916 vmcs_ut::test_vmcs_guest_activity_state()
6917 {
6919 
6921  this->expect_true(vmcs::guest_activity_state::get() == 0U);
6922 
6924  this->expect_true(vmcs::guest_activity_state::get() == 1U);
6925 
6928 
6931 }
6932 
6933 void
6934 vmcs_ut::test_vmcs_guest_smbase()
6935 {
6937 
6939  this->expect_true(vmcs::guest_smbase::get() == 1UL);
6940 
6943 }
6944 
6945 void
6946 vmcs_ut::test_vmcs_guest_ia32_sysenter_cs()
6947 {
6949 
6951  this->expect_true(vmcs::guest_ia32_sysenter_cs::get() == 1UL);
6952 
6955 }
6956 
6957 void
6958 vmcs_ut::test_vmcs_vmx_preemption_timer_value()
6959 {
6962 
6964  this->expect_true(vmcs::vmx_preemption_timer_value::get() == 1UL);
6965 
6968 }
6969 
6970 void
6971 vmcs_ut::test_vmcs_host_ia32_sysenter_cs()
6972 {
6974 
6976  this->expect_true(vmcs::host_ia32_sysenter_cs::get() == 42U);
6977 
6980 }
6981 
6982 void
6983 vmcs_ut::test_vmcs_cr0_guest_host_mask()
6984 {
6986 
6988  this->expect_true(vmcs::cr0_guest_host_mask::get() == 1UL);
6989 
6992 }
6993 
6994 void
6995 vmcs_ut::test_vmcs_cr4_guest_host_mask()
6996 {
6998 
7000  this->expect_true(vmcs::cr4_guest_host_mask::get() == 1UL);
7001 
7004 }
7005 
7006 void
7007 vmcs_ut::test_vmcs_cr0_read_shadow()
7008 {
7010 
7012  this->expect_true(vmcs::cr0_read_shadow::get() == 1UL);
7013 
7016 }
7017 
7018 void
7019 vmcs_ut::test_vmcs_cr4_read_shadow()
7020 {
7022 
7024  this->expect_true(vmcs::cr4_read_shadow::get() == 1UL);
7025 
7028 }
7029 
7030 void
7031 vmcs_ut::test_vmcs_cr3_target_value_0()
7032 {
7034 
7036  this->expect_true(vmcs::cr3_target_value_0::get() == 1UL);
7037 
7040 }
7041 
7042 void
7043 vmcs_ut::test_vmcs_cr3_target_value_1()
7044 {
7046 
7048  this->expect_true(vmcs::cr3_target_value_1::get() == 1UL);
7049 
7052 }
7053 
7054 void
7055 vmcs_ut::test_vmcs_cr3_target_value_2()
7056 {
7058 
7060  this->expect_true(vmcs::cr3_target_value_2::get() == 1UL);
7061 
7064 }
7065 
7066 void
7067 vmcs_ut::test_vmcs_cr3_target_value_3()
7068 {
7070 
7072  this->expect_true(vmcs::cr3_target_value_3::get() == 1UL);
7073 
7076 }
7077 
7078 void
7079 vmcs_ut::test_vmcs_pin_based_vm_execution_controls()
7080 {
7082 
7084  this->expect_true(vmcs::pin_based_vm_execution_controls::get() == 1UL);
7085 
7088 }
7089 
7090 void
7091 vmcs_ut::test_vmcs_pin_based_vm_execution_controls_external_interrupt_exiting()
7092 {
7093  using namespace vmcs::pin_based_vm_execution_controls::external_interrupt_exiting;
7094 
7095  g_msrs[msrs::ia32_vmx_true_pinbased_ctls::addr] = 0xffffffff00000000UL;
7096 
7097  enable();
7098  this->expect_true(is_enabled());
7099 
7100  disable();
7101  this->expect_true(is_disabled());
7102 
7105 
7108 }
7109 
7110 void
7111 vmcs_ut::test_vmcs_pin_based_vm_execution_controls_nmi_exiting()
7112 {
7113  using namespace vmcs::pin_based_vm_execution_controls::nmi_exiting;
7114 
7115  g_msrs[msrs::ia32_vmx_true_pinbased_ctls::addr] = 0xffffffff00000000UL;
7116 
7117  enable();
7118  this->expect_true(is_enabled());
7119 
7120  disable();
7121  this->expect_true(is_disabled());
7122 
7125 
7128 }
7129 
7130 void
7131 vmcs_ut::test_vmcs_pin_based_vm_execution_controls_virtual_nmis()
7132 {
7133  using namespace vmcs::pin_based_vm_execution_controls::virtual_nmis;
7134 
7135  g_msrs[msrs::ia32_vmx_true_pinbased_ctls::addr] = 0xffffffff00000000UL;
7136 
7137  enable();
7138  this->expect_true(is_enabled());
7139 
7140  disable();
7141  this->expect_true(is_disabled());
7142 
7145 
7148 }
7149 
7150 void
7151 vmcs_ut::test_vmcs_pin_based_vm_execution_controls_activate_vmx_preemption_timer()
7152 {
7153  using namespace vmcs::pin_based_vm_execution_controls::activate_vmx_preemption_timer;
7154 
7155  g_msrs[msrs::ia32_vmx_true_pinbased_ctls::addr] = 0xffffffff00000000UL;
7156 
7157  enable();
7158  this->expect_true(is_enabled());
7159 
7160  disable();
7161  this->expect_true(is_disabled());
7162 
7165 
7168 }
7169 
7170 void
7171 vmcs_ut::test_vmcs_pin_based_vm_execution_controls_process_posted_interrupts()
7172 {
7173  using namespace vmcs::pin_based_vm_execution_controls::process_posted_interrupts;
7174 
7175  g_msrs[msrs::ia32_vmx_true_pinbased_ctls::addr] = 0xffffffff00000000UL;
7176 
7177  enable();
7178  this->expect_true(is_enabled());
7179 
7180  disable();
7181  this->expect_true(is_disabled());
7182 
7185 
7188 }
7189 
7190 void
7191 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls()
7192 {
7194 
7196  this->expect_true(vmcs::primary_processor_based_vm_execution_controls::get() == 1UL);
7197 
7200 }
7201 
7202 void
7203 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_interrupt_window_exiting()
7204 {
7205  using namespace vmcs::primary_processor_based_vm_execution_controls::interrupt_window_exiting;
7206 
7207  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7208 
7209  enable();
7210  this->expect_true(is_enabled());
7211 
7212  disable();
7213  this->expect_true(is_disabled());
7214 
7217 
7220 }
7221 
7222 void
7223 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_use_tsc_offsetting()
7224 {
7225  using namespace vmcs::primary_processor_based_vm_execution_controls::use_tsc_offsetting;
7226 
7227  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7228 
7229  enable();
7230  this->expect_true(is_enabled());
7231 
7232  disable();
7233  this->expect_true(is_disabled());
7234 
7237 
7240 }
7241 
7242 void
7243 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_hlt_exiting()
7244 {
7245  using namespace vmcs::primary_processor_based_vm_execution_controls::hlt_exiting;
7246 
7247  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7248 
7249  enable();
7250  this->expect_true(is_enabled());
7251 
7252  disable();
7253  this->expect_true(is_disabled());
7254 
7257 
7260 }
7261 
7262 void
7263 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_invlpg_exiting()
7264 {
7265  using namespace vmcs::primary_processor_based_vm_execution_controls::invlpg_exiting;
7266 
7267  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7268 
7269  enable();
7270  this->expect_true(is_enabled());
7271 
7272  disable();
7273  this->expect_true(is_disabled());
7274 
7277 
7280 }
7281 
7282 void
7283 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_mwait_exiting()
7284 {
7285  using namespace vmcs::primary_processor_based_vm_execution_controls::mwait_exiting;
7286 
7287  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7288 
7289  enable();
7290  this->expect_true(is_enabled());
7291 
7292  disable();
7293  this->expect_true(is_disabled());
7294 
7297 
7300 }
7301 
7302 void
7303 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_rdpmc_exiting()
7304 {
7305  using namespace vmcs::primary_processor_based_vm_execution_controls::rdpmc_exiting;
7306 
7307  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7308 
7309  enable();
7310  this->expect_true(is_enabled());
7311 
7312  disable();
7313  this->expect_true(is_disabled());
7314 
7317 
7320 }
7321 
7322 void
7323 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_rdtsc_exiting()
7324 {
7325  using namespace vmcs::primary_processor_based_vm_execution_controls::rdtsc_exiting;
7326 
7327  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7328 
7329  enable();
7330  this->expect_true(is_enabled());
7331 
7332  disable();
7333  this->expect_true(is_disabled());
7334 
7337 
7340 }
7341 
7342 void
7343 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_cr3_load_exiting()
7344 {
7345  using namespace vmcs::primary_processor_based_vm_execution_controls::cr3_load_exiting;
7346 
7347  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7348 
7349  enable();
7350  this->expect_true(is_enabled());
7351 
7352  disable();
7353  this->expect_true(is_disabled());
7354 
7357 
7360 }
7361 
7362 void
7363 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_cr3_store_exiting()
7364 {
7365  using namespace vmcs::primary_processor_based_vm_execution_controls::cr3_store_exiting;
7366 
7367  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7368 
7369  enable();
7370  this->expect_true(is_enabled());
7371 
7372  disable();
7373  this->expect_true(is_disabled());
7374 
7377 
7380 }
7381 
7382 void
7383 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_cr8_load_exiting()
7384 {
7385  using namespace vmcs::primary_processor_based_vm_execution_controls::cr8_load_exiting;
7386 
7387  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7388 
7389  enable();
7390  this->expect_true(is_enabled());
7391 
7392  disable();
7393  this->expect_true(is_disabled());
7394 
7397 
7400 }
7401 
7402 void
7403 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_cr8_store_exiting()
7404 {
7405  using namespace vmcs::primary_processor_based_vm_execution_controls::cr8_store_exiting;
7406 
7407  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7408 
7409  enable();
7410  this->expect_true(is_enabled());
7411 
7412  disable();
7413  this->expect_true(is_disabled());
7414 
7417 
7420 }
7421 
7422 void
7423 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_use_tpr_shadow()
7424 {
7425  using namespace vmcs::primary_processor_based_vm_execution_controls::use_tpr_shadow;
7426 
7427  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7428 
7429  enable();
7430  this->expect_true(is_enabled());
7431 
7432  disable();
7433  this->expect_true(is_disabled());
7434 
7437 
7440 }
7441 
7442 void
7443 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_nmi_window_exiting()
7444 {
7445  using namespace vmcs::primary_processor_based_vm_execution_controls::nmi_window_exiting;
7446 
7447  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7448 
7449  enable();
7450  this->expect_true(is_enabled());
7451 
7452  disable();
7453  this->expect_true(is_disabled());
7454 
7457 
7460 }
7461 
7462 void
7463 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_mov_dr_exiting()
7464 {
7465  using namespace vmcs::primary_processor_based_vm_execution_controls::mov_dr_exiting;
7466 
7467  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7468 
7469  enable();
7470  this->expect_true(is_enabled());
7471 
7472  disable();
7473  this->expect_true(is_disabled());
7474 
7477 
7480 }
7481 
7482 void
7483 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_unconditional_io_exiting()
7484 {
7485  using namespace vmcs::primary_processor_based_vm_execution_controls::unconditional_io_exiting;
7486 
7487  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7488 
7489  enable();
7490  this->expect_true(is_enabled());
7491 
7492  disable();
7493  this->expect_true(is_disabled());
7494 
7497 
7500 }
7501 
7502 void
7503 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_use_io_bitmaps()
7504 {
7505  using namespace vmcs::primary_processor_based_vm_execution_controls::use_io_bitmaps;
7506 
7507  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7508 
7509  enable();
7510  this->expect_true(is_enabled());
7511 
7512  disable();
7513  this->expect_true(is_disabled());
7514 
7517 
7520 }
7521 
7522 void
7523 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_monitor_trap_flag()
7524 {
7526 
7527  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7528 
7529  enable();
7530  this->expect_true(is_enabled());
7531 
7532  disable();
7533  this->expect_true(is_disabled());
7534 
7537 
7540 }
7541 
7542 void
7543 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_use_msr_bitmap()
7544 {
7545  using namespace vmcs::primary_processor_based_vm_execution_controls::use_msr_bitmap;
7546 
7547  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7548 
7549  enable();
7550  this->expect_true(is_enabled());
7551 
7552  disable();
7553  this->expect_true(is_disabled());
7554 
7557 
7560 }
7561 
7562 void
7563 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_monitor_exiting()
7564 {
7565  using namespace vmcs::primary_processor_based_vm_execution_controls::monitor_exiting;
7566 
7567  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7568 
7569  enable();
7570  this->expect_true(is_enabled());
7571 
7572  disable();
7573  this->expect_true(is_disabled());
7574 
7577 
7580 }
7581 
7582 void
7583 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_pause_exiting()
7584 {
7585  using namespace vmcs::primary_processor_based_vm_execution_controls::pause_exiting;
7586 
7587  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7588 
7589  enable();
7590  this->expect_true(is_enabled());
7591 
7592  disable();
7593  this->expect_true(is_disabled());
7594 
7597 
7600 }
7601 
7602 void
7603 vmcs_ut::test_vmcs_primary_processor_based_vm_execution_controls_activate_secondary_controls()
7604 {
7605  using namespace vmcs::primary_processor_based_vm_execution_controls::activate_secondary_controls;
7606 
7607  g_msrs[msrs::ia32_vmx_true_procbased_ctls::addr] = 0xffffffff00000000UL;
7608 
7609  enable();
7610  this->expect_true(is_enabled());
7611 
7612  disable();
7613  this->expect_true(is_disabled());
7614 
7617 
7620 }
7621 
7622 void
7623 vmcs_ut::test_vmcs_exception_bitmap()
7624 {
7626 
7628  this->expect_true(vmcs::exception_bitmap::get() == 1UL);
7629 
7632 }
7633 
7634 void
7635 vmcs_ut::test_vmcs_page_fault_error_code_mask()
7636 {
7638 
7640  this->expect_true(vmcs::page_fault_error_code_mask::get() == 1UL);
7641 
7644 }
7645 
7646 void
7647 vmcs_ut::test_vmcs_page_fault_error_code_match()
7648 {
7650 
7652  this->expect_true(vmcs::page_fault_error_code_match::get() == 1UL);
7653 
7656 }
7657 
7658 void
7659 vmcs_ut::test_vmcs_cr3_target_count()
7660 {
7662 
7664  this->expect_true(vmcs::cr3_target_count::get() == 1UL);
7665 
7668 }
7669 
7670 void
7671 vmcs_ut::test_vmcs_vm_exit_controls()
7672 {
7674 
7676  this->expect_true(vmcs::vm_exit_controls::get() == 1UL);
7677 
7680 }
7681 
7682 void
7683 vmcs_ut::test_vmcs_vm_exit_controls_save_debug_controls()
7684 {
7685  using namespace vmcs::vm_exit_controls::save_debug_controls;
7686 
7687  g_msrs[msrs::ia32_vmx_true_exit_ctls::addr] = 0xffffffff00000000UL;
7688 
7689  enable();
7690  this->expect_true(is_enabled());
7691 
7692  disable();
7693  this->expect_true(is_disabled());
7694 
7697 
7700 }
7701 
7702 void
7703 vmcs_ut::test_vmcs_vm_exit_controls_host_address_space_size()
7704 {
7705  using namespace vmcs::vm_exit_controls::host_address_space_size;
7706 
7707  g_msrs[msrs::ia32_vmx_true_exit_ctls::addr] = 0xffffffff00000000UL;
7708 
7709  enable();
7710  this->expect_true(is_enabled());
7711 
7712  disable();
7713  this->expect_true(is_disabled());
7714 
7717 
7720 }
7721 
7722 void
7723 vmcs_ut::test_vmcs_vm_exit_controls_load_ia32_perf_global_ctrl()
7724 {
7725  using namespace vmcs::vm_exit_controls::load_ia32_perf_global_ctrl;
7726 
7727  g_msrs[msrs::ia32_vmx_true_exit_ctls::addr] = 0xffffffff00000000UL;
7728 
7729  enable();
7730  this->expect_true(is_enabled());
7731 
7732  disable();
7733  this->expect_true(is_disabled());
7734 
7737 
7740 }
7741 
7742 void
7743 vmcs_ut::test_vmcs_vm_exit_controls_acknowledge_interrupt_on_exit()
7744 {
7745  using namespace vmcs::vm_exit_controls::acknowledge_interrupt_on_exit;
7746 
7747  g_msrs[msrs::ia32_vmx_true_exit_ctls::addr] = 0xffffffff00000000UL;
7748 
7749  enable();
7750  this->expect_true(is_enabled());
7751 
7752  disable();
7753  this->expect_true(is_disabled());
7754 
7757 
7760 }
7761 
7762 void
7763 vmcs_ut::test_vmcs_vm_exit_controls_save_ia32_pat()
7764 {
7765  using namespace vmcs::vm_exit_controls::save_ia32_pat;
7766 
7767  g_msrs[msrs::ia32_vmx_true_exit_ctls::addr] = 0xffffffff00000000UL;
7768 
7769  enable();
7770  this->expect_true(is_enabled());
7771 
7772  disable();
7773  this->expect_true(is_disabled());
7774 
7777 
7780 }
7781 
7782 void
7783 vmcs_ut::test_vmcs_vm_exit_controls_load_ia32_pat()
7784 {
7785  using namespace vmcs::vm_exit_controls::load_ia32_pat;
7786 
7787  g_msrs[msrs::ia32_vmx_true_exit_ctls::addr] = 0xffffffff00000000UL;
7788 
7789  enable();
7790  this->expect_true(is_enabled());
7791 
7792  disable();
7793  this->expect_true(is_disabled());
7794 
7797 
7800 }
7801 
7802 void
7803 vmcs_ut::test_vmcs_vm_exit_controls_save_ia32_efer()
7804 {
7805  using namespace vmcs::vm_exit_controls::save_ia32_efer;
7806 
7807  g_msrs[msrs::ia32_vmx_true_exit_ctls::addr] = 0xffffffff00000000UL;
7808 
7809  enable();
7810  this->expect_true(is_enabled());
7811 
7812  disable();
7813  this->expect_true(is_disabled());
7814 
7817 
7820 }
7821 
7822 void
7823 vmcs_ut::test_vmcs_vm_exit_controls_load_ia32_efer()
7824 {
7825  using namespace vmcs::vm_exit_controls::load_ia32_efer;
7826 
7827  g_msrs[msrs::ia32_vmx_true_exit_ctls::addr] = 0xffffffff00000000UL;
7828 
7829  enable();
7830  this->expect_true(is_enabled());
7831 
7832  disable();
7833  this->expect_true(is_disabled());
7834 
7837 
7840 }
7841 
7842 void
7843 vmcs_ut::test_vmcs_vm_exit_controls_save_vmx_preemption_timer_value()
7844 {
7845  using namespace vmcs::vm_exit_controls::save_vmx_preemption_timer_value;
7846 
7847  g_msrs[msrs::ia32_vmx_true_exit_ctls::addr] = 0xffffffff00000000UL;
7848 
7849  enable();
7850  this->expect_true(is_enabled());
7851 
7852  disable();
7853  this->expect_true(is_disabled());
7854 
7857 
7860 }
7861 
7862 void
7863 vmcs_ut::test_vmcs_vm_exit_controls_clear_ia32_bndcfgs()
7864 {
7865  using namespace vmcs::vm_exit_controls::clear_ia32_bndcfgs;
7866 
7867  g_msrs[msrs::ia32_vmx_true_exit_ctls::addr] = 0xffffffff00000000UL;
7868 
7869  enable();
7870  this->expect_true(is_enabled());
7871 
7872  disable();
7873  this->expect_true(is_disabled());
7874 
7877 
7880 }
7881 
7882 void
7883 vmcs_ut::test_vmcs_vm_exit_msr_store_count()
7884 {
7886 
7888  this->expect_true(vmcs::vm_exit_msr_store_count::get() == 1UL);
7889 
7892 }
7893 
7894 void
7895 vmcs_ut::test_vmcs_vm_exit_msr_load_count()
7896 {
7898 
7900  this->expect_true(vmcs::vm_exit_msr_load_count::get() == 1UL);
7901 
7904 }
7905 
7906 void
7907 vmcs_ut::test_vmcs_vm_entry_controls()
7908 {
7910 
7912  this->expect_true(vmcs::vm_entry_controls::get() == 1UL);
7913 
7916 }
7917 
7918 void
7919 vmcs_ut::test_vmcs_vm_entry_controls_load_debug_controls()
7920 {
7921  using namespace vmcs::vm_entry_controls::load_debug_controls;
7922 
7923  g_msrs[msrs::ia32_vmx_true_entry_ctls::addr] = 0xffffffff00000000UL;
7924 
7925  enable();
7926  this->expect_true(is_enabled());
7927 
7928  disable();
7929  this->expect_true(is_disabled());
7930 
7933 
7936 }
7937 
7938 void
7939 vmcs_ut::test_vmcs_vm_entry_controls_ia_32e_mode_guest()
7940 {
7941  using namespace vmcs::vm_entry_controls::ia_32e_mode_guest;
7942 
7943  g_msrs[msrs::ia32_vmx_true_entry_ctls::addr] = 0xffffffff00000000UL;
7944 
7945  enable();
7946  this->expect_true(is_enabled());
7947 
7948  disable();
7949  this->expect_true(is_disabled());
7950 
7953 
7956 }
7957 
7958 void
7959 vmcs_ut::test_vmcs_vm_entry_controls_entry_to_smm()
7960 {
7961  using namespace vmcs::vm_entry_controls::entry_to_smm;
7962 
7963  g_msrs[msrs::ia32_vmx_true_entry_ctls::addr] = 0xffffffff00000000UL;
7964 
7965  enable();
7966  this->expect_true(is_enabled());
7967 
7968  disable();
7969  this->expect_true(is_disabled());
7970 
7973 
7976 }
7977 
7978 void
7979 vmcs_ut::test_vmcs_vm_entry_controls_deactivate_dual_monitor_treatment()
7980 {
7981  using namespace vmcs::vm_entry_controls::deactivate_dual_monitor_treatment;
7982 
7983  g_msrs[msrs::ia32_vmx_true_entry_ctls::addr] = 0xffffffff00000000UL;
7984 
7985  enable();
7986  this->expect_true(is_enabled());
7987 
7988  disable();
7989  this->expect_true(is_disabled());
7990 
7993 
7996 }
7997 
7998 void
7999 vmcs_ut::test_vmcs_vm_entry_controls_load_ia32_perf_global_ctrl()
8000 {
8001  using namespace vmcs::vm_entry_controls::load_ia32_perf_global_ctrl;
8002 
8003  g_msrs[msrs::ia32_vmx_true_entry_ctls::addr] = 0xffffffff00000000UL;
8004 
8005  enable();
8006  this->expect_true(is_enabled());
8007 
8008  disable();
8009  this->expect_true(is_disabled());
8010 
8013 
8016 }
8017 
8018 void
8019 vmcs_ut::test_vmcs_vm_entry_controls_load_ia32_pat()
8020 {
8021  using namespace vmcs::vm_entry_controls::load_ia32_pat;
8022 
8023  g_msrs[msrs::ia32_vmx_true_entry_ctls::addr] = 0xffffffff00000000UL;
8024 
8025  enable();
8026  this->expect_true(is_enabled());
8027 
8028  disable();
8029  this->expect_true(is_disabled());
8030 
8033 
8036 }
8037 
8038 void
8039 vmcs_ut::test_vmcs_vm_entry_controls_load_ia32_efer()
8040 {
8041  using namespace vmcs::vm_entry_controls::load_ia32_efer;
8042 
8043  g_msrs[msrs::ia32_vmx_true_entry_ctls::addr] = 0xffffffff00000000UL;
8044 
8045  enable();
8046  this->expect_true(is_enabled());
8047 
8048  disable();
8049  this->expect_true(is_disabled());
8050 
8053 
8056 }
8057 
8058 void
8059 vmcs_ut::test_vmcs_vm_entry_controls_load_ia32_bndcfgs()
8060 {
8061  using namespace vmcs::vm_entry_controls::load_ia32_bndcfgs;
8062 
8063  g_msrs[msrs::ia32_vmx_true_entry_ctls::addr] = 0xffffffff00000000UL;
8064 
8065  enable();
8066  this->expect_true(is_enabled());
8067 
8068  disable();
8069  this->expect_true(is_disabled());
8070 
8073 
8076 }
8077 
8078 void
8079 vmcs_ut::test_vmcs_vm_entry_msr_load_count()
8080 {
8082 
8084  this->expect_true(vmcs::vm_entry_msr_load_count::get() == 1UL);
8085 
8088 }
8089 
8090 void
8091 vmcs_ut::test_vmcs_vm_entry_interruption_information_field()
8092 {
8094 
8096  this->expect_true(vmcs::vm_entry_interruption_information_field::get() == 1UL);
8097 
8100 }
8101 
8102 void
8103 vmcs_ut::test_vmcs_vm_entry_interruption_information_field_vector()
8104 {
8105  using namespace vmcs::vm_entry_interruption_information_field;
8106 
8107  set(0x101UL);
8108  this->expect_true(vector::get() == 0x1UL);
8109  this->expect_true(get() == 0x101UL);
8110 
8111  set_if_exists(0x222UL);
8112  this->expect_true(vector::get_if_exists() == 0x22UL);
8113  this->expect_true(get_if_exists() == 0x222UL);
8114 }
8115 
8116 void
8117 vmcs_ut::test_vmcs_vm_entry_interruption_information_field_type()
8118 {
8119  using namespace vmcs::vm_entry_interruption_information_field;
8120 
8121  set(0xf701UL);
8122  interruption_type::set(0x701UL);
8123  this->expect_true(interruption_type::get() == interruption_type::reserved);
8124  this->expect_true(get() == 0xf101UL);
8125 
8128  this->expect_true(get() == 0xf301UL);
8129 }
8130 
8131 void
8132 vmcs_ut::test_vmcs_vm_entry_interruption_information_field_deliver_error_code_bit()
8133 {
8134  using namespace vmcs::vm_entry_interruption_information_field;
8135 
8136  set(0xffff0000UL);
8139  this->expect_true(get() == (0xffff0000UL | deliver_error_code_bit::mask));
8140 
8143  this->expect_true(get() == 0xffff0000UL);
8144 
8147  this->expect_true(get() == (0xffff0000UL | deliver_error_code_bit::mask));
8148 
8151  this->expect_true(get() == 0xffff0000UL);
8152 }
8153 
8154 void
8155 vmcs_ut::test_vmcs_vm_entry_interruption_information_field_reserved()
8156 {
8157  using namespace vmcs::vm_entry_interruption_information_field;
8158 
8159  set(0x701UL);
8160  reserved::set(0xbc02UL);
8161  this->expect_true(reserved::get() == 0xbc02UL);
8162  this->expect_true(get() == 0xbc02701UL);
8163 
8164  reserved::set_if_exists(0x1UL);
8165  this->expect_true(reserved::get_if_exists() == 0x1UL);
8166  this->expect_true(get() == 0x01701UL);
8167 }
8168 
8169 void
8170 vmcs_ut::test_vmcs_vm_entry_interruption_information_field_valid_bit()
8171 {
8172  using namespace vmcs::vm_entry_interruption_information_field;
8173 
8174  set(0x0fff0000UL);
8177  this->expect_true(get() == (0x0fff0000UL | valid_bit::mask));
8178 
8181  this->expect_true(get() == 0x0fff0000UL);
8182 
8185  this->expect_true(get() == (0x0fff0000UL | valid_bit::mask));
8186 
8189  this->expect_true(get() == 0x0fff0000UL);
8190 }
8191 
8192 void
8193 vmcs_ut::test_vmcs_vm_entry_exception_error_code()
8194 {
8196 
8198  this->expect_true(vmcs::vm_entry_exception_error_code::get() == 1UL);
8199 
8202 }
8203 
8204 void
8205 vmcs_ut::test_vmcs_vm_entry_instruction_length()
8206 {
8208 
8210  this->expect_true(vmcs::vm_entry_instruction_length::get() == 1UL);
8211 
8214 }
8215 
8216 void
8217 vmcs_ut::test_vmcs_tpr_threshold()
8218 {
8219  using namespace msrs::ia32_vmx_true_procbased_ctls;
8220 
8221  g_msrs[addr] = ~(use_tpr_shadow::mask << 32);
8223 
8224  g_msrs[addr] = use_tpr_shadow::mask << 32;
8226 
8227  vmcs::tpr_threshold::set(0xF03UL);
8228  this->expect_true(vmcs::tpr_threshold::get() == 0xF03UL);
8229 
8231  this->expect_true(vmcs::tpr_threshold::get_if_exists() == 0x333UL);
8232 }
8233 
8234 void
8235 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls()
8236 {
8237  using namespace msrs::ia32_vmx_true_procbased_ctls;
8238 
8239  g_msrs[addr] = ~(activate_secondary_controls::mask << 32);
8241 
8242  g_msrs[addr] = activate_secondary_controls::mask << 32;
8244 
8246  this->expect_true(vmcs::secondary_processor_based_vm_execution_controls::get() == 1UL);
8247 
8250 }
8251 
8252 void
8253 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_virtualize_apic_accesses()
8254 {
8255  using namespace vmcs::secondary_processor_based_vm_execution_controls::virtualize_apic_accesses;
8256  using namespace msrs::ia32_vmx_true_procbased_ctls;
8257 
8258  g_msrs[addr] = activate_secondary_controls::mask << 32;
8259  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8260 
8261  enable();
8262  this->expect_true(is_enabled());
8263 
8264  disable();
8265  this->expect_true(is_disabled());
8266 
8269 
8272 }
8273 
8274 void
8275 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_enable_ept()
8276 {
8277  using namespace vmcs::secondary_processor_based_vm_execution_controls::enable_ept;
8278  using namespace msrs::ia32_vmx_true_procbased_ctls;
8279 
8280  g_msrs[addr] = activate_secondary_controls::mask << 32;
8281  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8282 
8283  enable();
8284  this->expect_true(is_enabled());
8285 
8286  disable();
8287  this->expect_true(is_disabled());
8288 
8291 
8294 }
8295 
8296 void
8297 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_descriptor_table_exiting()
8298 {
8299  using namespace vmcs::secondary_processor_based_vm_execution_controls::descriptor_table_exiting;
8300  using namespace msrs::ia32_vmx_true_procbased_ctls;
8301 
8302  g_msrs[addr] = activate_secondary_controls::mask << 32;
8303  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8304 
8305  enable();
8306  this->expect_true(is_enabled());
8307 
8308  disable();
8309  this->expect_true(is_disabled());
8310 
8313 
8316 }
8317 
8318 void
8319 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_enable_rdtscp()
8320 {
8321  using namespace vmcs::secondary_processor_based_vm_execution_controls::enable_rdtscp;
8322  using namespace msrs::ia32_vmx_true_procbased_ctls;
8323 
8324  g_msrs[addr] = activate_secondary_controls::mask << 32;
8325  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8326 
8327  enable();
8328  this->expect_true(is_enabled());
8329 
8330  disable();
8331  this->expect_true(is_disabled());
8332 
8335 
8338 }
8339 
8340 void
8341 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_virtualize_x2apic_mode()
8342 {
8343  using namespace vmcs::secondary_processor_based_vm_execution_controls::virtualize_x2apic_mode;
8344  using namespace msrs::ia32_vmx_true_procbased_ctls;
8345 
8346  g_msrs[addr] = activate_secondary_controls::mask << 32;
8347  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8348 
8349  enable();
8350  this->expect_true(is_enabled());
8351 
8352  disable();
8353  this->expect_true(is_disabled());
8354 
8357 
8360 }
8361 
8362 void
8363 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_enable_vpid()
8364 {
8365  using namespace vmcs::secondary_processor_based_vm_execution_controls::enable_vpid;
8366  using namespace msrs::ia32_vmx_true_procbased_ctls;
8367 
8368  g_msrs[addr] = activate_secondary_controls::mask << 32;
8369  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8370 
8371  enable();
8372  this->expect_true(is_enabled());
8373 
8374  disable();
8375  this->expect_true(is_disabled());
8376 
8379 
8382 }
8383 
8384 void
8385 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_wbinvd_exiting()
8386 {
8387  using namespace vmcs::secondary_processor_based_vm_execution_controls::wbinvd_exiting;
8388  using namespace msrs::ia32_vmx_true_procbased_ctls;
8389 
8390  g_msrs[addr] = activate_secondary_controls::mask << 32;
8391  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8392 
8393  enable();
8394  this->expect_true(is_enabled());
8395 
8396  disable();
8397  this->expect_true(is_disabled());
8398 
8401 
8404 }
8405 
8406 void
8407 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_unrestricted_guest()
8408 {
8409  using namespace vmcs::secondary_processor_based_vm_execution_controls::unrestricted_guest;
8410  using namespace msrs::ia32_vmx_true_procbased_ctls;
8411 
8412  g_msrs[addr] = activate_secondary_controls::mask << 32;
8413  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8414 
8415  enable();
8416  this->expect_true(is_enabled());
8417 
8418  disable();
8419  this->expect_true(is_disabled());
8420 
8423 
8426 }
8427 
8428 void
8429 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_apic_register_virtualization()
8430 {
8431  using namespace vmcs::secondary_processor_based_vm_execution_controls::apic_register_virtualization;
8432  using namespace msrs::ia32_vmx_true_procbased_ctls;
8433 
8434  g_msrs[addr] = activate_secondary_controls::mask << 32;
8435  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8436 
8437  enable();
8438  this->expect_true(is_enabled());
8439 
8440  disable();
8441  this->expect_true(is_disabled());
8442 
8445 
8448 }
8449 
8450 void
8451 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_virtual_interrupt_delivery()
8452 {
8453  using namespace vmcs::secondary_processor_based_vm_execution_controls::virtual_interrupt_delivery;
8454  using namespace msrs::ia32_vmx_true_procbased_ctls;
8455 
8456  g_msrs[addr] = activate_secondary_controls::mask << 32;
8457  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8458 
8459  enable();
8460  this->expect_true(is_enabled());
8461 
8462  disable();
8463  this->expect_true(is_disabled());
8464 
8467 
8470 }
8471 
8472 void
8473 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_pause_loop_exiting()
8474 {
8475  using namespace vmcs::secondary_processor_based_vm_execution_controls::pause_loop_exiting;
8476  using namespace msrs::ia32_vmx_true_procbased_ctls;
8477 
8478  g_msrs[addr] = activate_secondary_controls::mask << 32;
8479  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8480 
8481  enable();
8482  this->expect_true(is_enabled());
8483 
8484  disable();
8485  this->expect_true(is_disabled());
8486 
8489 
8492 }
8493 
8494 void
8495 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_rdrand_exiting()
8496 {
8497  using namespace vmcs::secondary_processor_based_vm_execution_controls::rdrand_exiting;
8498  using namespace msrs::ia32_vmx_true_procbased_ctls;
8499 
8500  g_msrs[addr] = activate_secondary_controls::mask << 32;
8501  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8502 
8503  enable();
8504  this->expect_true(is_enabled());
8505 
8506  disable();
8507  this->expect_true(is_disabled());
8508 
8511 
8514 }
8515 
8516 void
8517 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_enable_invpcid()
8518 {
8519  using namespace vmcs::secondary_processor_based_vm_execution_controls::enable_invpcid;
8520  using namespace msrs::ia32_vmx_true_procbased_ctls;
8521 
8522  g_msrs[addr] = activate_secondary_controls::mask << 32;
8523  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8524 
8525  enable();
8526  this->expect_true(is_enabled());
8527 
8528  disable();
8529  this->expect_true(is_disabled());
8530 
8533 
8536 }
8537 
8538 void
8539 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_enable_vm_functions()
8540 {
8541  using namespace vmcs::secondary_processor_based_vm_execution_controls::enable_vm_functions;
8542  using namespace msrs::ia32_vmx_true_procbased_ctls;
8543 
8544  g_msrs[addr] = activate_secondary_controls::mask << 32;
8545  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8546 
8547  enable();
8548  this->expect_true(is_enabled());
8549 
8550  disable();
8551  this->expect_true(is_disabled());
8552 
8555 
8558 }
8559 
8560 void
8561 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_vmcs_shadowing()
8562 {
8563  using namespace vmcs::secondary_processor_based_vm_execution_controls::vmcs_shadowing;
8564  using namespace msrs::ia32_vmx_true_procbased_ctls;
8565 
8566  g_msrs[addr] = activate_secondary_controls::mask << 32;
8567  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8568 
8569  enable();
8570  this->expect_true(is_enabled());
8571 
8572  disable();
8573  this->expect_true(is_disabled());
8574 
8577 
8580 }
8581 
8582 void
8583 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_rdseed_exiting()
8584 {
8585  using namespace vmcs::secondary_processor_based_vm_execution_controls::rdseed_exiting;
8586  using namespace msrs::ia32_vmx_true_procbased_ctls;
8587 
8588  g_msrs[addr] = activate_secondary_controls::mask << 32;
8589  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8590 
8591  enable();
8592  this->expect_true(is_enabled());
8593 
8594  disable();
8595  this->expect_true(is_disabled());
8596 
8599 
8602 }
8603 
8604 void
8605 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_enable_pml()
8606 {
8607  using namespace vmcs::secondary_processor_based_vm_execution_controls::enable_pml;
8608  using namespace msrs::ia32_vmx_true_procbased_ctls;
8609 
8610  g_msrs[addr] = activate_secondary_controls::mask << 32;
8611  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8612 
8613  enable();
8614  this->expect_true(is_enabled());
8615 
8616  disable();
8617  this->expect_true(is_disabled());
8618 
8621 
8624 }
8625 
8626 void
8627 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_ept_violation_ve()
8628 {
8629  using namespace vmcs::secondary_processor_based_vm_execution_controls::ept_violation_ve;
8630  using namespace msrs::ia32_vmx_true_procbased_ctls;
8631 
8632  g_msrs[addr] = activate_secondary_controls::mask << 32;
8633  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8634 
8635  enable();
8636  this->expect_true(is_enabled());
8637 
8638  disable();
8639  this->expect_true(is_disabled());
8640 
8643 
8646 }
8647 
8648 void
8649 vmcs_ut::test_vmcs_secondary_processor_based_vm_execution_controls_enable_xsaves_xrstors()
8650 {
8651  using namespace vmcs::secondary_processor_based_vm_execution_controls::enable_xsaves_xrstors;
8652  using namespace msrs::ia32_vmx_true_procbased_ctls;
8653 
8654  g_msrs[addr] = activate_secondary_controls::mask << 32;
8655  g_msrs[msrs::ia32_vmx_procbased_ctls2::addr] = 0xffffffff00000000UL;
8656 
8657  enable();
8658  this->expect_true(is_enabled());
8659 
8660  disable();
8661  this->expect_true(is_disabled());
8662 
8665 
8668 }
8669 
8670 void
8671 vmcs_ut::test_vmcs_ple_gap()
8672 {
8673  using namespace msrs::ia32_vmx_true_procbased_ctls;
8674 
8675  g_msrs[addr] = activate_secondary_controls::mask << 32;
8677 
8679 
8680  vmcs::ple_gap::set(0x11UL);
8681  this->expect_true(vmcs::ple_gap::get() == 0x11UL);
8682 
8684  this->expect_true(vmcs::ple_gap::get_if_exists() == 0xFFFUL);
8685 
8688  this->expect_exception([&] { vmcs::ple_gap::set(0x3U); }, ""_ut_lee);
8689  this->expect_exception([&] { vmcs::ple_gap::get(); }, ""_ut_lee);
8690  this->expect_no_exception([&] { vmcs::ple_gap::set_if_exists(0x3U); });
8692 
8694  this->expect_true(vmcs::ple_gap::get() == 0xFFFUL);
8695 }
8696 
8697 void
8698 vmcs_ut::test_vmcs_ple_window()
8699 {
8700  using namespace msrs::ia32_vmx_true_procbased_ctls;
8701 
8702  g_msrs[addr] = activate_secondary_controls::mask << 32;
8704 
8706 
8707  vmcs::ple_window::set(0x11UL);
8708  this->expect_true(vmcs::ple_window::get() == 0x11UL);
8709 
8711  this->expect_true(vmcs::ple_window::get_if_exists() == 0xFFFUL);
8712 
8715  this->expect_exception([&] { vmcs::ple_window::set(0x3U); }, ""_ut_lee);
8716  this->expect_exception([&] { vmcs::ple_window::get(); }, ""_ut_lee);
8719 
8721  this->expect_true(vmcs::ple_window::get() == 0xFFFUL);
8722 }
8723 
8724 void
8725 vmcs_ut::test_vmcs_vm_instruction_error()
8726 {
8728 
8729  for (auto && code : vm_instruction_error_codes)
8730  {
8731  g_vmcs_fields[vmcs::vm_instruction_error::addr] = code.first;
8732  this->expect_true(vmcs::vm_instruction_error::get() == code.first);
8734  this->expect_true(vmcs::vm_instruction_error::description() == code.second);
8736  }
8737 }
8738 
8739 void
8740 vmcs_ut::test_vmcs_exit_reason()
8741 {
8743 
8744  g_vmcs_fields[vmcs::exit_reason::addr] = 1UL;
8745  this->expect_true(vmcs::exit_reason::get() == 1UL);
8746 
8747  g_vmcs_fields[vmcs::exit_reason::addr] = 2UL;
8749 }
8750 
8751 void
8752 vmcs_ut::test_vmcs_exit_reason_basic_exit_reason()
8753 {
8754  using namespace vmcs::exit_reason;
8755 
8756  for (auto && reason : exit_reasons)
8757  {
8758  g_vmcs_fields[addr] = reason.first << basic_exit_reason::from;
8759  this->expect_true(basic_exit_reason::get() == reason.first);
8760  this->expect_true(basic_exit_reason::get_if_exists() == reason.first);
8761  this->expect_true(basic_exit_reason::description() == reason.second);
8762  this->expect_true(basic_exit_reason::description_if_exists() == reason.second);
8763  }
8764 }
8765 
8766 void
8767 vmcs_ut::test_vmcs_exit_reason_reserved()
8768 {
8769  using namespace vmcs::exit_reason;
8770 
8771  g_vmcs_fields[addr] = reserved::mask;
8772  this->expect_true(reserved::get() == reserved::mask >> reserved::from);
8774 }
8775 
8776 void
8777 vmcs_ut::test_vmcs_exit_reason_vm_exit_incident_to_enclave_mode()
8778 {
8779  using namespace vmcs::exit_reason;
8780 
8781  g_vmcs_fields[addr] = 0UL;
8784 
8788 }
8789 
8790 void
8791 vmcs_ut::test_vmcs_exit_reason_pending_mtf_vm_exit()
8792 {
8793  using namespace vmcs::exit_reason;
8794 
8795  g_vmcs_fields[addr] = 0UL;
8798 
8799  g_vmcs_fields[addr] = pending_mtf_vm_exit::mask;
8802 }
8803 
8804 void
8805 vmcs_ut::test_vmcs_exit_reason_vm_exit_from_vmx_root_operation()
8806 {
8807  using namespace vmcs::exit_reason;
8808 
8809  g_vmcs_fields[addr] = 0UL;
8812 
8816 }
8817 
8818 void
8819 vmcs_ut::test_vmcs_exit_reason_vm_entry_failure()
8820 {
8821  using namespace vmcs::exit_reason;
8822 
8823  g_vmcs_fields[addr] = 0UL;
8826 
8827  g_vmcs_fields[addr] = vm_entry_failure::mask;
8830 }
8831 
8832 void
8833 vmcs_ut::test_vmcs_vm_exit_interruption_information()
8834 {
8836 
8837  g_vmcs_fields[vmcs::vm_exit_interruption_information::addr] = 1UL;
8838  this->expect_true(vmcs::vm_exit_interruption_information::get() == 1UL);
8840 }
8841 
8842 void
8843 vmcs_ut::test_vmcs_vm_exit_interruption_information_vector()
8844 {
8845  g_vmcs_fields[vmcs::vm_exit_interruption_information::addr] = 0xFFFUL;
8846 
8847  this->expect_true(vmcs::vm_exit_interruption_information::vector::get() == 0xFFUL);
8849 }
8850 
8851 void
8852 vmcs_ut::test_vmcs_vm_exit_interruption_information_interruption_type()
8853 {
8854  g_vmcs_fields[vmcs::vm_exit_interruption_information::addr] = 0xFFFUL;
8855 
8856  this->expect_true(vmcs::vm_exit_interruption_information::interruption_type::get() == 7UL);
8858 }
8859 
8860 void
8861 vmcs_ut::test_vmcs_vm_exit_interruption_information_error_code_valid()
8862 {
8863  g_vmcs_fields[vmcs::vm_exit_interruption_information::addr] = 0xFFFUL;
8864 
8867 
8870 }
8871 
8872 void
8873 vmcs_ut::test_vmcs_vm_exit_interruption_information_nmi_blocking_due_to_iret()
8874 {
8875  g_vmcs_fields[vmcs::vm_exit_interruption_information::addr] = 0x1000UL;
8876 
8879 
8882 }
8883 
8884 void
8885 vmcs_ut::test_vmcs_vm_exit_interruption_information_reserved()
8886 {
8887  g_vmcs_fields[vmcs::vm_exit_interruption_information::addr] = 0xEE000UL;
8888 
8889  this->expect_true(vmcs::vm_exit_interruption_information::reserved::get() == 0xEE000U);
8891 }
8892 
8893 void
8894 vmcs_ut::test_vmcs_vm_exit_interruption_information_valid_bit()
8895 {
8896  g_vmcs_fields[vmcs::vm_exit_interruption_information::addr] = 0x80001000UL;
8897 
8900 
8903 }
8904 
8905 void
8906 vmcs_ut::test_vmcs_vm_exit_interruption_error_code()
8907 {
8908  g_vmcs_fields[vmcs::vm_exit_interruption_error_code::addr] = 1UL;
8909 
8911  this->expect_true(vmcs::vm_exit_interruption_error_code::get() == 1U);
8913 }
8914 
8915 void
8916 vmcs_ut::test_vmcs_idt_vectoring_information()
8917 {
8918  g_vmcs_fields[vmcs::idt_vectoring_information::addr] = 1UL;
8919 
8921  this->expect_true(vmcs::idt_vectoring_information::get() == 1UL);
8923 }
8924 
8925 void
8926 vmcs_ut::test_vmcs_idt_vectoring_information_vector()
8927 {
8928  g_vmcs_fields[vmcs::idt_vectoring_information::addr] = 0xFFFUL;
8929 
8930  this->expect_true(vmcs::idt_vectoring_information::vector::get() == 0xFFUL);
8932 }
8933 
8934 void
8935 vmcs_ut::test_vmcs_idt_vectoring_information_interruption_type()
8936 {
8937  g_vmcs_fields[vmcs::idt_vectoring_information::addr] = 0xFFFUL;
8938 
8939  this->expect_true(vmcs::idt_vectoring_information::interruption_type::get() == 7UL);
8941 }
8942 
8943 void
8944 vmcs_ut::test_vmcs_idt_vectoring_information_error_code_valid()
8945 {
8946  g_vmcs_fields[vmcs::idt_vectoring_information::addr] = 0xFFFUL;
8947 
8950 
8953 }
8954 
8955 void
8956 vmcs_ut::test_vmcs_idt_vectoring_information_reserved()
8957 {
8958  g_vmcs_fields[vmcs::idt_vectoring_information::addr] = 0xEE000UL;
8959 
8960  this->expect_true(vmcs::idt_vectoring_information::reserved::get() == 0xEE000U);
8962 }
8963 
8964 void
8965 vmcs_ut::test_vmcs_idt_vectoring_information_valid_bit()
8966 {
8967  g_vmcs_fields[vmcs::idt_vectoring_information::addr] = 0x80001000UL;
8968 
8971 
8974 }
8975 
8976 void
8977 vmcs_ut::test_vmcs_idt_vectoring_error_code()
8978 {
8979  g_vmcs_fields[vmcs::idt_vectoring_error_code::addr] = 1UL;
8980 
8982  this->expect_true(vmcs::idt_vectoring_error_code::get() == 1U);
8984 }
8985 
8986 void
8987 vmcs_ut::test_vmcs_vm_exit_instruction_length()
8988 {
8989  g_vmcs_fields[vmcs::vm_exit_instruction_length::addr] = 1UL;
8990 
8992  this->expect_true(vmcs::vm_exit_instruction_length::get() == 1U);
8994 }
8995 
8996 void
8997 vmcs_ut::test_vmcs_vm_exit_instruction_information()
8998 {
8999  g_vmcs_fields[vmcs::vm_exit_instruction_information::addr] = 1UL;
9000 
9002  this->expect_true(vmcs::vm_exit_instruction_information::get() == 1UL);
9004 }
9005 
9006 void
9007 vmcs_ut::test_vmcs_vm_exit_instruction_information_ins()
9008 {
9009  using namespace vmcs::vm_exit_instruction_information;
9010 
9011  g_vmcs_fields[addr] = 1UL;
9012 
9013  this->expect_true(ins::get_name() == ins::name);
9014  this->expect_true(ins::get() == 1UL);
9015  this->expect_true(ins::get_if_exists() == 1UL);
9016 }
9017 
9018 void
9019 vmcs_ut::test_vmcs_vm_exit_instruction_information_ins_address_size()
9020 {
9021  using namespace vmcs::vm_exit_instruction_information;
9022 
9024  this->expect_true(ins::address_size::get() == ins::address_size::_16bit);
9025 
9028 }
9029 
9030 void
9031 vmcs_ut::test_vmcs_vm_exit_instruction_information_outs()
9032 {
9033  using namespace vmcs::vm_exit_instruction_information;
9034 
9035  g_vmcs_fields[addr] = 1UL;
9036 
9038  this->expect_true(outs::get() == 1UL);
9039  this->expect_true(outs::get_if_exists() == 1UL);
9040 }
9041 
9042 void
9043 vmcs_ut::test_vmcs_vm_exit_instruction_information_outs_address_size()
9044 {
9045  using namespace vmcs::vm_exit_instruction_information;
9046 
9048  this->expect_true(outs::address_size::get() == outs::address_size::_16bit);
9049 
9052 }
9053 
9054 void
9055 vmcs_ut::test_vmcs_vm_exit_instruction_information_outs_segment_register()
9056 {
9057  using namespace vmcs::vm_exit_instruction_information;
9058 
9060  this->expect_true(outs::segment_register::get() == outs::segment_register::ss);
9061 
9064 }
9065 
9066 void
9067 vmcs_ut::test_vmcs_vm_exit_instruction_information_invept()
9068 {
9069  using namespace vmcs::vm_exit_instruction_information;
9070 
9071  g_vmcs_fields[addr] = 1UL;
9072 
9074  this->expect_true(invept::get() == 1UL);
9075  this->expect_true(invept::get_if_exists() == 1UL);
9076 }
9077 
9078 void
9079 vmcs_ut::test_vmcs_vm_exit_instruction_information_invept_scaling()
9080 {
9081  using namespace vmcs::vm_exit_instruction_information;
9082 
9084  this->expect_true(invept::scaling::get() == invept::scaling::scale_by_2);
9085 
9088 }
9089 
9090 void
9091 vmcs_ut::test_vmcs_vm_exit_instruction_information_invept_address_size()
9092 {
9093  using namespace vmcs::vm_exit_instruction_information;
9094 
9096  this->expect_true(invept::address_size::get() == invept::address_size::_32bit);
9097 
9100 }
9101 
9102 void
9103 vmcs_ut::test_vmcs_vm_exit_instruction_information_invept_segment_register()
9104 {
9105  using namespace vmcs::vm_exit_instruction_information;
9106 
9108  this->expect_true(invept::segment_register::get() == invept::segment_register::cs);
9109 
9112 }
9113 
9114 void
9115 vmcs_ut::test_vmcs_vm_exit_instruction_information_invept_index_reg()
9116 {
9117  using namespace vmcs::vm_exit_instruction_information;
9118 
9120  this->expect_true(invept::index_reg::get() == invept::index_reg::rsi);
9121 
9124 }
9125 
9126 void
9127 vmcs_ut::test_vmcs_vm_exit_instruction_information_invept_index_reg_invalid()
9128 {
9129  using namespace vmcs::vm_exit_instruction_information;
9130 
9132  this->expect_true(invept::index_reg_invalid::get() == invept::index_reg_invalid::valid);
9133 
9136 }
9137 
9138 void
9139 vmcs_ut::test_vmcs_vm_exit_instruction_information_invept_base_reg()
9140 {
9141  using namespace vmcs::vm_exit_instruction_information;
9142 
9144  this->expect_true(invept::base_reg::get() == invept::base_reg::rdi);
9145 
9148 }
9149 
9150 void
9151 vmcs_ut::test_vmcs_vm_exit_instruction_information_invept_base_reg_invalid()
9152 {
9153  using namespace vmcs::vm_exit_instruction_information;
9154 
9156  this->expect_true(invept::base_reg_invalid::get() == invept::base_reg_invalid::valid);
9157 
9160 }
9161 
9162 void
9163 vmcs_ut::test_vmcs_vm_exit_instruction_information_invept_reg2()
9164 {
9165  using namespace vmcs::vm_exit_instruction_information;
9166 
9167  g_vmcs_fields[addr] = invept::reg2::rdx << invept::reg2::from;
9168  this->expect_true(invept::reg2::get() == invept::reg2::rdx);
9169 
9170  g_vmcs_fields[addr] = invept::reg2::rsp << invept::reg2::from;
9172 }
9173 
9174 void
9175 vmcs_ut::test_vmcs_vm_exit_instruction_information_invpcid()
9176 {
9177  using namespace vmcs::vm_exit_instruction_information;
9178 
9179  g_vmcs_fields[addr] = 1UL;
9180 
9182  this->expect_true(invpcid::get() == 1UL);
9183  this->expect_true(invpcid::get_if_exists() == 1UL);
9184 }
9185 
9186 void
9187 vmcs_ut::test_vmcs_vm_exit_instruction_information_invpcid_scaling()
9188 {
9189  using namespace vmcs::vm_exit_instruction_information;
9190 
9192  this->expect_true(invpcid::scaling::get() == invpcid::scaling::scale_by_2);
9193 
9196 }
9197 
9198 void
9199 vmcs_ut::test_vmcs_vm_exit_instruction_information_invpcid_address_size()
9200 {
9201  using namespace vmcs::vm_exit_instruction_information;
9202 
9204  this->expect_true(invpcid::address_size::get() == invpcid::address_size::_32bit);
9205 
9208 }
9209 
9210 void
9211 vmcs_ut::test_vmcs_vm_exit_instruction_information_invpcid_segment_register()
9212 {
9213  using namespace vmcs::vm_exit_instruction_information;
9214 
9216  this->expect_true(invpcid::segment_register::get() == invpcid::segment_register::cs);
9217 
9220 }
9221 
9222 void
9223 vmcs_ut::test_vmcs_vm_exit_instruction_information_invpcid_index_reg()
9224 {
9225  using namespace vmcs::vm_exit_instruction_information;
9226 
9228  this->expect_true(invpcid::index_reg::get() == invpcid::index_reg::rsi);
9229 
9232 }
9233 
9234 void
9235 vmcs_ut::test_vmcs_vm_exit_instruction_information_invpcid_index_reg_invalid()
9236 {
9237  using namespace vmcs::vm_exit_instruction_information;
9238 
9240  this->expect_true(invpcid::index_reg_invalid::get() == invpcid::index_reg_invalid::valid);
9241 
9244 }
9245 
9246 void
9247 vmcs_ut::test_vmcs_vm_exit_instruction_information_invpcid_base_reg()
9248 {
9249  using namespace vmcs::vm_exit_instruction_information;
9250 
9252  this->expect_true(invpcid::base_reg::get() == invpcid::base_reg::rdi);
9253 
9256 }
9257 
9258 void
9259 vmcs_ut::test_vmcs_vm_exit_instruction_information_invpcid_base_reg_invalid()
9260 {
9261  using namespace vmcs::vm_exit_instruction_information;
9262 
9264  this->expect_true(invpcid::base_reg_invalid::get() == invpcid::base_reg_invalid::valid);
9265 
9268 }
9269 
9270 void
9271 vmcs_ut::test_vmcs_vm_exit_instruction_information_invpcid_reg2()
9272 {
9273  using namespace vmcs::vm_exit_instruction_information;
9274 
9275  g_vmcs_fields[addr] = invpcid::reg2::rdx << invpcid::reg2::from;
9276  this->expect_true(invpcid::reg2::get() == invpcid::reg2::rdx);
9277 
9278  g_vmcs_fields[addr] = invpcid::reg2::rsp << invpcid::reg2::from;
9280 }
9281 
9282 void
9283 vmcs_ut::test_vmcs_vm_exit_instruction_information_invvpid()
9284 {
9285  using namespace vmcs::vm_exit_instruction_information;
9286 
9287  g_vmcs_fields[addr] = 1UL;
9288 
9290  this->expect_true(invvpid::get() == 1UL);
9291  this->expect_true(invvpid::get_if_exists() == 1UL);
9292 }
9293 
9294 void
9295 vmcs_ut::test_vmcs_vm_exit_instruction_information_invvpid_scaling()
9296 {
9297  using namespace vmcs::vm_exit_instruction_information;
9298 
9300  this->expect_true(invvpid::scaling::get() == invvpid::scaling::scale_by_2);
9301 
9304 }
9305 
9306 void
9307 vmcs_ut::test_vmcs_vm_exit_instruction_information_invvpid_address_size()
9308 {
9309  using namespace vmcs::vm_exit_instruction_information;
9310 
9312  this->expect_true(invvpid::address_size::get() == invvpid::address_size::_32bit);
9313 
9316 }
9317 
9318 void
9319 vmcs_ut::test_vmcs_vm_exit_instruction_information_invvpid_segment_register()
9320 {
9321  using namespace vmcs::vm_exit_instruction_information;
9322 
9324  this->expect_true(invvpid::segment_register::get() == invvpid::segment_register::cs);
9325 
9328 }
9329 
9330 void
9331 vmcs_ut::test_vmcs_vm_exit_instruction_information_invvpid_index_reg()
9332 {
9333  using namespace vmcs::vm_exit_instruction_information;
9334 
9336  this->expect_true(invvpid::index_reg::get() == invvpid::index_reg::rsi);
9337 
9340 }
9341 
9342 void
9343 vmcs_ut::test_vmcs_vm_exit_instruction_information_invvpid_index_reg_invalid()
9344 {
9345  using namespace vmcs::vm_exit_instruction_information;
9346 
9348  this->expect_true(invvpid::index_reg_invalid::get() == invvpid::index_reg_invalid::valid);
9349 
9352 }
9353 
9354 void
9355 vmcs_ut::test_vmcs_vm_exit_instruction_information_invvpid_base_reg()
9356 {
9357  using namespace vmcs::vm_exit_instruction_information;
9358 
9360  this->expect_true(invvpid::base_reg::get() == invvpid::base_reg::rdi);
9361 
9364 }
9365 
9366 void
9367 vmcs_ut::test_vmcs_vm_exit_instruction_information_invvpid_base_reg_invalid()
9368 {
9369  using namespace vmcs::vm_exit_instruction_information;
9370 
9372  this->expect_true(invvpid::base_reg_invalid::get() == invvpid::base_reg_invalid::valid);
9373 
9376 }
9377 
9378 void
9379 vmcs_ut::test_vmcs_vm_exit_instruction_information_invvpid_reg2()
9380 {
9381  using namespace vmcs::vm_exit_instruction_information;
9382 
9383  g_vmcs_fields[addr] = invvpid::reg2::rdx << invvpid::reg2::from;
9384  this->expect_true(invvpid::reg2::get() == invvpid::reg2::rdx);
9385 
9386  g_vmcs_fields[addr] = invvpid::reg2::rsp << invvpid::reg2::from;
9388 }
9389 
9390 void
9391 vmcs_ut::test_vmcs_vm_exit_instruction_information_lidt()
9392 {
9393  using namespace vmcs::vm_exit_instruction_information;
9394 
9395  g_vmcs_fields[addr] = 1UL;
9396 
9398  this->expect_true(lidt::get() == 1UL);
9399  this->expect_true(lidt::get_if_exists() == 1UL);
9400 }
9401 
9402 void
9403 vmcs_ut::test_vmcs_vm_exit_instruction_information_lidt_scaling()
9404 {
9405  using namespace vmcs::vm_exit_instruction_information;
9406 
9408  this->expect_true(lidt::scaling::get() == lidt::scaling::scale_by_2);
9409 
9412 }
9413 
9414 void
9415 vmcs_ut::test_vmcs_vm_exit_instruction_information_lidt_address_size()
9416 {
9417  using namespace vmcs::vm_exit_instruction_information;
9418 
9420  this->expect_true(lidt::address_size::get() == lidt::address_size::_32bit);
9421 
9424 }
9425 
9426 void
9427 vmcs_ut::test_vmcs_vm_exit_instruction_information_lidt_operand_size()
9428 {
9429  using namespace vmcs::vm_exit_instruction_information;
9430 
9432  this->expect_true(lidt::operand_size::get() == lidt::operand_size::_16bit);
9433 
9436 }
9437 
9438 void
9439 vmcs_ut::test_vmcs_vm_exit_instruction_information_lidt_segment_register()
9440 {
9441  using namespace vmcs::vm_exit_instruction_information;
9442 
9444  this->expect_true(lidt::segment_register::get() == lidt::segment_register::cs);
9445 
9448 }
9449 
9450 void
9451 vmcs_ut::test_vmcs_vm_exit_instruction_information_lidt_index_reg()
9452 {
9453  using namespace vmcs::vm_exit_instruction_information;
9454 
9455  g_vmcs_fields[addr] = lidt::index_reg::rsi << lidt::index_reg::from;
9456  this->expect_true(lidt::index_reg::get() == lidt::index_reg::rsi);
9457 
9458  g_vmcs_fields[addr] = lidt::index_reg::r11 << lidt::index_reg::from;
9460 }
9461 
9462 void
9463 vmcs_ut::test_vmcs_vm_exit_instruction_information_lidt_index_reg_invalid()
9464 {
9465  using namespace vmcs::vm_exit_instruction_information;
9466 
9468  this->expect_true(lidt::index_reg_invalid::get() == lidt::index_reg_invalid::valid);
9469 
9472 }
9473 
9474 void
9475 vmcs_ut::test_vmcs_vm_exit_instruction_information_lidt_base_reg()
9476 {
9477  using namespace vmcs::vm_exit_instruction_information;
9478 
9479  g_vmcs_fields[addr] = lidt::base_reg::rdi << lidt::base_reg::from;
9480  this->expect_true(lidt::base_reg::get() == lidt::base_reg::rdi);
9481 
9482  g_vmcs_fields[addr] = lidt::base_reg::rcx << lidt::base_reg::from;
9484 }
9485 
9486 void
9487 vmcs_ut::test_vmcs_vm_exit_instruction_information_lidt_base_reg_invalid()
9488 {
9489  using namespace vmcs::vm_exit_instruction_information;
9490 
9492  this->expect_true(lidt::base_reg_invalid::get() == lidt::base_reg_invalid::valid);
9493 
9496 }
9497 
9498 void
9499 vmcs_ut::test_vmcs_vm_exit_instruction_information_lidt_instruction_identity()
9500 {
9501  using namespace vmcs::vm_exit_instruction_information;
9502 
9504  this->expect_true(lidt::instruction_identity::get() == lidt::instruction_identity::sgdt);
9505 
9508 }
9509 
9510 void
9511 vmcs_ut::test_vmcs_vm_exit_instruction_information_lgdt()
9512 {
9513  using namespace vmcs::vm_exit_instruction_information;
9514 
9515  g_vmcs_fields[addr] = 1UL;
9516 
9518  this->expect_true(lgdt::get() == 1UL);
9519  this->expect_true(lgdt::get_if_exists() == 1UL);
9520 }
9521 
9522 void
9523 vmcs_ut::test_vmcs_vm_exit_instruction_information_lgdt_scaling()
9524 {
9525  using namespace vmcs::vm_exit_instruction_information;
9526 
9528  this->expect_true(lgdt::scaling::get() == lgdt::scaling::scale_by_2);
9529 
9532 }
9533 
9534 void
9535 vmcs_ut::test_vmcs_vm_exit_instruction_information_lgdt_address_size()
9536 {
9537  using namespace vmcs::vm_exit_instruction_information;
9538 
9540  this->expect_true(lgdt::address_size::get() == lgdt::address_size::_32bit);
9541 
9544 }
9545 
9546 void
9547 vmcs_ut::test_vmcs_vm_exit_instruction_information_lgdt_operand_size()
9548 {
9549  using namespace vmcs::vm_exit_instruction_information;
9550 
9552  this->expect_true(lgdt::operand_size::get() == lgdt::operand_size::_16bit);
9553 
9556 }
9557 
9558 void
9559 vmcs_ut::test_vmcs_vm_exit_instruction_information_lgdt_segment_register()
9560 {
9561  using namespace vmcs::vm_exit_instruction_information;
9562 
9564  this->expect_true(lgdt::segment_register::get() == lgdt::segment_register::cs);
9565 
9568 }
9569 
9570 void
9571 vmcs_ut::test_vmcs_vm_exit_instruction_information_lgdt_index_reg()
9572 {
9573  using namespace vmcs::vm_exit_instruction_information;
9574 
9575  g_vmcs_fields[addr] = lgdt::index_reg::rsi << lgdt::index_reg::from;
9576  this->expect_true(lgdt::index_reg::get() == lgdt::index_reg::rsi);
9577 
9578  g_vmcs_fields[addr] = lgdt::index_reg::r11 << lgdt::index_reg::from;
9580 }
9581 
9582 void
9583 vmcs_ut::test_vmcs_vm_exit_instruction_information_lgdt_index_reg_invalid()
9584 {
9585  using namespace vmcs::vm_exit_instruction_information;
9586 
9588  this->expect_true(lgdt::index_reg_invalid::get() == lgdt::index_reg_invalid::valid);
9589 
9592 }
9593 
9594 void
9595 vmcs_ut::test_vmcs_vm_exit_instruction_information_lgdt_base_reg()
9596 {
9597  using namespace vmcs::vm_exit_instruction_information;
9598 
9599  g_vmcs_fields[addr] = lgdt::base_reg::rdi << lgdt::base_reg::from;
9600  this->expect_true(lgdt::base_reg::get() == lgdt::base_reg::rdi);
9601 
9602  g_vmcs_fields[addr] = lgdt::base_reg::rcx << lgdt::base_reg::from;
9604 }
9605 
9606 void
9607 vmcs_ut::test_vmcs_vm_exit_instruction_information_lgdt_base_reg_invalid()
9608 {
9609  using namespace vmcs::vm_exit_instruction_information;
9610 
9612  this->expect_true(lgdt::base_reg_invalid::get() == lgdt::base_reg_invalid::valid);
9613 
9616 }
9617 
9618 void
9619 vmcs_ut::test_vmcs_vm_exit_instruction_information_lgdt_instruction_identity()
9620 {
9621  using namespace vmcs::vm_exit_instruction_information;
9622 
9624  this->expect_true(lgdt::instruction_identity::get() == lgdt::instruction_identity::sgdt);
9625 
9628 }
9629 
9630 void
9631 vmcs_ut::test_vmcs_vm_exit_instruction_information_sidt()
9632 {
9633  using namespace vmcs::vm_exit_instruction_information;
9634 
9635  g_vmcs_fields[addr] = 1UL;
9636 
9638  this->expect_true(sidt::get() == 1UL);
9639  this->expect_true(sidt::get_if_exists() == 1UL);
9640 }
9641 
9642 void
9643 vmcs_ut::test_vmcs_vm_exit_instruction_information_sidt_scaling()
9644 {
9645  using namespace vmcs::vm_exit_instruction_information;
9646 
9648  this->expect_true(sidt::scaling::get() == sidt::scaling::scale_by_2);
9649 
9652 }
9653 
9654 void
9655 vmcs_ut::test_vmcs_vm_exit_instruction_information_sidt_address_size()
9656 {
9657  using namespace vmcs::vm_exit_instruction_information;
9658 
9660  this->expect_true(sidt::address_size::get() == sidt::address_size::_32bit);
9661 
9664 }
9665 
9666 void
9667 vmcs_ut::test_vmcs_vm_exit_instruction_information_sidt_operand_size()
9668 {
9669  using namespace vmcs::vm_exit_instruction_information;
9670 
9672  this->expect_true(sidt::operand_size::get() == sidt::operand_size::_16bit);
9673 
9676 }
9677 
9678 void
9679 vmcs_ut::test_vmcs_vm_exit_instruction_information_sidt_segment_register()
9680 {
9681  using namespace vmcs::vm_exit_instruction_information;
9682 
9684  this->expect_true(sidt::segment_register::get() == sidt::segment_register::cs);
9685 
9688 }
9689 
9690 void
9691 vmcs_ut::test_vmcs_vm_exit_instruction_information_sidt_index_reg()
9692 {
9693  using namespace vmcs::vm_exit_instruction_information;
9694 
9695  g_vmcs_fields[addr] = sidt::index_reg::rsi << sidt::index_reg::from;
9696  this->expect_true(sidt::index_reg::get() == sidt::index_reg::rsi);
9697 
9698  g_vmcs_fields[addr] = sidt::index_reg::r11 << sidt::index_reg::from;
9700 }
9701 
9702 void
9703 vmcs_ut::test_vmcs_vm_exit_instruction_information_sidt_index_reg_invalid()
9704 {
9705  using namespace vmcs::vm_exit_instruction_information;
9706 
9708  this->expect_true(sidt::index_reg_invalid::get() == sidt::index_reg_invalid::valid);
9709 
9712 }
9713 
9714 void
9715 vmcs_ut::test_vmcs_vm_exit_instruction_information_sidt_base_reg()
9716 {
9717  using namespace vmcs::vm_exit_instruction_information;
9718 
9719  g_vmcs_fields[addr] = sidt::base_reg::rdi << sidt::base_reg::from;
9720  this->expect_true(sidt::base_reg::get() == sidt::base_reg::rdi);
9721 
9722  g_vmcs_fields[addr] = sidt::base_reg::rcx << sidt::base_reg::from;
9724 }
9725 
9726 void
9727 vmcs_ut::test_vmcs_vm_exit_instruction_information_sidt_base_reg_invalid()
9728 {
9729  using namespace vmcs::vm_exit_instruction_information;
9730 
9732  this->expect_true(sidt::base_reg_invalid::get() == sidt::base_reg_invalid::valid);
9733 
9736 }
9737 
9738 void
9739 vmcs_ut::test_vmcs_vm_exit_instruction_information_sidt_instruction_identity()
9740 {
9741  using namespace vmcs::vm_exit_instruction_information;
9742 
9744  this->expect_true(sidt::instruction_identity::get() == sidt::instruction_identity::sgdt);
9745 
9748 }
9749 
9750 void
9751 vmcs_ut::test_vmcs_vm_exit_instruction_information_sgdt()
9752 {
9753  using namespace vmcs::vm_exit_instruction_information;
9754 
9755  g_vmcs_fields[addr] = 1UL;
9756 
9758  this->expect_true(sgdt::get() == 1UL);
9759  this->expect_true(sgdt::get_if_exists() == 1UL);
9760 }
9761 
9762 void
9763 vmcs_ut::test_vmcs_vm_exit_instruction_information_sgdt_scaling()
9764 {
9765  using namespace vmcs::vm_exit_instruction_information;
9766 
9768  this->expect_true(sgdt::scaling::get() == sgdt::scaling::scale_by_2);
9769 
9772 }
9773 
9774 void
9775 vmcs_ut::test_vmcs_vm_exit_instruction_information_sgdt_address_size()
9776 {
9777  using namespace vmcs::vm_exit_instruction_information;
9778 
9780  this->expect_true(sgdt::address_size::get() == sgdt::address_size::_32bit);
9781 
9784 }
9785 
9786 void
9787 vmcs_ut::test_vmcs_vm_exit_instruction_information_sgdt_operand_size()
9788 {
9789  using namespace vmcs::vm_exit_instruction_information;
9790 
9792  this->expect_true(sgdt::operand_size::get() == sgdt::operand_size::_16bit);
9793 
9796 }
9797 
9798 void
9799 vmcs_ut::test_vmcs_vm_exit_instruction_information_sgdt_segment_register()
9800 {
9801  using namespace vmcs::vm_exit_instruction_information;
9802 
9804  this->expect_true(sgdt::segment_register::get() == sgdt::segment_register::cs);
9805 
9808 }
9809 
9810 void
9811 vmcs_ut::test_vmcs_vm_exit_instruction_information_sgdt_index_reg()
9812 {
9813  using namespace vmcs::vm_exit_instruction_information;
9814 
9815  g_vmcs_fields[addr] = sgdt::index_reg::rsi << sgdt::index_reg::from;
9816  this->expect_true(sgdt::index_reg::get() == sgdt::index_reg::rsi);
9817 
9818  g_vmcs_fields[addr] = sgdt::index_reg::r11 << sgdt::index_reg::from;
9820 }
9821 
9822 void
9823 vmcs_ut::test_vmcs_vm_exit_instruction_information_sgdt_index_reg_invalid()
9824 {
9825  using namespace vmcs::vm_exit_instruction_information;
9826 
9828  this->expect_true(sgdt::index_reg_invalid::get() == sgdt::index_reg_invalid::valid);
9829 
9832 }
9833 
9834 void
9835 vmcs_ut::test_vmcs_vm_exit_instruction_information_sgdt_base_reg()
9836 {
9837  using namespace vmcs::vm_exit_instruction_information;
9838 
9839  g_vmcs_fields[addr] = sgdt::base_reg::rdi << sgdt::base_reg::from;
9840  this->expect_true(sgdt::base_reg::get() == sgdt::base_reg::rdi);
9841 
9842  g_vmcs_fields[addr] = sgdt::base_reg::rcx << sgdt::base_reg::from;
9844 }
9845 
9846 void
9847 vmcs_ut::test_vmcs_vm_exit_instruction_information_sgdt_base_reg_invalid()
9848 {
9849  using namespace vmcs::vm_exit_instruction_information;
9850 
9852  this->expect_true(sgdt::base_reg_invalid::get() == sgdt::base_reg_invalid::valid);
9853 
9856 }
9857 
9858 void
9859 vmcs_ut::test_vmcs_vm_exit_instruction_information_sgdt_instruction_identity()
9860 {
9861  using namespace vmcs::vm_exit_instruction_information;
9862 
9864  this->expect_true(sgdt::instruction_identity::get() == sgdt::instruction_identity::sgdt);
9865 
9868 }
9869 
9870 void
9871 vmcs_ut::test_vmcs_vm_exit_instruction_information_lldt()
9872 {
9873  using namespace vmcs::vm_exit_instruction_information;
9874 
9875  g_vmcs_fields[addr] = 1UL;
9876 
9878  this->expect_true(lldt::get() == 1UL);
9879  this->expect_true(lldt::get_if_exists() == 1UL);
9880 }
9881 
9882 void
9883 vmcs_ut::test_vmcs_vm_exit_instruction_information_lldt_scaling()
9884 {
9885  using namespace vmcs::vm_exit_instruction_information;
9886 
9888  this->expect_true(lldt::scaling::get() == lldt::scaling::scale_by_2);
9889 
9892 }
9893 
9894 void
9895 vmcs_ut::test_vmcs_vm_exit_instruction_information_lldt_reg1()
9896 {
9897  using namespace vmcs::vm_exit_instruction_information;
9898 
9899  g_vmcs_fields[addr] = lldt::reg1::rbp << lldt::reg1::from;
9900  this->expect_true(lldt::reg1::get() == lldt::reg1::rbp);
9901 
9902  g_vmcs_fields[addr] = lldt::reg1::r13 << lldt::reg1::from;
9904 }
9905 
9906 void
9907 vmcs_ut::test_vmcs_vm_exit_instruction_information_lldt_address_size()
9908 {
9909  using namespace vmcs::vm_exit_instruction_information;
9910 
9912  this->expect_true(lldt::address_size::get() == lldt::address_size::_32bit);
9913 
9916 }
9917 
9918 void
9919 vmcs_ut::test_vmcs_vm_exit_instruction_information_lldt_mem_reg()
9920 {
9921  using namespace vmcs::vm_exit_instruction_information;
9922 
9923  g_vmcs_fields[addr] = lldt::mem_reg::mem << lldt::mem_reg::from;
9924  this->expect_true(lldt::mem_reg::get() == lldt::mem_reg::mem);
9925 
9926  g_vmcs_fields[addr] = lldt::mem_reg::reg << lldt::mem_reg::from;
9928 }
9929 
9930 void
9931 vmcs_ut::test_vmcs_vm_exit_instruction_information_lldt_segment_register()
9932 {
9933  using namespace vmcs::vm_exit_instruction_information;
9934 
9936  this->expect_true(lldt::segment_register::get() == lldt::segment_register::cs);
9937 
9940 }
9941 
9942 void
9943 vmcs_ut::test_vmcs_vm_exit_instruction_information_lldt_index_reg()
9944 {
9945  using namespace vmcs::vm_exit_instruction_information;
9946 
9947  g_vmcs_fields[addr] = lldt::index_reg::rsi << lldt::index_reg::from;
9948  this->expect_true(lldt::index_reg::get() == lldt::index_reg::rsi);
9949 
9950  g_vmcs_fields[addr] = lldt::index_reg::r11 << lldt::index_reg::from;
9952 }
9953 
9954 void
9955 vmcs_ut::test_vmcs_vm_exit_instruction_information_lldt_index_reg_invalid()
9956 {
9957  using namespace vmcs::vm_exit_instruction_information;
9958 
9960  this->expect_true(lldt::index_reg_invalid::get() == lldt::index_reg_invalid::valid);
9961 
9964 }
9965 
9966 void
9967 vmcs_ut::test_vmcs_vm_exit_instruction_information_lldt_base_reg()
9968 {
9969  using namespace vmcs::vm_exit_instruction_information;
9970 
9971  g_vmcs_fields[addr] = lldt::base_reg::rdi << lldt::base_reg::from;
9972  this->expect_true(lldt::base_reg::get() == lldt::base_reg::rdi);
9973 
9974  g_vmcs_fields[addr] = lldt::base_reg::rcx << lldt::base_reg::from;
9976 }
9977 
9978 void
9979 vmcs_ut::test_vmcs_vm_exit_instruction_information_lldt_base_reg_invalid()
9980 {
9981  using namespace vmcs::vm_exit_instruction_information;
9982 
9984  this->expect_true(lldt::base_reg_invalid::get() == lldt::base_reg_invalid::valid);
9985 
9988 }
9989 
9990 void
9991 vmcs_ut::test_vmcs_vm_exit_instruction_information_lldt_instruction_identity()
9992 {
9993  using namespace vmcs::vm_exit_instruction_information;
9994 
9996  this->expect_true(lldt::instruction_identity::get() == lldt::instruction_identity::sldt);
9997 
10000 }
10001 
10002 void
10003 vmcs_ut::test_vmcs_vm_exit_instruction_information_ltr()
10004 {
10005  using namespace vmcs::vm_exit_instruction_information;
10006 
10007  g_vmcs_fields[addr] = 1UL;
10008 
10009  this->expect_true(ltr::get_name() == ltr::name);
10010  this->expect_true(ltr::get() == 1UL);
10011  this->expect_true(ltr::get_if_exists() == 1UL);
10012 }
10013 
10014 void
10015 vmcs_ut::test_vmcs_vm_exit_instruction_information_ltr_scaling()
10016 {
10017  using namespace vmcs::vm_exit_instruction_information;
10018 
10019  g_vmcs_fields[addr] = ltr::scaling::scale_by_2 << ltr::scaling::from;
10020  this->expect_true(ltr::scaling::get() == ltr::scaling::scale_by_2);
10021 
10022  g_vmcs_fields[addr] = ltr::scaling::scale_by_8 << ltr::scaling::from;
10024 }
10025 
10026 void
10027 vmcs_ut::test_vmcs_vm_exit_instruction_information_ltr_reg1()
10028 {
10029  using namespace vmcs::vm_exit_instruction_information;
10030 
10031  g_vmcs_fields[addr] = ltr::reg1::rbp << ltr::reg1::from;
10032  this->expect_true(ltr::reg1::get() == ltr::reg1::rbp);
10033 
10034  g_vmcs_fields[addr] = ltr::reg1::r13 << ltr::reg1::from;
10036 }
10037 
10038 void
10039 vmcs_ut::test_vmcs_vm_exit_instruction_information_ltr_address_size()
10040 {
10041  using namespace vmcs::vm_exit_instruction_information;
10042 
10044  this->expect_true(ltr::address_size::get() == ltr::address_size::_32bit);
10045 
10048 }
10049 
10050 void
10051 vmcs_ut::test_vmcs_vm_exit_instruction_information_ltr_mem_reg()
10052 {
10053  using namespace vmcs::vm_exit_instruction_information;
10054 
10055  g_vmcs_fields[addr] = ltr::mem_reg::mem << ltr::mem_reg::from;
10056  this->expect_true(ltr::mem_reg::get() == ltr::mem_reg::mem);
10057 
10058  g_vmcs_fields[addr] = ltr::mem_reg::reg << ltr::mem_reg::from;
10060 }
10061 
10062 void
10063 vmcs_ut::test_vmcs_vm_exit_instruction_information_ltr_segment_register()
10064 {
10065  using namespace vmcs::vm_exit_instruction_information;
10066 
10068  this->expect_true(ltr::segment_register::get() == ltr::segment_register::cs);
10069 
10072 }
10073 
10074 void
10075 vmcs_ut::test_vmcs_vm_exit_instruction_information_ltr_index_reg()
10076 {
10077  using namespace vmcs::vm_exit_instruction_information;
10078 
10079  g_vmcs_fields[addr] = ltr::index_reg::rsi << ltr::index_reg::from;
10080  this->expect_true(ltr::index_reg::get() == ltr::index_reg::rsi);
10081 
10082  g_vmcs_fields[addr] = ltr::index_reg::r11 << ltr::index_reg::from;
10084 }
10085 
10086 void
10087 vmcs_ut::test_vmcs_vm_exit_instruction_information_ltr_index_reg_invalid()
10088 {
10089  using namespace vmcs::vm_exit_instruction_information;
10090 
10092  this->expect_true(ltr::index_reg_invalid::get() == ltr::index_reg_invalid::valid);
10093 
10096 }
10097 
10098 void
10099 vmcs_ut::test_vmcs_vm_exit_instruction_information_ltr_base_reg()
10100 {
10101  using namespace vmcs::vm_exit_instruction_information;
10102 
10103  g_vmcs_fields[addr] = ltr::base_reg::rdi << ltr::base_reg::from;
10104  this->expect_true(ltr::base_reg::get() == ltr::base_reg::rdi);
10105 
10106  g_vmcs_fields[addr] = ltr::base_reg::rcx << ltr::base_reg::from;
10108 }
10109 
10110 void
10111 vmcs_ut::test_vmcs_vm_exit_instruction_information_ltr_base_reg_invalid()
10112 {
10113  using namespace vmcs::vm_exit_instruction_information;
10114 
10116  this->expect_true(ltr::base_reg_invalid::get() == ltr::base_reg_invalid::valid);
10117 
10120 }
10121 
10122 void
10123 vmcs_ut::test_vmcs_vm_exit_instruction_information_ltr_instruction_identity()
10124 {
10125  using namespace vmcs::vm_exit_instruction_information;
10126 
10128  this->expect_true(ltr::instruction_identity::get() == ltr::instruction_identity::sldt);
10129 
10132 }
10133 
10134 void
10135 vmcs_ut::test_vmcs_vm_exit_instruction_information_sldt()
10136 {
10137  using namespace vmcs::vm_exit_instruction_information;
10138 
10139  g_vmcs_fields[addr] = 1UL;
10140 
10142  this->expect_true(sldt::get() == 1UL);
10143  this->expect_true(sldt::get_if_exists() == 1UL);
10144 }
10145 
10146 void
10147 vmcs_ut::test_vmcs_vm_exit_instruction_information_sldt_scaling()
10148 {
10149  using namespace vmcs::vm_exit_instruction_information;
10150 
10152  this->expect_true(sldt::scaling::get() == sldt::scaling::scale_by_2);
10153 
10156 }
10157 
10158 void
10159 vmcs_ut::test_vmcs_vm_exit_instruction_information_sldt_reg1()
10160 {
10161  using namespace vmcs::vm_exit_instruction_information;
10162 
10163  g_vmcs_fields[addr] = sldt::reg1::rbp << sldt::reg1::from;
10164  this->expect_true(sldt::reg1::get() == sldt::reg1::rbp);
10165 
10166  g_vmcs_fields[addr] = sldt::reg1::r13 << sldt::reg1::from;
10168 }
10169 
10170 void
10171 vmcs_ut::test_vmcs_vm_exit_instruction_information_sldt_address_size()
10172 {
10173  using namespace vmcs::vm_exit_instruction_information;
10174 
10176  this->expect_true(sldt::address_size::get() == sldt::address_size::_32bit);
10177 
10180 }
10181 
10182 void
10183 vmcs_ut::test_vmcs_vm_exit_instruction_information_sldt_mem_reg()
10184 {
10185  using namespace vmcs::vm_exit_instruction_information;
10186 
10187  g_vmcs_fields[addr] = sldt::mem_reg::mem << sldt::mem_reg::from;
10188  this->expect_true(sldt::mem_reg::get() == sldt::mem_reg::mem);
10189 
10190  g_vmcs_fields[addr] = sldt::mem_reg::reg << sldt::mem_reg::from;
10192 }
10193 
10194 void
10195 vmcs_ut::test_vmcs_vm_exit_instruction_information_sldt_segment_register()
10196 {
10197  using namespace vmcs::vm_exit_instruction_information;
10198 
10200  this->expect_true(sldt::segment_register::get() == sldt::segment_register::cs);
10201 
10204 }
10205 
10206 void
10207 vmcs_ut::test_vmcs_vm_exit_instruction_information_sldt_index_reg()
10208 {
10209  using namespace vmcs::vm_exit_instruction_information;
10210 
10211  g_vmcs_fields[addr] = sldt::index_reg::rsi << sldt::index_reg::from;
10212  this->expect_true(sldt::index_reg::get() == sldt::index_reg::rsi);
10213 
10214  g_vmcs_fields[addr] = sldt::index_reg::r11 << sldt::index_reg::from;
10216 }
10217 
10218 void
10219 vmcs_ut::test_vmcs_vm_exit_instruction_information_sldt_index_reg_invalid()
10220 {
10221  using namespace vmcs::vm_exit_instruction_information;
10222 
10224  this->expect_true(sldt::index_reg_invalid::get() == sldt::index_reg_invalid::valid);
10225 
10228 }
10229 
10230 void
10231 vmcs_ut::test_vmcs_vm_exit_instruction_information_sldt_base_reg()
10232 {
10233  using namespace vmcs::vm_exit_instruction_information;
10234 
10235  g_vmcs_fields[addr] = sldt::base_reg::rdi << sldt::base_reg::from;
10236  this->expect_true(sldt::base_reg::get() == sldt::base_reg::rdi);
10237 
10238  g_vmcs_fields[addr] = sldt::base_reg::rcx << sldt::base_reg::from;
10240 }
10241 
10242 void
10243 vmcs_ut::test_vmcs_vm_exit_instruction_information_sldt_base_reg_invalid()
10244 {
10245  using namespace vmcs::vm_exit_instruction_information;
10246 
10248  this->expect_true(sldt::base_reg_invalid::get() == sldt::base_reg_invalid::valid);
10249 
10252 }
10253 
10254 void
10255 vmcs_ut::test_vmcs_vm_exit_instruction_information_sldt_instruction_identity()
10256 {
10257  using namespace vmcs::vm_exit_instruction_information;
10258 
10260  this->expect_true(sldt::instruction_identity::get() == sldt::instruction_identity::sldt);
10261 
10264 }
10265 
10266 void
10267 vmcs_ut::test_vmcs_vm_exit_instruction_information_str()
10268 {
10269  using namespace vmcs::vm_exit_instruction_information;
10270 
10271  g_vmcs_fields[addr] = 1UL;
10272 
10273  this->expect_true(str::get_name() == str::name);
10274  this->expect_true(str::get() == 1UL);
10275  this->expect_true(str::get_if_exists() == 1UL);
10276 }
10277 
10278 void
10279 vmcs_ut::test_vmcs_vm_exit_instruction_information_str_scaling()
10280 {
10281  using namespace vmcs::vm_exit_instruction_information;
10282 
10283  g_vmcs_fields[addr] = str::scaling::scale_by_2 << str::scaling::from;
10284  this->expect_true(str::scaling::get() == str::scaling::scale_by_2);
10285 
10286  g_vmcs_fields[addr] = str::scaling::scale_by_8 << str::scaling::from;
10288 }
10289 
10290 void
10291 vmcs_ut::test_vmcs_vm_exit_instruction_information_str_reg1()
10292 {
10293  using namespace vmcs::vm_exit_instruction_information;
10294 
10295  g_vmcs_fields[addr] = str::reg1::rbp << str::reg1::from;
10296  this->expect_true(str::reg1::get() == str::reg1::rbp);
10297 
10298  g_vmcs_fields[addr] = str::reg1::r13 << str::reg1::from;
10300 }
10301 
10302 void
10303 vmcs_ut::test_vmcs_vm_exit_instruction_information_str_address_size()
10304 {
10305  using namespace vmcs::vm_exit_instruction_information;
10306 
10308  this->expect_true(str::address_size::get() == str::address_size::_32bit);
10309 
10312 }
10313 
10314 void
10315 vmcs_ut::test_vmcs_vm_exit_instruction_information_str_mem_reg()
10316 {
10317  using namespace vmcs::vm_exit_instruction_information;
10318 
10319  g_vmcs_fields[addr] = str::mem_reg::mem << str::mem_reg::from;
10320  this->expect_true(str::mem_reg::get() == str::mem_reg::mem);
10321 
10322  g_vmcs_fields[addr] = str::mem_reg::reg << str::mem_reg::from;
10324 }
10325 
10326 void
10327 vmcs_ut::test_vmcs_vm_exit_instruction_information_str_segment_register()
10328 {
10329  using namespace vmcs::vm_exit_instruction_information;
10330 
10332  this->expect_true(str::segment_register::get() == str::segment_register::cs);
10333 
10336 }
10337 
10338 void
10339 vmcs_ut::test_vmcs_vm_exit_instruction_information_str_index_reg()
10340 {
10341  using namespace vmcs::vm_exit_instruction_information;
10342 
10343  g_vmcs_fields[addr] = str::index_reg::rsi << str::index_reg::from;
10344  this->expect_true(str::index_reg::get() == str::index_reg::rsi);
10345 
10346  g_vmcs_fields[addr] = str::index_reg::r11 << str::index_reg::from;
10348 }
10349 
10350 void
10351 vmcs_ut::test_vmcs_vm_exit_instruction_information_str_index_reg_invalid()
10352 {
10353  using namespace vmcs::vm_exit_instruction_information;
10354 
10356  this->expect_true(str::index_reg_invalid::get() == str::index_reg_invalid::valid);
10357 
10360 }
10361 
10362 void
10363 vmcs_ut::test_vmcs_vm_exit_instruction_information_str_base_reg()
10364 {
10365  using namespace vmcs::vm_exit_instruction_information;
10366 
10367  g_vmcs_fields[addr] = str::base_reg::rdi << str::base_reg::from;
10368  this->expect_true(str::base_reg::get() == str::base_reg::rdi);
10369 
10370  g_vmcs_fields[addr] = str::base_reg::rcx << str::base_reg::from;
10372 }
10373 
10374 void
10375 vmcs_ut::test_vmcs_vm_exit_instruction_information_str_base_reg_invalid()
10376 {
10377  using namespace vmcs::vm_exit_instruction_information;
10378 
10380  this->expect_true(str::base_reg_invalid::get() == str::base_reg_invalid::valid);
10381 
10384 }
10385 
10386 void
10387 vmcs_ut::test_vmcs_vm_exit_instruction_information_str_instruction_identity()
10388 {
10389  using namespace vmcs::vm_exit_instruction_information;
10390 
10392  this->expect_true(str::instruction_identity::get() == str::instruction_identity::sldt);
10393 
10396 }
10397 
10398 void
10399 vmcs_ut::test_vmcs_vm_exit_instruction_information_rdrand()
10400 {
10401  using namespace vmcs::vm_exit_instruction_information;
10402 
10403  g_vmcs_fields[addr] = 1UL;
10404 
10406  this->expect_true(rdrand::get() == 1UL);
10407  this->expect_true(rdrand::get_if_exists() == 1UL);
10408 }
10409 
10410 void
10411 vmcs_ut::test_vmcs_vm_exit_instruction_information_rdrand_destination_register()
10412 {
10413  using namespace vmcs::vm_exit_instruction_information;
10414 
10416  this->expect_true(rdrand::destination_register::get() == rdrand::destination_register::rdx);
10417 
10420 }
10421 
10422 void
10423 vmcs_ut::test_vmcs_vm_exit_instruction_information_rdrand_operand_size()
10424 {
10425  using namespace vmcs::vm_exit_instruction_information;
10426 
10428  this->expect_true(rdrand::operand_size::get() == rdrand::operand_size::_16bit);
10429 
10432 }
10433 
10434 void
10435 vmcs_ut::test_vmcs_vm_exit_instruction_information_rdseed()
10436 {
10437  using namespace vmcs::vm_exit_instruction_information;
10438 
10439  g_vmcs_fields[addr] = 1UL;
10440 
10442  this->expect_true(rdseed::get() == 1UL);
10443  this->expect_true(rdseed::get_if_exists() == 1UL);
10444 }
10445 
10446 void
10447 vmcs_ut::test_vmcs_vm_exit_instruction_information_rdseed_destination_register()
10448 {
10449  using namespace vmcs::vm_exit_instruction_information;
10450 
10452  this->expect_true(rdseed::destination_register::get() == rdseed::destination_register::rdx);
10453 
10456 }
10457 
10458 void
10459 vmcs_ut::test_vmcs_vm_exit_instruction_information_rdseed_operand_size()
10460 {
10461  using namespace vmcs::vm_exit_instruction_information;
10462 
10464  this->expect_true(rdseed::operand_size::get() == rdseed::operand_size::_16bit);
10465 
10468 }
10469 
10470 void
10471 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmclear()
10472 {
10473  using namespace vmcs::vm_exit_instruction_information;
10474 
10475  g_vmcs_fields[addr] = 1UL;
10476 
10478  this->expect_true(vmclear::get() == 1UL);
10479  this->expect_true(vmclear::get_if_exists() == 1UL);
10480 }
10481 
10482 void
10483 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmclear_scaling()
10484 {
10485  using namespace vmcs::vm_exit_instruction_information;
10486 
10488  this->expect_true(vmclear::scaling::get() == vmclear::scaling::scale_by_2);
10489 
10492 }
10493 
10494 void
10495 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmclear_address_size()
10496 {
10497  using namespace vmcs::vm_exit_instruction_information;
10498 
10500  this->expect_true(vmclear::address_size::get() == vmclear::address_size::_32bit);
10501 
10504 }
10505 
10506 void
10507 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmclear_segment_register()
10508 {
10509  using namespace vmcs::vm_exit_instruction_information;
10510 
10512  this->expect_true(vmclear::segment_register::get() == vmclear::segment_register::cs);
10513 
10516 }
10517 
10518 void
10519 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmclear_index_reg()
10520 {
10521  using namespace vmcs::vm_exit_instruction_information;
10522 
10524  this->expect_true(vmclear::index_reg::get() == vmclear::index_reg::rsi);
10525 
10528 }
10529 
10530 void
10531 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmclear_index_reg_invalid()
10532 {
10533  using namespace vmcs::vm_exit_instruction_information;
10534 
10536  this->expect_true(vmclear::index_reg_invalid::get() == vmclear::index_reg_invalid::valid);
10537 
10540 }
10541 
10542 void
10543 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmclear_base_reg()
10544 {
10545  using namespace vmcs::vm_exit_instruction_information;
10546 
10548  this->expect_true(vmclear::base_reg::get() == vmclear::base_reg::rdi);
10549 
10552 }
10553 
10554 void
10555 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmclear_base_reg_invalid()
10556 {
10557  using namespace vmcs::vm_exit_instruction_information;
10558 
10560  this->expect_true(vmclear::base_reg_invalid::get() == vmclear::base_reg_invalid::valid);
10561 
10564 }
10565 
10566 void
10567 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrld()
10568 {
10569  using namespace vmcs::vm_exit_instruction_information;
10570 
10571  g_vmcs_fields[addr] = 1UL;
10572 
10574  this->expect_true(vmptrld::get() == 1UL);
10575  this->expect_true(vmptrld::get_if_exists() == 1UL);
10576 }
10577 
10578 void
10579 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrld_scaling()
10580 {
10581  using namespace vmcs::vm_exit_instruction_information;
10582 
10584  this->expect_true(vmptrld::scaling::get() == vmptrld::scaling::scale_by_2);
10585 
10588 }
10589 
10590 void
10591 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrld_address_size()
10592 {
10593  using namespace vmcs::vm_exit_instruction_information;
10594 
10596  this->expect_true(vmptrld::address_size::get() == vmptrld::address_size::_32bit);
10597 
10600 }
10601 
10602 void
10603 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrld_segment_register()
10604 {
10605  using namespace vmcs::vm_exit_instruction_information;
10606 
10608  this->expect_true(vmptrld::segment_register::get() == vmptrld::segment_register::cs);
10609 
10612 }
10613 
10614 void
10615 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrld_index_reg()
10616 {
10617  using namespace vmcs::vm_exit_instruction_information;
10618 
10620  this->expect_true(vmptrld::index_reg::get() == vmptrld::index_reg::rsi);
10621 
10624 }
10625 
10626 void
10627 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrld_index_reg_invalid()
10628 {
10629  using namespace vmcs::vm_exit_instruction_information;
10630 
10632  this->expect_true(vmptrld::index_reg_invalid::get() == vmptrld::index_reg_invalid::valid);
10633 
10636 }
10637 
10638 void
10639 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrld_base_reg()
10640 {
10641  using namespace vmcs::vm_exit_instruction_information;
10642 
10644  this->expect_true(vmptrld::base_reg::get() == vmptrld::base_reg::rdi);
10645 
10648 }
10649 
10650 void
10651 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrld_base_reg_invalid()
10652 {
10653  using namespace vmcs::vm_exit_instruction_information;
10654 
10656  this->expect_true(vmptrld::base_reg_invalid::get() == vmptrld::base_reg_invalid::valid);
10657 
10660 }
10661 
10662 void
10663 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrst()
10664 {
10665  using namespace vmcs::vm_exit_instruction_information;
10666 
10667  g_vmcs_fields[addr] = 1UL;
10668 
10670  this->expect_true(vmptrst::get() == 1UL);
10671  this->expect_true(vmptrst::get_if_exists() == 1UL);
10672 }
10673 
10674 void
10675 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrst_scaling()
10676 {
10677  using namespace vmcs::vm_exit_instruction_information;
10678 
10680  this->expect_true(vmptrst::scaling::get() == vmptrst::scaling::scale_by_2);
10681 
10684 }
10685 
10686 void
10687 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrst_address_size()
10688 {
10689  using namespace vmcs::vm_exit_instruction_information;
10690 
10692  this->expect_true(vmptrst::address_size::get() == vmptrst::address_size::_32bit);
10693 
10696 }
10697 
10698 void
10699 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrst_segment_register()
10700 {
10701  using namespace vmcs::vm_exit_instruction_information;
10702 
10704  this->expect_true(vmptrst::segment_register::get() == vmptrst::segment_register::cs);
10705 
10708 }
10709 
10710 void
10711 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrst_index_reg()
10712 {
10713  using namespace vmcs::vm_exit_instruction_information;
10714 
10716  this->expect_true(vmptrst::index_reg::get() == vmptrst::index_reg::rsi);
10717 
10720 }
10721 
10722 void
10723 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrst_index_reg_invalid()
10724 {
10725  using namespace vmcs::vm_exit_instruction_information;
10726 
10728  this->expect_true(vmptrst::index_reg_invalid::get() == vmptrst::index_reg_invalid::valid);
10729 
10732 }
10733 
10734 void
10735 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrst_base_reg()
10736 {
10737  using namespace vmcs::vm_exit_instruction_information;
10738 
10740  this->expect_true(vmptrst::base_reg::get() == vmptrst::base_reg::rdi);
10741 
10744 }
10745 
10746 void
10747 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmptrst_base_reg_invalid()
10748 {
10749  using namespace vmcs::vm_exit_instruction_information;
10750 
10752  this->expect_true(vmptrst::base_reg_invalid::get() == vmptrst::base_reg_invalid::valid);
10753 
10756 }
10757 
10758 void
10759 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmxon()
10760 {
10761  using namespace vmcs::vm_exit_instruction_information;
10762 
10763  g_vmcs_fields[addr] = 1UL;
10764 
10766  this->expect_true(vmxon::get() == 1UL);
10767  this->expect_true(vmxon::get_if_exists() == 1UL);
10768 }
10769 
10770 void
10771 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmxon_scaling()
10772 {
10773  using namespace vmcs::vm_exit_instruction_information;
10774 
10776  this->expect_true(vmxon::scaling::get() == vmxon::scaling::scale_by_2);
10777 
10780 }
10781 
10782 void
10783 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmxon_address_size()
10784 {
10785  using namespace vmcs::vm_exit_instruction_information;
10786 
10788  this->expect_true(vmxon::address_size::get() == vmxon::address_size::_32bit);
10789 
10792 }
10793 
10794 void
10795 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmxon_segment_register()
10796 {
10797  using namespace vmcs::vm_exit_instruction_information;
10798 
10800  this->expect_true(vmxon::segment_register::get() == vmxon::segment_register::cs);
10801 
10804 }
10805 
10806 void
10807 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmxon_index_reg()
10808 {
10809  using namespace vmcs::vm_exit_instruction_information;
10810 
10812  this->expect_true(vmxon::index_reg::get() == vmxon::index_reg::rsi);
10813 
10816 }
10817 
10818 void
10819 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmxon_index_reg_invalid()
10820 {
10821  using namespace vmcs::vm_exit_instruction_information;
10822 
10824  this->expect_true(vmxon::index_reg_invalid::get() == vmxon::index_reg_invalid::valid);
10825 
10828 }
10829 
10830 void
10831 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmxon_base_reg()
10832 {
10833  using namespace vmcs::vm_exit_instruction_information;
10834 
10835  g_vmcs_fields[addr] = vmxon::base_reg::rdi << vmxon::base_reg::from;
10836  this->expect_true(vmxon::base_reg::get() == vmxon::base_reg::rdi);
10837 
10838  g_vmcs_fields[addr] = vmxon::base_reg::rcx << vmxon::base_reg::from;
10840 }
10841 
10842 void
10843 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmxon_base_reg_invalid()
10844 {
10845  using namespace vmcs::vm_exit_instruction_information;
10846 
10848  this->expect_true(vmxon::base_reg_invalid::get() == vmxon::base_reg_invalid::valid);
10849 
10852 }
10853 
10854 void
10855 vmcs_ut::test_vmcs_vm_exit_instruction_information_xrstors()
10856 {
10857  using namespace vmcs::vm_exit_instruction_information;
10858 
10859  g_vmcs_fields[addr] = 1UL;
10860 
10862  this->expect_true(xrstors::get() == 1UL);
10863  this->expect_true(xrstors::get_if_exists() == 1UL);
10864 }
10865 
10866 void
10867 vmcs_ut::test_vmcs_vm_exit_instruction_information_xrstors_scaling()
10868 {
10869  using namespace vmcs::vm_exit_instruction_information;
10870 
10872  this->expect_true(xrstors::scaling::get() == xrstors::scaling::scale_by_2);
10873 
10876 }
10877 
10878 void
10879 vmcs_ut::test_vmcs_vm_exit_instruction_information_xrstors_address_size()
10880 {
10881  using namespace vmcs::vm_exit_instruction_information;
10882 
10884  this->expect_true(xrstors::address_size::get() == xrstors::address_size::_32bit);
10885 
10888 }
10889 
10890 void
10891 vmcs_ut::test_vmcs_vm_exit_instruction_information_xrstors_segment_register()
10892 {
10893  using namespace vmcs::vm_exit_instruction_information;
10894 
10896  this->expect_true(xrstors::segment_register::get() == xrstors::segment_register::cs);
10897 
10900 }
10901 
10902 void
10903 vmcs_ut::test_vmcs_vm_exit_instruction_information_xrstors_index_reg()
10904 {
10905  using namespace vmcs::vm_exit_instruction_information;
10906 
10908  this->expect_true(xrstors::index_reg::get() == xrstors::index_reg::rsi);
10909 
10912 }
10913 
10914 void
10915 vmcs_ut::test_vmcs_vm_exit_instruction_information_xrstors_index_reg_invalid()
10916 {
10917  using namespace vmcs::vm_exit_instruction_information;
10918 
10920  this->expect_true(xrstors::index_reg_invalid::get() == xrstors::index_reg_invalid::valid);
10921 
10924 }
10925 
10926 void
10927 vmcs_ut::test_vmcs_vm_exit_instruction_information_xrstors_base_reg()
10928 {
10929  using namespace vmcs::vm_exit_instruction_information;
10930 
10932  this->expect_true(xrstors::base_reg::get() == xrstors::base_reg::rdi);
10933 
10936 }
10937 
10938 void
10939 vmcs_ut::test_vmcs_vm_exit_instruction_information_xrstors_base_reg_invalid()
10940 {
10941  using namespace vmcs::vm_exit_instruction_information;
10942 
10944  this->expect_true(xrstors::base_reg_invalid::get() == xrstors::base_reg_invalid::valid);
10945 
10948 }
10949 
10950 void
10951 vmcs_ut::test_vmcs_vm_exit_instruction_information_xsaves()
10952 {
10953  using namespace vmcs::vm_exit_instruction_information;
10954 
10955  g_vmcs_fields[addr] = 1UL;
10956 
10958  this->expect_true(xsaves::get() == 1UL);
10959  this->expect_true(xsaves::get_if_exists() == 1UL);
10960 }
10961 
10962 void
10963 vmcs_ut::test_vmcs_vm_exit_instruction_information_xsaves_scaling()
10964 {
10965  using namespace vmcs::vm_exit_instruction_information;
10966 
10968  this->expect_true(xsaves::scaling::get() == xsaves::scaling::scale_by_2);
10969 
10972 }
10973 
10974 void
10975 vmcs_ut::test_vmcs_vm_exit_instruction_information_xsaves_address_size()
10976 {
10977  using namespace vmcs::vm_exit_instruction_information;
10978 
10980  this->expect_true(xsaves::address_size::get() == xsaves::address_size::_32bit);
10981 
10984 }
10985 
10986 void
10987 vmcs_ut::test_vmcs_vm_exit_instruction_information_xsaves_segment_register()
10988 {
10989  using namespace vmcs::vm_exit_instruction_information;
10990 
10992  this->expect_true(xsaves::segment_register::get() == xsaves::segment_register::cs);
10993 
10996 }
10997 
10998 void
10999 vmcs_ut::test_vmcs_vm_exit_instruction_information_xsaves_index_reg()
11000 {
11001  using namespace vmcs::vm_exit_instruction_information;
11002 
11004  this->expect_true(xsaves::index_reg::get() == xsaves::index_reg::rsi);
11005 
11008 }
11009 
11010 void
11011 vmcs_ut::test_vmcs_vm_exit_instruction_information_xsaves_index_reg_invalid()
11012 {
11013  using namespace vmcs::vm_exit_instruction_information;
11014 
11016  this->expect_true(xsaves::index_reg_invalid::get() == xsaves::index_reg_invalid::valid);
11017 
11020 }
11021 
11022 void
11023 vmcs_ut::test_vmcs_vm_exit_instruction_information_xsaves_base_reg()
11024 {
11025  using namespace vmcs::vm_exit_instruction_information;
11026 
11028  this->expect_true(xsaves::base_reg::get() == xsaves::base_reg::rdi);
11029 
11032 }
11033 
11034 void
11035 vmcs_ut::test_vmcs_vm_exit_instruction_information_xsaves_base_reg_invalid()
11036 {
11037  using namespace vmcs::vm_exit_instruction_information;
11038 
11040  this->expect_true(xsaves::base_reg_invalid::get() == xsaves::base_reg_invalid::valid);
11041 
11044 }
11045 
11046 void
11047 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmread()
11048 {
11049  using namespace vmcs::vm_exit_instruction_information;
11050 
11051  g_vmcs_fields[addr] = 1UL;
11052 
11054  this->expect_true(vmread::get() == 1UL);
11055  this->expect_true(vmread::get_if_exists() == 1UL);
11056 }
11057 
11058 void
11059 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmread_scaling()
11060 {
11061  using namespace vmcs::vm_exit_instruction_information;
11062 
11064  this->expect_true(vmread::scaling::get() == vmread::scaling::scale_by_2);
11065 
11068 }
11069 
11070 void
11071 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmread_reg1()
11072 {
11073  using namespace vmcs::vm_exit_instruction_information;
11074 
11075  g_vmcs_fields[addr] = vmread::reg1::rbp << vmread::reg1::from;
11076  this->expect_true(vmread::reg1::get() == vmread::reg1::rbp);
11077 
11078  g_vmcs_fields[addr] = vmread::reg1::r13 << vmread::reg1::from;
11080 }
11081 
11082 void
11083 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmread_address_size()
11084 {
11085  using namespace vmcs::vm_exit_instruction_information;
11086 
11088  this->expect_true(vmread::address_size::get() == vmread::address_size::_32bit);
11089 
11092 }
11093 
11094 void
11095 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmread_mem_reg()
11096 {
11097  using namespace vmcs::vm_exit_instruction_information;
11098 
11099  g_vmcs_fields[addr] = vmread::mem_reg::mem << vmread::mem_reg::from;
11100  this->expect_true(vmread::mem_reg::get() == vmread::mem_reg::mem);
11101 
11102  g_vmcs_fields[addr] = vmread::mem_reg::reg << vmread::mem_reg::from;
11104 }
11105 
11106 void
11107 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmread_segment_register()
11108 {
11109  using namespace vmcs::vm_exit_instruction_information;
11110 
11112  this->expect_true(vmread::segment_register::get() == vmread::segment_register::cs);
11113 
11116 }
11117 
11118 void
11119 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmread_index_reg()
11120 {
11121  using namespace vmcs::vm_exit_instruction_information;
11122 
11124  this->expect_true(vmread::index_reg::get() == vmread::index_reg::rsi);
11125 
11128 }
11129 
11130 void
11131 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmread_index_reg_invalid()
11132 {
11133  using namespace vmcs::vm_exit_instruction_information;
11134 
11136  this->expect_true(vmread::index_reg_invalid::get() == vmread::index_reg_invalid::valid);
11137 
11140 }
11141 
11142 void
11143 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmread_base_reg()
11144 {
11145  using namespace vmcs::vm_exit_instruction_information;
11146 
11148  this->expect_true(vmread::base_reg::get() == vmread::base_reg::rdi);
11149 
11152 }
11153 
11154 void
11155 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmread_base_reg_invalid()
11156 {
11157  using namespace vmcs::vm_exit_instruction_information;
11158 
11160  this->expect_true(vmread::base_reg_invalid::get() == vmread::base_reg_invalid::valid);
11161 
11164 }
11165 
11166 void
11167 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmread_reg2()
11168 {
11169  using namespace vmcs::vm_exit_instruction_information;
11170 
11171  g_vmcs_fields[addr] = vmread::reg2::rdx << vmread::reg2::from;
11172  this->expect_true(vmread::reg2::get() == vmread::reg2::rdx);
11173 
11174  g_vmcs_fields[addr] = vmread::reg2::rsp << vmread::reg2::from;
11176 }
11177 
11178 void
11179 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmwrite()
11180 {
11181  using namespace vmcs::vm_exit_instruction_information;
11182 
11183  g_vmcs_fields[addr] = 1UL;
11184 
11186  this->expect_true(vmwrite::get() == 1UL);
11187  this->expect_true(vmwrite::get_if_exists() == 1UL);
11188 }
11189 
11190 void
11191 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmwrite_scaling()
11192 {
11193  using namespace vmcs::vm_exit_instruction_information;
11194 
11196  this->expect_true(vmwrite::scaling::get() == vmwrite::scaling::scale_by_2);
11197 
11200 }
11201 
11202 void
11203 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmwrite_reg1()
11204 {
11205  using namespace vmcs::vm_exit_instruction_information;
11206 
11207  g_vmcs_fields[addr] = vmwrite::reg1::rbp << vmwrite::reg1::from;
11208  this->expect_true(vmwrite::reg1::get() == vmwrite::reg1::rbp);
11209 
11210  g_vmcs_fields[addr] = vmwrite::reg1::r13 << vmwrite::reg1::from;
11212 }
11213 
11214 void
11215 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmwrite_address_size()
11216 {
11217  using namespace vmcs::vm_exit_instruction_information;
11218 
11220  this->expect_true(vmwrite::address_size::get() == vmwrite::address_size::_32bit);
11221 
11224 }
11225 
11226 void
11227 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmwrite_mem_reg()
11228 {
11229  using namespace vmcs::vm_exit_instruction_information;
11230 
11232  this->expect_true(vmwrite::mem_reg::get() == vmwrite::mem_reg::mem);
11233 
11236 }
11237 
11238 void
11239 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmwrite_segment_register()
11240 {
11241  using namespace vmcs::vm_exit_instruction_information;
11242 
11244  this->expect_true(vmwrite::segment_register::get() == vmwrite::segment_register::cs);
11245 
11248 }
11249 
11250 void
11251 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmwrite_index_reg()
11252 {
11253  using namespace vmcs::vm_exit_instruction_information;
11254 
11256  this->expect_true(vmwrite::index_reg::get() == vmwrite::index_reg::rsi);
11257 
11260 }
11261 
11262 void
11263 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmwrite_index_reg_invalid()
11264 {
11265  using namespace vmcs::vm_exit_instruction_information;
11266 
11268  this->expect_true(vmwrite::index_reg_invalid::get() == vmwrite::index_reg_invalid::valid);
11269 
11272 }
11273 
11274 void
11275 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmwrite_base_reg()
11276 {
11277  using namespace vmcs::vm_exit_instruction_information;
11278 
11280  this->expect_true(vmwrite::base_reg::get() == vmwrite::base_reg::rdi);
11281 
11284 }
11285 
11286 void
11287 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmwrite_base_reg_invalid()
11288 {
11289  using namespace vmcs::vm_exit_instruction_information;
11290 
11292  this->expect_true(vmwrite::base_reg_invalid::get() == vmwrite::base_reg_invalid::valid);
11293 
11296 }
11297 
11298 void
11299 vmcs_ut::test_vmcs_vm_exit_instruction_information_vmwrite_reg2()
11300 {
11301  using namespace vmcs::vm_exit_instruction_information;
11302 
11303  g_vmcs_fields[addr] = vmwrite::reg2::rdx << vmwrite::reg2::from;
11304  this->expect_true(vmwrite::reg2::get() == vmwrite::reg2::rdx);
11305 
11306  g_vmcs_fields[addr] = vmwrite::reg2::rsp << vmwrite::reg2::from;
11308 }
11309 
11310 void
11311 vmcs_ut::test_vmcs_exit_qualification()
11312 {
11314 
11315  g_vmcs_fields[vmcs::exit_qualification::addr] = 1UL;
11316  this->expect_true(vmcs::exit_qualification::get() == 1UL);
11317 
11318  g_vmcs_fields[vmcs::exit_qualification::addr] = 0UL;
11320 }
11321 
11322 void
11323 vmcs_ut::test_vmcs_exit_qualification_debug_exception()
11324 {
11325  this->expect_true(vmcs::exit_qualification::debug_exception::get_name() == "debug_exception"_s);
11326 
11327  g_vmcs_fields[vmcs::exit_qualification::addr] = 1UL;
11328  this->expect_true(vmcs::exit_qualification::debug_exception::get() == 1UL);
11329 
11330  g_vmcs_fields[vmcs::exit_qualification::addr] = 0UL;
11332 }
11333 
11334 void
11335 vmcs_ut::test_vmcs_exit_qualification_debug_exception_b0()
11336 {
11337  g_vmcs_fields[vmcs::exit_qualification::addr] = 1UL;
11342 
11343  g_vmcs_fields[vmcs::exit_qualification::addr] = 0UL;
11346 }
11347 
11348 void
11349 vmcs_ut::test_vmcs_exit_qualification_debug_exception_b1()
11350 {
11351  g_vmcs_fields[vmcs::exit_qualification::addr] = 2UL;
11356 
11357  g_vmcs_fields[vmcs::exit_qualification::addr] = 0UL;
11360 }
11361 
11362 void
11363 vmcs_ut::test_vmcs_exit_qualification_debug_exception_b2()
11364 {
11365  g_vmcs_fields[vmcs::exit_qualification::addr] = 4UL;
11370 
11371  g_vmcs_fields[vmcs::exit_qualification::addr] = 0UL;
11374 }
11375 
11376 void
11377 vmcs_ut::test_vmcs_exit_qualification_debug_exception_b3()
11378 {
11379  g_vmcs_fields[vmcs::exit_qualification::addr] = 8UL;
11384 
11385  g_vmcs_fields[vmcs::exit_qualification::addr] = 0UL;
11388 }
11389 
11390 void
11391 vmcs_ut::test_vmcs_exit_qualification_debug_exception_reserved()
11392 {
11393  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x600UL;
11394  this->expect_true(vmcs::exit_qualification::debug_exception::reserved::get() == 0x600U);
11395  this->expect_true(vmcs::exit_qualification::debug_exception::reserved::get(0x600UL) == 0x600U);
11396 
11397  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x602UL;
11399 }
11400 
11401 void
11402 vmcs_ut::test_vmcs_exit_qualification_debug_exception_bd()
11403 {
11404  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2000UL;
11409 
11410  g_vmcs_fields[vmcs::exit_qualification::addr] = 0UL;
11413 }
11414 
11415 void
11416 vmcs_ut::test_vmcs_exit_qualification_debug_exception_bs()
11417 {
11418  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x4000UL;
11423 
11424  g_vmcs_fields[vmcs::exit_qualification::addr] = 0UL;
11427 }
11428 
11429 void
11430 vmcs_ut::test_vmcs_exit_qualification_page_fault_exception()
11431 {
11432  this->expect_true(vmcs::exit_qualification::page_fault_exception::get_name() == "page_fault_exception"_s);
11433 
11434  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x4000UL;
11436 
11437  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x10000000UL;
11439 }
11440 
11441 void
11442 vmcs_ut::test_vmcs_exit_qualification_sipi()
11443 {
11445 
11446  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x34UL;
11447  this->expect_true(vmcs::exit_qualification::sipi::get() == 0x34UL);
11448 
11449  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11451 }
11452 
11453 void
11454 vmcs_ut::test_vmcs_exit_qualification_sipi_vector()
11455 {
11456  g_vmcs_fields[vmcs::exit_qualification::addr] = 0xF34UL;
11457  this->expect_true(vmcs::exit_qualification::sipi::vector::get() == 0x34UL);
11458  this->expect_true(vmcs::exit_qualification::sipi::vector::get(0xF34UL) == 0x34UL);
11459 
11460  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x3010UL;
11462 }
11463 
11464 void
11465 vmcs_ut::test_vmcs_exit_qualification_task_switch()
11466 {
11468 
11469  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11470  this->expect_true(vmcs::exit_qualification::task_switch::get() == 0x1UL);
11471 
11472  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11474 }
11475 
11476 void
11477 vmcs_ut::test_vmcs_exit_qualification_task_switch_tss_selector()
11478 {
11479  g_vmcs_fields[vmcs::exit_qualification::addr] = 0xF0003456UL;
11480  this->expect_true(vmcs::exit_qualification::task_switch::tss_selector::get() == 0x3456UL);
11481  this->expect_true(vmcs::exit_qualification::task_switch::tss_selector::get(0xF0003456UL) == 0x3456UL);
11482 
11483  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11485 }
11486 
11487 void
11488 vmcs_ut::test_vmcs_exit_qualification_task_switch_reserved()
11489 {
11490  g_vmcs_fields[vmcs::exit_qualification::addr] = 0xFFF0000UL;
11491  this->expect_true(vmcs::exit_qualification::task_switch::reserved::get() == 0xFFF0000UL);
11492  this->expect_true(vmcs::exit_qualification::task_switch::reserved::get(0xFFF0000UL) == 0xFFF0000UL);
11493 
11494  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11496 }
11497 
11498 void
11499 vmcs_ut::test_vmcs_exit_qualification_task_switch_source_of_task_switch_init()
11500 {
11501  using namespace vmcs::exit_qualification::task_switch;
11502 
11503  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11504  this->expect_true(source_of_task_switch_init::get() == source_of_task_switch_init::call_instruction);
11505  this->expect_true(source_of_task_switch_init::get(0x0UL) == source_of_task_switch_init::call_instruction);
11506 
11507  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x40000000UL;
11508  this->expect_true(source_of_task_switch_init::get() == source_of_task_switch_init::iret_instruction);
11509  this->expect_true(source_of_task_switch_init::get(0x40000000UL) == source_of_task_switch_init::iret_instruction);
11510 
11511  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x80000000UL;
11513 
11514  g_vmcs_fields[vmcs::exit_qualification::addr] = 0xC0000000UL;
11516 }
11517 
11518 void
11519 vmcs_ut::test_vmcs_exit_qualification_invept()
11520 {
11521  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11522  this->expect_true(vmcs::exit_qualification::invept::get() == 0x1UL);
11523 
11524  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11526 }
11527 
11528 void
11529 vmcs_ut::test_vmcs_exit_qualification_invpcid()
11530 {
11531  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11532  this->expect_true(vmcs::exit_qualification::invpcid::get() == 0x1UL);
11533 
11534  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11536 }
11537 
11538 void
11539 vmcs_ut::test_vmcs_exit_qualification_invvpid()
11540 {
11541  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11542  this->expect_true(vmcs::exit_qualification::invvpid::get() == 0x1UL);
11543 
11544  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11546 }
11547 
11548 void
11549 vmcs_ut::test_vmcs_exit_qualification_lgdt()
11550 {
11551  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11552  this->expect_true(vmcs::exit_qualification::lgdt::get() == 0x1UL);
11553 
11554  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11556 }
11557 
11558 void
11559 vmcs_ut::test_vmcs_exit_qualification_lidt()
11560 {
11561  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11562  this->expect_true(vmcs::exit_qualification::lidt::get() == 0x1UL);
11563 
11564  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11566 }
11567 
11568 void
11569 vmcs_ut::test_vmcs_exit_qualification_lldt()
11570 {
11571  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11572  this->expect_true(vmcs::exit_qualification::lldt::get() == 0x1UL);
11573 
11574  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11576 }
11577 
11578 void
11579 vmcs_ut::test_vmcs_exit_qualification_ltr()
11580 {
11581  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11582  this->expect_true(vmcs::exit_qualification::ltr::get() == 0x1UL);
11583 
11584  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11586 }
11587 
11588 void
11589 vmcs_ut::test_vmcs_exit_qualification_sgdt()
11590 {
11591  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11592  this->expect_true(vmcs::exit_qualification::sgdt::get() == 0x1UL);
11593 
11594  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11596 }
11597 
11598 void
11599 vmcs_ut::test_vmcs_exit_qualification_sidt()
11600 {
11601  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11602  this->expect_true(vmcs::exit_qualification::sidt::get() == 0x1UL);
11603 
11604  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11606 }
11607 
11608 void
11609 vmcs_ut::test_vmcs_exit_qualification_sldt()
11610 {
11611  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11612  this->expect_true(vmcs::exit_qualification::sldt::get() == 0x1UL);
11613 
11614  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11616 }
11617 
11618 void
11619 vmcs_ut::test_vmcs_exit_qualification_str()
11620 {
11621  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11622  this->expect_true(vmcs::exit_qualification::str::get() == 0x1UL);
11623 
11624  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11626 }
11627 
11628 void
11629 vmcs_ut::test_vmcs_exit_qualification_vmclear()
11630 {
11631  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11632  this->expect_true(vmcs::exit_qualification::vmclear::get() == 0x1UL);
11633 
11634  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11636 }
11637 
11638 void
11639 vmcs_ut::test_vmcs_exit_qualification_vmptrld()
11640 {
11641  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11642  this->expect_true(vmcs::exit_qualification::vmptrld::get() == 0x1UL);
11643 
11644  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11646 }
11647 
11648 void
11649 vmcs_ut::test_vmcs_exit_qualification_vmread()
11650 {
11651  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11652  this->expect_true(vmcs::exit_qualification::vmread::get() == 0x1UL);
11653 
11654  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11656 }
11657 
11658 void
11659 vmcs_ut::test_vmcs_exit_qualification_vmwrite()
11660 {
11661  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11662  this->expect_true(vmcs::exit_qualification::vmwrite::get() == 0x1UL);
11663 
11664  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11666 }
11667 
11668 void
11669 vmcs_ut::test_vmcs_exit_qualification_vmxon()
11670 {
11671  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11672  this->expect_true(vmcs::exit_qualification::vmxon::get() == 0x1UL);
11673 
11674  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11676 }
11677 
11678 void
11679 vmcs_ut::test_vmcs_exit_qualification_xrstors()
11680 {
11681  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11682  this->expect_true(vmcs::exit_qualification::xrstors::get() == 0x1UL);
11683 
11684  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11686 }
11687 
11688 void
11689 vmcs_ut::test_vmcs_exit_qualification_xsaves()
11690 {
11691  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11692  this->expect_true(vmcs::exit_qualification::xsaves::get() == 0x1UL);
11693 
11694  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL;
11696 }
11697 
11698 void
11699 vmcs_ut::test_vmcs_exit_qualification_control_register_access()
11700 {
11701  this->expect_true(vmcs::exit_qualification::control_register_access::get_name() == "control_register_access"_s);
11702 
11703  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x34UL;
11704  this->expect_true(vmcs::exit_qualification::control_register_access::get() == 0x34UL);
11705 
11706  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11708 }
11709 
11710 void
11711 vmcs_ut::test_vmcs_exit_qualification_control_register_access_control_register_number()
11712 {
11713  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x42UL;
11714  this->expect_true(vmcs::exit_qualification::control_register_access::control_register_number::get() == 0x2UL);
11715  this->expect_true(vmcs::exit_qualification::control_register_access::control_register_number::get(0x42UL) == 0x2UL);
11716 
11717  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11719 }
11720 
11721 void
11722 vmcs_ut::test_vmcs_exit_qualification_control_register_access_access_type()
11723 {
11724  using namespace vmcs::exit_qualification::control_register_access;
11725 
11726  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x00UL;
11727  this->expect_true(access_type::get() == access_type::mov_to_cr);
11728  this->expect_true(access_type::get(0x00UL) == access_type::mov_to_cr);
11729 
11730  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x10UL;
11731  this->expect_true(access_type::get() == access_type::mov_from_cr);
11732  this->expect_true(access_type::get(0x10UL) == access_type::mov_from_cr);
11733 
11734  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x20UL;
11736 
11737  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x30UL;
11739 }
11740 
11741 void
11742 vmcs_ut::test_vmcs_exit_qualification_control_register_access_lmsw_operand_type()
11743 {
11744  using namespace vmcs::exit_qualification::control_register_access;
11745 
11746  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x00UL;
11747  this->expect_true(lmsw_operand_type::get() == lmsw_operand_type::reg);
11748  this->expect_true(lmsw_operand_type::get(0x00UL) == lmsw_operand_type::reg);
11749 
11750  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x40UL;
11752 }
11753 
11754 void
11755 vmcs_ut::test_vmcs_exit_qualification_control_register_access_reserved()
11756 {
11757  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x3080UL;
11758  this->expect_true(vmcs::exit_qualification::control_register_access::reserved::get() == 0x3080UL);
11759  this->expect_true(vmcs::exit_qualification::control_register_access::reserved::get(0x3080UL) == 0x3080UL);
11760 
11761  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11763 }
11764 
11765 void
11766 vmcs_ut::test_vmcs_exit_qualification_control_register_access_general_purpose_register()
11767 {
11768  using namespace vmcs::exit_qualification::control_register_access;
11769 
11770  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x100UL;
11771  this->expect_true(general_purpose_register::get() == general_purpose_register::rcx);
11772  this->expect_true(general_purpose_register::get(0x100UL) == general_purpose_register::rcx);
11773 
11774  g_vmcs_fields[vmcs::exit_qualification::addr] = 0xA00UL;
11776 }
11777 
11778 void
11779 vmcs_ut::test_vmcs_exit_qualification_control_register_access_source_data()
11780 {
11781  using namespace vmcs::exit_qualification::control_register_access;
11782 
11783  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x30000UL;
11784  this->expect_true(source_data::get() == 3UL);
11785  this->expect_true(source_data::get(0x30000UL) == 3UL);
11786 
11787  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x60000UL;
11788  this->expect_true(source_data::get_if_exists() == 6UL);
11789 }
11790 
11791 void
11792 vmcs_ut::test_vmcs_exit_qualification_mov_dr()
11793 {
11795 
11796  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x34UL;
11797  this->expect_true(vmcs::exit_qualification::mov_dr::get() == 0x34UL);
11798 
11799  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11801 }
11802 
11803 void
11804 vmcs_ut::test_vmcs_exit_qualification_mov_dr_debug_register_number()
11805 {
11806  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x42UL;
11807  this->expect_true(vmcs::exit_qualification::mov_dr::debug_register_number::get() == 0x2UL);
11808  this->expect_true(vmcs::exit_qualification::mov_dr::debug_register_number::get(0x42UL) == 0x2UL);
11809 
11810  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11812 }
11813 
11814 void
11815 vmcs_ut::test_vmcs_exit_qualification_mov_dr_reserved()
11816 {
11817  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x88UL;
11818  this->expect_true(vmcs::exit_qualification::mov_dr::reserved::get() == 0x88UL);
11819  this->expect_true(vmcs::exit_qualification::mov_dr::reserved::get(0x88UL) == 0x88UL);
11820 
11821  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11823 }
11824 
11825 void
11826 vmcs_ut::test_vmcs_exit_qualification_mov_dr_direction_of_access()
11827 {
11828  using namespace vmcs::exit_qualification::mov_dr;
11829 
11830  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x00UL;
11831  this->expect_true(direction_of_access::get() == direction_of_access::to_dr);
11832  this->expect_true(direction_of_access::get(0x00UL) == direction_of_access::to_dr);
11833 
11834  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x10UL;
11836 }
11837 
11838 void
11839 vmcs_ut::test_vmcs_exit_qualification_mov_dr_general_purpose_register()
11840 {
11841  using namespace vmcs::exit_qualification::mov_dr;
11842 
11843  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x200UL;
11844  this->expect_true(general_purpose_register::get() == general_purpose_register::rdx);
11845  this->expect_true(general_purpose_register::get(0x200UL) == general_purpose_register::rdx);
11846 
11847  g_vmcs_fields[vmcs::exit_qualification::addr] = 0xB00UL;
11849 }
11850 
11851 void
11852 vmcs_ut::test_vmcs_exit_qualification_io_instruction()
11853 {
11854  this->expect_true(vmcs::exit_qualification::io_instruction::get_name() == "io_instruction"_s);
11855 
11856  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x34UL;
11857  this->expect_true(vmcs::exit_qualification::io_instruction::get() == 0x34UL);
11858 
11859  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11861 }
11862 
11863 void
11864 vmcs_ut::test_vmcs_exit_qualification_io_instruction_size_of_access()
11865 {
11867 
11868  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11869  this->expect_true(size_of_access::get() == size_of_access::one_byte);
11870 
11871  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11872  this->expect_true(size_of_access::get() == size_of_access::two_byte);
11873  this->expect_true(size_of_access::get(0x1UL) == size_of_access::two_byte);
11874 
11875  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x3UL;
11877 }
11878 
11879 void
11880 vmcs_ut::test_vmcs_exit_qualification_io_instruction_direction_of_access()
11881 {
11883 
11884  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11885  this->expect_true(direction_of_access::get() == direction_of_access::out);
11886  this->expect_true(direction_of_access::get(0x0UL) == direction_of_access::out);
11887 
11890 }
11891 
11892 void
11893 vmcs_ut::test_vmcs_exit_qualification_io_instruction_string_instruction()
11894 {
11896 
11897  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11898  this->expect_true(string_instruction::get() == string_instruction::not_string);
11899  this->expect_true(string_instruction::get(0x0UL) == string_instruction::not_string);
11900 
11901  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL << string_instruction::from;
11903 }
11904 
11905 void
11906 vmcs_ut::test_vmcs_exit_qualification_io_instruction_rep_prefixed()
11907 {
11909 
11910  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11911  this->expect_true(rep_prefixed::get() == rep_prefixed::not_rep);
11912  this->expect_true(rep_prefixed::get(0x0UL) == rep_prefixed::not_rep);
11913 
11914  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL << rep_prefixed::from;
11916 }
11917 
11918 void
11919 vmcs_ut::test_vmcs_exit_qualification_io_instruction_operand_encoding()
11920 {
11922 
11923  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11924  this->expect_true(operand_encoding::get() == operand_encoding::dx);
11925  this->expect_true(operand_encoding::get(0x0UL) == operand_encoding::dx);
11926 
11927  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL << operand_encoding::from;
11929 }
11930 
11931 void
11932 vmcs_ut::test_vmcs_exit_qualification_io_instruction_reserved()
11933 {
11935 
11936  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11937  this->expect_true(reserved::get() == 0x0UL);
11938  this->expect_true(reserved::get(0x0UL) == 0x0UL);
11939 
11940  g_vmcs_fields[vmcs::exit_qualification::addr] = 0xF80UL;
11941  this->expect_true(reserved::get_if_exists() == 0xF80UL);
11942 }
11943 
11944 void
11945 vmcs_ut::test_vmcs_exit_qualification_io_instruction_port_number()
11946 {
11948 
11949  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11950  this->expect_true(port_number::get() == 0x0UL);
11951  this->expect_true(port_number::get(0x0UL) == 0x0UL);
11952 
11953  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL << port_number::from;
11954  this->expect_true(port_number::get_if_exists() == 0x1UL);
11955 }
11956 
11957 void
11958 vmcs_ut::test_vmcs_exit_qualification_mwait()
11959 {
11960  using namespace vmcs::exit_qualification::mwait;
11961 
11962  this->expect_true(get_name() == "mwait"_s);
11963 
11964  g_vmcs_fields[vmcs::exit_qualification::addr] = 0U;
11965  this->expect_true(get() == 0U);
11966 
11967  g_vmcs_fields[vmcs::exit_qualification::addr] = 1U;
11968  this->expect_true(get_if_exists() == 1U);
11969 }
11970 
11971 void
11972 vmcs_ut::test_vmcs_exit_qualification_linear_apic_access()
11973 {
11974  using namespace vmcs::exit_qualification::linear_apic_access;
11975 
11976  this->expect_true(get_name() == "linear_apic_access"_s);
11977 
11978  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11979  this->expect_true(get() == 0x1UL);
11980 
11981  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11982  this->expect_true(get_if_exists() == 0x0UL);
11983 }
11984 
11985 void
11986 vmcs_ut::test_vmcs_exit_qualification_linear_apic_access_offset()
11987 {
11988  using namespace vmcs::exit_qualification::linear_apic_access;
11989 
11990  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
11991  this->expect_true(offset::get() == 0x1UL);
11992  this->expect_true(offset::get(0x1UL) == 0x1UL);
11993 
11994  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
11995  this->expect_true(offset::get_if_exists() == 0x0UL);
11996 }
11997 
11998 void
11999 vmcs_ut::test_vmcs_exit_qualification_linear_apic_access_access_type()
12000 {
12001  using namespace vmcs::exit_qualification::linear_apic_access;
12002 
12003  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
12004  this->expect_true(access_type::get() == access_type::read_during_instruction_execution);
12005  this->expect_true(access_type::get(0x0UL) == access_type::read_during_instruction_execution);
12006 
12007  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL << access_type::from;
12009 
12010  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x2UL << access_type::from;
12011  this->expect_true(access_type::get() == access_type::instruction_fetch);
12012  this->expect_true(access_type::get(0x2UL << access_type::from) == access_type::instruction_fetch);
12013 
12014  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x3UL << access_type::from;
12016 }
12017 
12018 void
12019 vmcs_ut::test_vmcs_exit_qualification_linear_apic_access_reserved()
12020 {
12021  using namespace vmcs::exit_qualification::linear_apic_access;
12022 
12023  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
12024  this->expect_true(reserved::get() == 0U);
12025  this->expect_true(reserved::get(0x0UL) == 0U);
12026 
12027  g_vmcs_fields[vmcs::exit_qualification::addr] = 0xF0000UL;
12028  this->expect_true(reserved::get_if_exists() == 0xF0000U);
12029 }
12030 
12031 void
12032 vmcs_ut::test_vmcs_exit_qualification_guest_physical_apic_access()
12033 {
12034  using namespace vmcs::exit_qualification::guest_physical_apic_access;
12035 
12036  this->expect_true(get_name() == "guest_physical_apic_access"_s);
12037 
12038  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
12039  this->expect_true(get() == 0x1UL);
12040 
12041  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
12042  this->expect_true(get_if_exists() == 0x0UL);
12043 }
12044 
12045 void
12046 vmcs_ut::test_vmcs_exit_qualification_guest_physical_apic_access_access_type()
12047 {
12048  using namespace vmcs::exit_qualification::guest_physical_apic_access;
12049 
12050  g_vmcs_fields[vmcs::exit_qualification::addr] = 0xFUL << access_type::from;
12051  this->expect_true(access_type::get() == access_type::instruction_fetch_or_execution);
12052  this->expect_true(access_type::get(0xFUL << access_type::from) == access_type::instruction_fetch_or_execution);
12053 
12054  g_vmcs_fields[vmcs::exit_qualification::addr] = 0xAUL << access_type::from;
12056 }
12057 
12058 void
12059 vmcs_ut::test_vmcs_exit_qualification_guest_physical_apic_access_reserved()
12060 {
12061  using namespace vmcs::exit_qualification::guest_physical_apic_access;
12062 
12063  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
12064  this->expect_true(reserved::get() == 0U);
12065  this->expect_true(reserved::get(0x0UL) == 0U);
12066 
12067  g_vmcs_fields[vmcs::exit_qualification::addr] = 0xF0000UL;
12068  this->expect_true(reserved::get_if_exists() == 0xF0000U);
12069 }
12070 
12071 void
12072 vmcs_ut::test_vmcs_exit_qualification_ept_violation()
12073 {
12074  this->expect_true(vmcs::exit_qualification::ept_violation::get_name() == "ept_violation"_s);
12075 
12076  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
12077  this->expect_true(vmcs::exit_qualification::ept_violation::get() == 1UL);
12078 
12079  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
12081 }
12082 
12083 void
12084 vmcs_ut::test_vmcs_exit_qualification_ept_violation_data_read()
12085 {
12087 
12088  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
12090  this->expect_true(data_read::is_enabled(0x1UL));
12092 
12093  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
12095  this->expect_true(data_read::is_disabled(0x0UL));
12097 }
12098 
12099 void
12100 vmcs_ut::test_vmcs_exit_qualification_ept_violation_data_write()
12101 {
12103 
12104  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL << data_write::from;
12106  this->expect_true(data_write::is_enabled(0x1UL << data_write::from));
12108 
12109  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL << data_write::from;
12111  this->expect_true(data_write::is_disabled(0x0UL << data_write::from));
12113 }
12114 
12115 void
12116 vmcs_ut::test_vmcs_exit_qualification_ept_violation_instruction_fetch()
12117 {
12119 
12120  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL << instruction_fetch::from;
12122  this->expect_true(instruction_fetch::is_enabled(0x1UL << instruction_fetch::from));
12124 
12125  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL << instruction_fetch::from;
12127  this->expect_true(instruction_fetch::is_disabled(0x0UL << instruction_fetch::from));
12129 }
12130 
12131 void
12132 vmcs_ut::test_vmcs_exit_qualification_ept_violation_readable()
12133 {
12135 
12136  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL << readable::from;
12138  this->expect_true(readable::is_enabled(0x1UL << readable::from));
12140 
12141  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL << readable::from;
12143  this->expect_true(readable::is_disabled(0x0UL << readable::from));
12145 }
12146 
12147 void
12148 vmcs_ut::test_vmcs_exit_qualification_ept_violation_writeable()
12149 {
12151 
12152  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL << writeable::from;
12154  this->expect_true(writeable::is_enabled(0x1UL << writeable::from));
12156 
12157  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL << writeable::from;
12159  this->expect_true(writeable::is_disabled(0x0UL << writeable::from));
12161 }
12162 
12163 void
12164 vmcs_ut::test_vmcs_exit_qualification_ept_violation_executable()
12165 {
12167 
12168  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL << executable::from;
12170  this->expect_true(executable::is_enabled(0x1UL << executable::from));
12172 
12173  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL << executable::from;
12175  this->expect_true(executable::is_disabled(0x0UL << executable::from));
12177 }
12178 
12179 void
12180 vmcs_ut::test_vmcs_exit_qualification_ept_violation_reserved()
12181 {
12183 
12184  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x40UL;
12185  this->expect_true(reserved::get() == 0x40UL);
12186  this->expect_true(reserved::get(0x40UL) == 0x40UL);
12187 
12188  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
12189  this->expect_true(reserved::get_if_exists() == 0UL);
12190 }
12191 
12192 void
12193 vmcs_ut::test_vmcs_exit_qualification_ept_violation_valid_guest_linear_address()
12194 {
12196 
12199  this->expect_true(valid_guest_linear_address::is_enabled(0x1UL << valid_guest_linear_address::from));
12201 
12204  this->expect_true(valid_guest_linear_address::is_disabled(0x0UL << valid_guest_linear_address::from));
12206 }
12207 
12208 void
12209 vmcs_ut::test_vmcs_exit_qualification_ept_violation_nmi_unblocking_due_to_iret()
12210 {
12212 
12215  this->expect_true(nmi_unblocking_due_to_iret::is_enabled(0x1UL << nmi_unblocking_due_to_iret::from));
12217 
12220  this->expect_true(nmi_unblocking_due_to_iret::is_disabled(0x0UL << nmi_unblocking_due_to_iret::from));
12222 }
12223 
12224 void
12225 vmcs_ut::test_vmcs_exit_qualification_eoi_virtualization()
12226 {
12227  this->expect_true(vmcs::exit_qualification::eoi_virtualization::get_name() == "eoi_virtualization"_s);
12228 
12229  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
12230  this->expect_true(vmcs::exit_qualification::eoi_virtualization::get() == 1UL);
12231 
12232  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
12234 }
12235 
12236 void
12237 vmcs_ut::test_vmcs_exit_qualification_eoi_virtualization_vector()
12238 {
12239  using namespace vmcs::exit_qualification::eoi_virtualization;
12240 
12241  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
12242  this->expect_true(vector::get() == 1UL);
12243  this->expect_true(vector::get(0x1UL) == 1UL);
12244 
12245  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
12246  this->expect_true(vector::get_if_exists() == 0UL);
12247 }
12248 
12249 void
12250 vmcs_ut::test_vmcs_exit_qualification_apic_write()
12251 {
12253 
12254  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
12255  this->expect_true(vmcs::exit_qualification::apic_write::get() == 1UL);
12256 
12257  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
12259 }
12260 
12261 void
12262 vmcs_ut::test_vmcs_exit_qualification_apic_write_offset()
12263 {
12264  using namespace vmcs::exit_qualification::apic_write;
12265 
12266  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x1UL;
12267  this->expect_true(offset::get() == 1UL);
12268  this->expect_true(offset::get(0x1UL) == 1UL);
12269 
12270  g_vmcs_fields[vmcs::exit_qualification::addr] = 0x0UL;
12271  this->expect_true(offset::get_if_exists() == 0UL);
12272 }
12273 
12274 void
12275 vmcs_ut::test_vmcs_io_rcx()
12276 {
12277  g_vmcs_fields[vmcs::io_rcx::addr] = 1U;
12278  this->expect_true(vmcs::io_rcx::get() == 1U);
12279 
12280  g_vmcs_fields[vmcs::io_rcx::addr] = 0U;
12282 }
12283 
12284 void
12285 vmcs_ut::test_vmcs_io_rsi()
12286 {
12287  g_vmcs_fields[vmcs::io_rsi::addr] = 1U;
12288  this->expect_true(vmcs::io_rsi::get() == 1U);
12289 
12290  g_vmcs_fields[vmcs::io_rsi::addr] = 0U;
12292 }
12293 
12294 void
12295 vmcs_ut::test_vmcs_io_rdi()
12296 {
12297  g_vmcs_fields[vmcs::io_rdi::addr] = 1U;
12298  this->expect_true(vmcs::io_rdi::get() == 1U);
12299 
12300  g_vmcs_fields[vmcs::io_rdi::addr] = 0U;
12302 }
12303 
12304 void
12305 vmcs_ut::test_vmcs_io_rip()
12306 {
12307  g_vmcs_fields[vmcs::io_rip::addr] = 1U;
12308  this->expect_true(vmcs::io_rip::get() == 1U);
12309 
12310  g_vmcs_fields[vmcs::io_rip::addr] = 0U;
12312 }
12313 
12314 void
12315 vmcs_ut::test_vmcs_guest_linear_address()
12316 {
12317  g_vmcs_fields[vmcs::guest_linear_address::addr] = 1U;
12318  this->expect_true(vmcs::guest_linear_address::get() == 1U);
12319 
12320  g_vmcs_fields[vmcs::guest_linear_address::addr] = 0U;
12322 }
auto set_vm_control_if_allowed(bool val, MA msr_addr, CA ctls_addr, const char *name, M mask, bool verbose, bool field_exists) noexcept
#define expect_exception(f, e)
Definition: unittest.h:162
void uint64_t uint64_t * rcx
auto get_vmcs_field_if_exists(T addr, const char *name, bool verbose, bool exists)
auto set_vm_function_control(bool val, MA msr_addr, CA ctls_addr, const char *name, M mask, bool field_exists)
virtual intel_x64::cr0::value_type cr0() const
virtual intel_x64::cr3::value_type cr3() const
#define RUN_UNITTEST_WITH_MOCKS(a, b)
Definition: unittest.h:229
virtual gdt_x64::access_rights_type ldtr_access_rights() const
virtual gdt_x64::access_rights_type gs_access_rights() const
virtual x64::segment_register::type es() const
constexpr const auto ring0_cs_descriptor
Definition: x64.h:84
bool g_vmload_fails
virtual gdt_x64::limit_type es_limit() const
bool __vmwrite(uint64_t field, uint64_t val) noexcept
virtual gdt_x64::limit_type ldtr_limit() const
virtual intel_x64::msrs::value_type ia32_gs_base_msr() const
virtual x64::segment_register::type cs() const
virtual intel_x64::msrs::value_type ia32_sysenter_esp_msr() const
void vmcs_promote(uintptr_t state_save)
virtual gdt_x64::limit_type cs_limit() const
void pin_ctl_allow1(uint64_t mask)
Definition: test.cpp:94
std::map< uint64_t, uint64_t > g_vmcs_fields
Definition: test.cpp:32
bool g_vmwrite_fails
virtual gdt_x64::limit_type gs_limit() const
#define expect_no_exception(f)
Definition: unittest.h:198
constexpr const auto mask
Definition: cpuid_x64.h:85
constexpr const auto external_interrupt
virtual gdt_x64::base_type ldtr_base() const
bool throws_exception
Definition: test.h:44
virtual x64::segment_register::type ldtr() const
constexpr const auto mask
Definition: rflags_x64.h:236
virtual gdt_x64::base_type ds_base() const
virtual intel_x64::msrs::value_type ia32_sysenter_cs_msr() const
virtual gdt_x64::limit_type ss_limit() const
constexpr const auto invalid
Definition: mem_attr_x64.h:37
void vmcs_resume(state_save_intel_x64 *state_save)
virtual gdt_x64::base_type tr_base() const
virtual x64::segment_register::type tr() const
constexpr const auto unusable
Definition: x64.h:90
virtual pointer physint_to_virtptr(integer_pointer phys) const
virtual gdt_x64::access_rights_type es_access_rights() const
virtual integer_pointer virtptr_to_physint(pointer virt) const
constexpr const auto hardware_exception
virtual x64::segment_register::type ss() const
void setup_check_control_vmx_controls_all_paths(std::vector< struct control_flow_path > &cfg)
void * physint_to_virtptr(uintptr_t phys)
Definition: test.cpp:184
auto set_vmcs_field_if_exists(V val, A addr, const char *name, bool verbose, bool exists) noexcept
virtual gdt_x64::size_type gdt_limit() const
virtual x64::segment_register::type fs() const
void enable_if_exists(bool verbose=false) noexcept
virtual gdt_x64::base_type es_base() const
constexpr const auto from
Definition: cpuid_x64.h:86
void proc_ctl2_disallow1(uint64_t mask)
Definition: test.cpp:90
constexpr const auto addr
Definition: cpuid_x64.h:80
std::map< msrs::field_type, msrs::value_type > g_msrs
virtual gdt_x64::limit_type ds_limit() const
bool __vmlaunch_demote(void) noexcept
std::map< cpuid::field_type, cpuid::value_type > g_eax_cpuid
virtual x64::segment_register::type gs() const
size_t g_new_throws_bad_alloc
Definition: new_delete.h:39
virtual gdt_x64::access_rights_type fs_access_rights() const
void disable_if_exists(bool verbose=false) noexcept
constexpr const auto write_back
Definition: x64.h:46
virtual intel_x64::msrs::value_type ia32_efer_msr() const
virtual gdt_x64::limit_type fs_limit() const
static memory_manager_x64 * instance() noexcept
virtual intel_x64::msrs::value_type ia32_perf_global_ctrl_msr() const
virtual gdt_x64::base_type cs_base() const
bool g_vmread_fails
constexpr const auto ring0_tr_descriptor
Definition: x64.h:88
constexpr const auto uncacheable_minus
Definition: x64.h:47
constexpr const auto reserved
Definition: vcpuid.h:33
bool g_vmclear_fails
auto set_vmcs_field(V val, A addr, const char *name, bool exists)
constexpr const auto ring0_gs_descriptor
Definition: x64.h:87
virtual intel_x64::cr4::value_type cr4() const
virtual idt_x64::size_type idt_limit() const
constexpr const auto write_protected
Definition: x64.h:45
virtual gdt_x64::base_type fs_base() const
void proc_ctl2_allow1(uint64_t mask)
Definition: test.cpp:82
virtual gdt_x64::limit_type tr_limit() const
auto basic_exit_reason_description_if_exists(T reason, bool verbose, bool exists)
constexpr const auto uncacheable
Definition: x64.h:42
void proc_ctl_allow1(uint64_t mask)
Definition: test.cpp:70
virtual gdt_x64::access_rights_type ds_access_rights() const
auto vm_instruction_error_description_if_exists(T error, bool verbose, bool exists)
virtual gdt_x64::access_rights_type cs_access_rights() const
virtual x64::segment_register::type ds() const
virtual intel_x64::msrs::value_type ia32_sysenter_eip_msr() const
virtual x64::dr7::value_type dr7() const
virtual gdt_x64::base_type gs_base() const
constexpr const auto name
Definition: cpuid_x64.h:81
auto get_vmcs_field(T addr, const char *name, bool exists)
void setup_check_guest_state_all_paths(std::vector< struct control_flow_path > &cfg)
#define STACK_SIZE
Definition: constants.h:225
virtual gdt_x64::base_type ss_base() const
virtual intel_x64::msrs::value_type ia32_debugctl_msr() const
#define expect_false(a)
virtual gdt_x64::access_rights_type ss_access_rights() const
constexpr const auto ring0_ss_descriptor
Definition: x64.h:85
auto set_vm_control(bool val, MA msr_addr, CA ctls_addr, const char *name, M mask, bool field_exists)
virtual idt_x64::integer_pointer idt_base() const
void set(T val) noexcept
Definition: crs_intel_x64.h:52
void vmfunc_ctl_allow1(uint64_t mask)
Definition: test.cpp:118
auto set_vm_function_control_if_allowed(bool val, MA msr_addr, CA ctls_addr, const char *name, M mask, bool verbose, bool field_exists) noexcept
Definition: cache_x64.h:31
virtual x64::rflags::value_type rflags() const
constexpr const auto write_through
Definition: x64.h:44
uintptr_t virtptr_to_physint(void *ptr)
Definition: test.cpp:173
virtual intel_x64::msrs::value_type ia32_pat_msr() const
constexpr const auto ring0_fs_descriptor
Definition: x64.h:86
virtual void dump() const
void setup_check_host_state_all_paths(std::vector< struct control_flow_path > &cfg)
bool g_virt_to_phys_return_nullptr
Definition: test.cpp:40
#define expect_true(a)
constexpr const auto write_combining
Definition: x64.h:43
virtual gdt_x64::access_rights_type tr_access_rights() const
void vmcs_launch(state_save_intel_x64 *state_save)
virtual intel_x64::msrs::value_type ia32_fs_base_msr() const
virtual gdt_x64::integer_pointer gdt_base() const
std::function< void()> setup
Definition: test.h:42