| 589 | } |
| 590 | |
| 591 | static void |
| 592 | vmx_disable(void *arg __unused) |
| 593 | { |
| 594 | struct invvpid_desc invvpid_desc = { 0 }; |
| 595 | struct invept_desc invept_desc = { 0 }; |
| 596 | |
| 597 | if (vmxon_enabled[curcpu]) { |
| 598 | /* |
| 599 | * See sections 25.3.3.3 and 25.3.3.4 in Intel Vol 3b. |
| 600 | * |
| 601 | * VMXON or VMXOFF are not required to invalidate any TLB |
| 602 | * caching structures. This prevents potential retention of |
| 603 | * cached information in the TLB between distinct VMX episodes. |
| 604 | */ |
| 605 | invvpid(INVVPID_TYPE_ALL_CONTEXTS, invvpid_desc); |
| 606 | invept(INVEPT_TYPE_ALL_CONTEXTS, invept_desc); |
| 607 | vmxoff(); |
| 608 | } |
| 609 | load_cr4(rcr4() & ~CR4_VMXE); |
| 610 | } |
| 611 | |
| 612 | static int |
| 613 | vmx_modcleanup(void) |