Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Refactoring and additions to direct paging (nested and passthrough)
[palacios.git] / palacios / src / palacios / vmx_handler.c
index 2bcc394..f8a183e 100644 (file)
 #include <palacios/vmcs.h>
 #include <palacios/vmx_lowlevel.h>
 #include <palacios/vmx_io.h>
+#include <palacios/vmm_cpuid.h>
+#include <palacios/vmm_debug.h>
 
+#include <palacios/vmx.h>
+#include <palacios/vmm_ctrl_regs.h>
+#include <palacios/vmm_lowlevel.h>
+#include <palacios/vmx_ctrl_regs.h>
+#include <palacios/vmx_assist.h>
+#include <palacios/vmm_halt.h>
+#include <palacios/vmm_mwait.h>
+#include <palacios/vmx_ept.h>
 
-static int inline check_vmcs_write(vmcs_field_t field, addr_t val)
-{
-    int ret = 0;
-    ret = vmcs_write(field,val);
 
-    if (ret != VMX_SUCCESS) {
-        PrintError("VMWRITE error on %s!: %d\n", v3_vmcs_field_to_str(field), ret);
-        return 1;
+#ifndef V3_CONFIG_DEBUG_VMX
+#undef PrintDebug
+#define PrintDebug(fmt, args...)
+#endif
+
+#ifdef V3_CONFIG_TELEMETRY
+#include <palacios/vmm_telemetry.h>
+#endif
+
+/* At this point the GPRs are already copied into the guest_info state */
+int v3_handle_vmx_exit(struct guest_info * info, struct vmx_exit_info * exit_info) {
+    struct vmx_basic_exit_info * basic_info = (struct vmx_basic_exit_info *)&(exit_info->exit_reason);
+
+    /*
+      PrintError(info->vm_info, info, "Handling VMX_EXIT: %s (%u), %lu (0x%lx)\n", 
+      v3_vmx_exit_code_to_str(exit_info->exit_reason),
+      exit_info->exit_reason, 
+      exit_info->exit_qual, exit_info->exit_qual);
+      
+      v3_print_vmcs();
+    */
+
+
+    if (basic_info->entry_error == 1) {
+       switch (basic_info->reason) {
+           case VMX_EXIT_INVALID_GUEST_STATE:
+               PrintError(info->vm_info, info, "VM Entry failed due to invalid guest state\n");
+               PrintError(info->vm_info, info, "Printing VMCS: (NOTE: This VMCS may not belong to the correct guest)\n");
+               v3_print_vmcs();
+               break;
+           case VMX_EXIT_INVALID_MSR_LOAD:
+               PrintError(info->vm_info, info, "VM Entry failed due to error loading MSRs\n");
+               break;
+           default:
+               PrintError(info->vm_info, info, "Entry failed for unknown reason (%d)\n", basic_info->reason);
+               break;
+       }
+       
+       return -1;
     }
 
-    return 0;
-}
 
-static int inline check_vmcs_read(vmcs_field_t field, void * val)
-{
-    int ret = 0;
-    ret = vmcs_read(field,val);
 
-    if(ret != VMX_SUCCESS) {
-        PrintError("VMREAD error on %s!: %d\n", v3_vmcs_field_to_str(field), ret);
-        return ret;
+#ifdef V3_CONFIG_TELEMETRY
+    if (info->vm_info->enable_telemetry) {
+       v3_telemetry_start_exit(info);
     }
+#endif
 
-    return 0;
-}
+    switch (basic_info->reason) {
+        case VMX_EXIT_INFO_EXCEPTION_OR_NMI: {
+            pf_error_t error_code = *(pf_error_t *)&(exit_info->int_err);
 
-int v3_handle_vmx_exit(struct v3_gprs * gprs, struct guest_info * info)
-{
-    uint32_t exit_reason;
-    ulong_t exit_qual;
-
-    check_vmcs_read(VMCS_EXIT_REASON, &exit_reason);
-    check_vmcs_read(VMCS_EXIT_QUAL, &exit_qual);
-
-    PrintDebug("VMX Exit taken, id-qual: %d-%ld\n", exit_reason, exit_qual);
-
-    /* Update guest state */
-    check_vmcs_read(VMCS_GUEST_RIP, &(info->rip));
-    check_vmcs_read(VMCS_GUEST_RSP, &(info->vm_regs.rsp));
-    check_vmcs_read(VMCS_GUEST_CR0, &(info->ctrl_regs.cr0));
-    check_vmcs_read(VMCS_GUEST_CR3, &(info->ctrl_regs.cr3));
-    check_vmcs_read(VMCS_GUEST_CR4, &(info->ctrl_regs.cr4));
-
-    // read out segments
-
-    switch(exit_reason)
-    {
-        case VMEXIT_INFO_EXCEPTION_OR_NMI:
-        {
-            uint32_t int_info;
-            pf_error_t error_code;
-            check_vmcs_read(VMCS_EXIT_INT_INFO, &int_info);
-            check_vmcs_read(VMCS_EXIT_INT_ERR, &error_code);
-
-            if((uint8_t)int_info == 0x0e) {
-                PrintDebug("Page Fault at %p\n", (void*)exit_qual);
-                if(info->shdw_pg_mode == SHADOW_PAGING) {
-                    if(v3_handle_shadow_pagefault(info, (addr_t)exit_qual, error_code) == -1) {
+
+            // JRL: Change "0x0e" to a macro value
+            if ((uint8_t)exit_info->int_info == 14) {
+#ifdef V3_CONFIG_DEBUG_SHADOW_PAGING
+                PrintDebug(info->vm_info, info, "Page Fault at %p error_code=%x\n", (void *)exit_info->exit_qual, *(uint32_t *)&error_code);
+#endif
+
+                if (info->shdw_pg_mode == SHADOW_PAGING) {
+                    if (v3_handle_shadow_pagefault(info, (addr_t)exit_info->exit_qual, error_code) == -1) {
+                        PrintError(info->vm_info, info, "Error handling shadow page fault\n");
                         return -1;
                     }
+           
                 } else {
-                    PrintError("Page fault in unimplemented paging mode\n");
+                    PrintError(info->vm_info, info, "Page fault in unimplemented paging mode\n");
                     return -1;
                 }
+           } else if ((uint8_t)exit_info->int_info == 2) {
+               // NMI. Don't do anything
+            } else {
+                PrintError(info->vm_info, info, "Unknown exception: 0x%x\n", (uint8_t)exit_info->int_info);
+                v3_print_GPRs(info);
+                return -1;
             }
             break;
         }
 
-        case VMEXIT_IO_INSTR: 
-        {
-            struct vmcs_io_qual * io_qual = (struct vmcs_io_qual *)&exit_qual;
+       case VMX_EXIT_EPT_VIOLATION: {
+           struct ept_exit_qual * ept_qual = (struct ept_exit_qual *)&(exit_info->exit_qual);
+
+           if (v3_handle_nested_pagefault(info, exit_info->ept_fault_addr, ept_qual,NULL,NULL) == -1) {
+               PrintError(info->vm_info, info, "Error handling EPT fault\n");
+               return -1;
+           }
+
+           break;
+       }
+        case VMX_EXIT_INVLPG:
+            if (info->shdw_pg_mode == SHADOW_PAGING) {
+                if (v3_handle_shadow_invlpg(info) == -1) {
+                   PrintError(info->vm_info, info, "Error handling INVLPG\n");
+                    return -1;
+                }
+            }
+
+            break;
+
+        case VMX_EXIT_RDTSC:
+#ifdef V3_CONFIG_DEBUG_TIME
+           PrintDebug(info->vm_info, info, "RDTSC\n");
+#endif 
+           if (v3_handle_rdtsc(info) == -1) {
+               PrintError(info->vm_info, info, "Error Handling RDTSC instruction\n");
+               return -1;
+           }
+           
+           break;
+
+        case VMX_EXIT_CPUID:
+           if (v3_handle_cpuid(info) == -1) {
+               PrintError(info->vm_info, info, "Error Handling CPUID instruction\n");
+               return -1;
+           }
+
+            break;
+        case VMX_EXIT_RDMSR: 
+            if (v3_handle_msr_read(info) == -1) {
+               PrintError(info->vm_info, info, "Error handling MSR Read\n");
+                return -1;
+           }
+
+            break;
+        case VMX_EXIT_WRMSR:
+            if (v3_handle_msr_write(info) == -1) {
+               PrintError(info->vm_info, info, "Error handling MSR Write\n");
+                return -1;
+           }
+
+            break;
+       case VMX_EXIT_VMCALL:
+           /* 
+            * Hypercall 
+            */
+
+           // VMCALL is a 3 byte op
+           // We do this early because some hypercalls can change the rip...
+           info->rip += 3;         
 
-            if(io_qual->dir == 0) {
-                if(io_qual->string) {
-                    if(v3_handle_vmx_io_outs(info) == -1) {
+           if (v3_handle_hypercall(info) == -1) {
+               return -1;
+           }
+           break;
+        case VMX_EXIT_IO_INSTR: {
+           struct vmx_exit_io_qual * io_qual = (struct vmx_exit_io_qual *)&(exit_info->exit_qual);
+
+            if (io_qual->dir == 0) {
+                if (io_qual->string) {
+                    if (v3_handle_vmx_io_outs(info, exit_info) == -1) {
+                        PrintError(info->vm_info, info, "Error in outs IO handler\n");
                         return -1;
                     }
                 } else {
-                    if(v3_handle_vmx_io_out(info) == -1) {
+                    if (v3_handle_vmx_io_out(info, exit_info) == -1) {
+                        PrintError(info->vm_info, info, "Error in out IO handler\n");
                         return -1;
                     }
                 }
             } else {
-                if(io_qual->string) {
-                    if(v3_handle_vmx_io_ins(info) == -1) {
+                if (io_qual->string) {
+                    if(v3_handle_vmx_io_ins(info, exit_info) == -1) {
+                        PrintError(info->vm_info, info, "Error in ins IO handler\n");
                         return -1;
                     }
                 } else {
-                    if(v3_handle_vmx_io_in(info) == -1) {
+                    if (v3_handle_vmx_io_in(info, exit_info) == -1) {
+                        PrintError(info->vm_info, info, "Error in in IO handler\n");
                         return -1;
                     }
                 }
             }
             break;
-        }
+       }
+        case VMX_EXIT_CR_REG_ACCESSES: {
+           struct vmx_exit_cr_qual * cr_qual = (struct vmx_exit_cr_qual *)&(exit_info->exit_qual);
+           
+           // PrintDebug(info->vm_info, info, "Control register: %d\n", cr_qual->access_type);
+           switch(cr_qual->cr_id) {
+               case 0:
+                   //PrintDebug(info->vm_info, info, "Handling CR0 Access\n");
+                   if (v3_vmx_handle_cr0_access(info, cr_qual, exit_info) == -1) {
+                       PrintError(info->vm_info, info, "Error in CR0 access handler\n");
+                       return -1;
+                   }
+                   break;
+               case 3:
+                   //PrintDebug(info->vm_info, info, "Handling CR3 Access\n");
+                   if (v3_vmx_handle_cr3_access(info, cr_qual) == -1) {
+                       PrintError(info->vm_info, info, "Error in CR3 access handler\n");
+                       return -1;
+                   }
+                   break;
+               case 4:
+                   //PrintDebug(info->vm_info, info, "Handling CR4 Access\n");
+                   if (v3_vmx_handle_cr4_access(info, cr_qual) == -1) {
+                       PrintError(info->vm_info, info, "Error in CR4 access handler\n");
+                       return -1;
+                   }
+                   break;
+               case 8:
+                   if (v3_vmx_handle_cr8_access(info, cr_qual) == -1) {
+                       PrintError(info->vm_info, info, "Error in CR8 access handler\n");
+                       return -1;
+                   }
+                   break;
+               default:
+                   PrintError(info->vm_info, info, "Unhandled CR access: %d\n", cr_qual->cr_id);
+                   return -1;
+           }
+           
+           // TODO: move RIP increment into all of the above individual CR
+           //       handlers, not just v3_vmx_handle_cr4_access()
+           if (cr_qual->cr_id != 4)
+               info->rip += exit_info->instr_len;
+
+           break;
+       }
+        case VMX_EXIT_HLT:
+            PrintDebug(info->vm_info, info, "Guest halted\n");
+
+            if (v3_handle_halt(info) == -1) {
+               PrintError(info->vm_info, info, "Error handling halt instruction\n");
+                return -1;
+            }
+
+            break;
+
+        case VMX_EXIT_MONITOR:
+            PrintDebug(info->vm_info, info, "Guest Executing monitor\n");
 
+            if (v3_handle_monitor(info) == -1) {
+               PrintError(info->vm_info, info, "Error handling monitor instruction\n");
+                return -1;
+            }
+
+            break;
+
+        case VMX_EXIT_MWAIT:
+            PrintDebug(info->vm_info, info, "Guest Executing mwait\n");
+
+            if (v3_handle_mwait(info) == -1) {
+               PrintError(info->vm_info, info, "Error handling mwait instruction\n");
+                return -1;
+            }
+
+            break;
+
+
+        case VMX_EXIT_PAUSE:
+            // Handled as NOP
+            info->rip += 2;
+
+            break;
+        case VMX_EXIT_EXTERNAL_INTR:
+            // Interrupts are handled outside switch
+            break;
+        case VMX_EXIT_INTR_WINDOW:
+           // This is handled in the atomic part of the vmx code,
+           // not in the generic (interruptable) vmx handler
+            break;
+        case VMX_EXIT_EXPIRED_PREEMPT_TIMER:
+           V3_Print(info->vm_info, info, "VMX Preempt Timer Expired.\n");
+           // This just forces an exit and is handled outside the switch
+           break;
+           
         default:
-            PrintError("Unhandled VMEXIT\n");
+            PrintError(info->vm_info, info, "Unhandled VMX_EXIT: %s (%u), %lu (0x%lx)\n", 
+                      v3_vmx_exit_code_to_str(basic_info->reason),
+                      basic_info->reason, 
+                      exit_info->exit_qual, exit_info->exit_qual);
             return -1;
     }
 
-    check_vmcs_write(VMCS_GUEST_CR0, info->ctrl_regs.cr0);
-    check_vmcs_write(VMCS_GUEST_CR3, info->ctrl_regs.cr3);
-    check_vmcs_write(VMCS_GUEST_CR4, info->ctrl_regs.cr4);
-    check_vmcs_write(VMCS_GUEST_RIP, info->rip);
-    check_vmcs_write(VMCS_GUEST_RSP, info->vm_regs.rsp);
 
-    PrintDebug("Executing VMRESUME\n");
+#ifdef V3_CONFIG_TELEMETRY
+    if (info->vm_info->enable_telemetry) {
+        v3_telemetry_end_exit(info, exit_info->exit_reason);
+    }
+#endif
+
+
     return 0;
 }
+
+static const char VMX_EXIT_INFO_EXCEPTION_OR_NMI_STR[] = "VMX_EXIT_INFO_EXCEPTION_OR_NMI";
+static const char VMX_EXIT_EXTERNAL_INTR_STR[] = "VMX_EXIT_EXTERNAL_INTR";
+static const char VMX_EXIT_TRIPLE_FAULT_STR[] = "VMX_EXIT_TRIPLE_FAULT";
+static const char VMX_EXIT_INIT_SIGNAL_STR[] = "VMX_EXIT_INIT_SIGNAL";
+static const char VMX_EXIT_STARTUP_IPI_STR[] = "VMX_EXIT_STARTUP_IPI";
+static const char VMX_EXIT_IO_SMI_STR[] = "VMX_EXIT_IO_SMI";
+static const char VMX_EXIT_OTHER_SMI_STR[] = "VMX_EXIT_OTHER_SMI";
+static const char VMX_EXIT_INTR_WINDOW_STR[] = "VMX_EXIT_INTR_WINDOW";
+static const char VMX_EXIT_NMI_WINDOW_STR[] = "VMX_EXIT_NMI_WINDOW";
+static const char VMX_EXIT_TASK_SWITCH_STR[] = "VMX_EXIT_TASK_SWITCH";
+static const char VMX_EXIT_CPUID_STR[] = "VMX_EXIT_CPUID";
+static const char VMX_EXIT_HLT_STR[] = "VMX_EXIT_HLT";
+static const char VMX_EXIT_INVD_STR[] = "VMX_EXIT_INVD";
+static const char VMX_EXIT_INVLPG_STR[] = "VMX_EXIT_INVLPG";
+static const char VMX_EXIT_RDPMC_STR[] = "VMX_EXIT_RDPMC";
+static const char VMX_EXIT_RDTSC_STR[] = "VMX_EXIT_RDTSC";
+static const char VMX_EXIT_RSM_STR[] = "VMX_EXIT_RSM";
+static const char VMX_EXIT_VMCALL_STR[] = "VMX_EXIT_VMCALL";
+static const char VMX_EXIT_VMCLEAR_STR[] = "VMX_EXIT_VMCLEAR";
+static const char VMX_EXIT_VMLAUNCH_STR[] = "VMX_EXIT_VMLAUNCH";
+static const char VMX_EXIT_VMPTRLD_STR[] = "VMX_EXIT_VMPTRLD";
+static const char VMX_EXIT_VMPTRST_STR[] = "VMX_EXIT_VMPTRST";
+static const char VMX_EXIT_VMREAD_STR[] = "VMX_EXIT_VMREAD";
+static const char VMX_EXIT_VMRESUME_STR[] = "VMX_EXIT_VMRESUME";
+static const char VMX_EXIT_VMWRITE_STR[] = "VMX_EXIT_VMWRITE";
+static const char VMX_EXIT_VMXOFF_STR[] = "VMX_EXIT_VMXOFF";
+static const char VMX_EXIT_VMXON_STR[] = "VMX_EXIT_VMXON";
+static const char VMX_EXIT_CR_REG_ACCESSES_STR[] = "VMX_EXIT_CR_REG_ACCESSES";
+static const char VMX_EXIT_MOV_DR_STR[] = "VMX_EXIT_MOV_DR";
+static const char VMX_EXIT_IO_INSTR_STR[] = "VMX_EXIT_IO_INSTR";
+static const char VMX_EXIT_RDMSR_STR[] = "VMX_EXIT_RDMSR";
+static const char VMX_EXIT_WRMSR_STR[] = "VMX_EXIT_WRMSR";
+static const char VMX_EXIT_INVALID_GUEST_STATE_STR[] = "VMX_EXIT_INVALID_GUEST_STATE";
+static const char VMX_EXIT_INVALID_MSR_LOAD_STR[] = "VMX_EXIT_INVALID_MSR_LOAD";
+static const char VMX_EXIT_MWAIT_STR[] = "VMX_EXIT_MWAIT";
+static const char VMX_EXIT_MONITOR_STR[] = "VMX_EXIT_MONITOR";
+static const char VMX_EXIT_PAUSE_STR[] = "VMX_EXIT_PAUSE";
+static const char VMX_EXIT_INVALID_MACHINE_CHECK_STR[] = "VMX_EXIT_INVALIDE_MACHINE_CHECK";
+static const char VMX_EXIT_TPR_BELOW_THRESHOLD_STR[] = "VMX_EXIT_TPR_BELOW_THRESHOLD";
+static const char VMX_EXIT_APIC_STR[] = "VMX_EXIT_APIC";
+static const char VMX_EXIT_GDTR_IDTR_STR[] = "VMX_EXIT_GDTR_IDTR";
+static const char VMX_EXIT_LDTR_TR_STR[] = "VMX_EXIT_LDTR_TR";
+static const char VMX_EXIT_EPT_VIOLATION_STR[] = "VMX_EXIT_EPT_VIOLATION";
+static const char VMX_EXIT_EPT_CONFIG_STR[] = "VMX_EXIT_EPT_CONFIG";
+static const char VMX_EXIT_INVEPT_STR[] = "VMX_EXIT_INVEPT";
+static const char VMX_EXIT_RDTSCP_STR[] = "VMX_EXIT_RDTSCP";
+static const char VMX_EXIT_EXPIRED_PREEMPT_TIMER_STR[] = "VMX_EXIT_EXPIRED_PREEMPT_TIMER";
+static const char VMX_EXIT_INVVPID_STR[] = "VMX_EXIT_INVVPID";
+static const char VMX_EXIT_WBINVD_STR[] = "VMX_EXIT_WBINVD";
+static const char VMX_EXIT_XSETBV_STR[] = "VMX_EXIT_XSETBV";
+
+const char * v3_vmx_exit_code_to_str(vmx_exit_t exit)
+{
+    switch (exit) {
+        case VMX_EXIT_INFO_EXCEPTION_OR_NMI:
+            return VMX_EXIT_INFO_EXCEPTION_OR_NMI_STR;
+        case VMX_EXIT_EXTERNAL_INTR:
+            return VMX_EXIT_EXTERNAL_INTR_STR;
+        case VMX_EXIT_TRIPLE_FAULT:
+            return VMX_EXIT_TRIPLE_FAULT_STR;
+        case VMX_EXIT_INIT_SIGNAL:
+            return VMX_EXIT_INIT_SIGNAL_STR;
+        case VMX_EXIT_STARTUP_IPI:
+            return VMX_EXIT_STARTUP_IPI_STR;
+        case VMX_EXIT_IO_SMI:
+            return VMX_EXIT_IO_SMI_STR;
+        case VMX_EXIT_OTHER_SMI:
+            return VMX_EXIT_OTHER_SMI_STR;
+        case VMX_EXIT_INTR_WINDOW:
+            return VMX_EXIT_INTR_WINDOW_STR;
+        case VMX_EXIT_NMI_WINDOW:
+            return VMX_EXIT_NMI_WINDOW_STR;
+        case VMX_EXIT_TASK_SWITCH:
+            return VMX_EXIT_TASK_SWITCH_STR;
+        case VMX_EXIT_CPUID:
+            return VMX_EXIT_CPUID_STR;
+        case VMX_EXIT_HLT:
+            return VMX_EXIT_HLT_STR;
+        case VMX_EXIT_INVD:
+            return VMX_EXIT_INVD_STR;
+        case VMX_EXIT_INVLPG:
+            return VMX_EXIT_INVLPG_STR;
+        case VMX_EXIT_RDPMC:
+            return VMX_EXIT_RDPMC_STR;
+        case VMX_EXIT_RDTSC:
+            return VMX_EXIT_RDTSC_STR;
+        case VMX_EXIT_RSM:
+            return VMX_EXIT_RSM_STR;
+        case VMX_EXIT_VMCALL:
+            return VMX_EXIT_VMCALL_STR;
+        case VMX_EXIT_VMCLEAR:
+            return VMX_EXIT_VMCLEAR_STR;
+        case VMX_EXIT_VMLAUNCH:
+            return VMX_EXIT_VMLAUNCH_STR;
+        case VMX_EXIT_VMPTRLD:
+            return VMX_EXIT_VMPTRLD_STR;
+        case VMX_EXIT_VMPTRST:
+            return VMX_EXIT_VMPTRST_STR;
+        case VMX_EXIT_VMREAD:
+            return VMX_EXIT_VMREAD_STR;
+        case VMX_EXIT_VMRESUME:
+            return VMX_EXIT_VMRESUME_STR;
+        case VMX_EXIT_VMWRITE:
+            return VMX_EXIT_VMWRITE_STR;
+        case VMX_EXIT_VMXOFF:
+            return VMX_EXIT_VMXOFF_STR;
+        case VMX_EXIT_VMXON:
+            return VMX_EXIT_VMXON_STR;
+        case VMX_EXIT_CR_REG_ACCESSES:
+            return VMX_EXIT_CR_REG_ACCESSES_STR;
+        case VMX_EXIT_MOV_DR:
+            return VMX_EXIT_MOV_DR_STR;
+        case VMX_EXIT_IO_INSTR:
+            return VMX_EXIT_IO_INSTR_STR;
+        case VMX_EXIT_RDMSR:
+            return VMX_EXIT_RDMSR_STR;
+        case VMX_EXIT_WRMSR:
+            return VMX_EXIT_WRMSR_STR;
+        case VMX_EXIT_INVALID_GUEST_STATE:
+            return VMX_EXIT_INVALID_GUEST_STATE_STR;
+        case VMX_EXIT_INVALID_MSR_LOAD:
+            return VMX_EXIT_INVALID_MSR_LOAD_STR;
+        case VMX_EXIT_MWAIT:
+            return VMX_EXIT_MWAIT_STR;
+        case VMX_EXIT_MONITOR:
+            return VMX_EXIT_MONITOR_STR;
+        case VMX_EXIT_PAUSE:
+            return VMX_EXIT_PAUSE_STR;
+        case VMX_EXIT_INVALID_MACHINE_CHECK:
+            return VMX_EXIT_INVALID_MACHINE_CHECK_STR;
+        case VMX_EXIT_TPR_BELOW_THRESHOLD:
+            return VMX_EXIT_TPR_BELOW_THRESHOLD_STR;
+        case VMX_EXIT_APIC:
+            return VMX_EXIT_APIC_STR;
+        case VMX_EXIT_GDTR_IDTR:
+            return VMX_EXIT_GDTR_IDTR_STR;
+        case VMX_EXIT_LDTR_TR:
+            return VMX_EXIT_LDTR_TR_STR;
+        case VMX_EXIT_EPT_VIOLATION:
+            return VMX_EXIT_EPT_VIOLATION_STR;
+        case VMX_EXIT_EPT_CONFIG:
+            return VMX_EXIT_EPT_CONFIG_STR;
+        case VMX_EXIT_INVEPT:
+            return VMX_EXIT_INVEPT_STR;
+        case VMX_EXIT_RDTSCP:
+            return VMX_EXIT_RDTSCP_STR;
+        case VMX_EXIT_EXPIRED_PREEMPT_TIMER:
+            return VMX_EXIT_EXPIRED_PREEMPT_TIMER_STR;
+        case VMX_EXIT_INVVPID:
+            return VMX_EXIT_INVVPID_STR;
+        case VMX_EXIT_WBINVD:
+            return VMX_EXIT_WBINVD_STR;
+        case VMX_EXIT_XSETBV:
+            return VMX_EXIT_XSETBV_STR;
+    }
+    return NULL;
+}
+