summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2011-04-05 10:59:44 -0700
committerRobert Mustacchi <rm@joyent.com>2011-04-05 11:03:08 -0700
commit1520843ee6c453a508532e951039a46434b4f8cb (patch)
tree5e4ec8dfc844255489346bd6064ad8e4fbc1185b /tools
parentea20e42b4a6270b3c867b3a2f02b2e08f4bc3e35 (diff)
downloadillumos-kvm-1520843ee6c453a508532e951039a46434b4f8cb.tar.gz
HVM-15 Want exit reason in D probe
Diffstat (limited to 'tools')
-rw-r--r--tools/dlib/exitno.d81
-rw-r--r--tools/whyexit.d13
2 files changed, 94 insertions, 0 deletions
diff --git a/tools/dlib/exitno.d b/tools/dlib/exitno.d
new file mode 100644
index 0000000..fe3acb8
--- /dev/null
+++ b/tools/dlib/exitno.d
@@ -0,0 +1,81 @@
+/*
+ * This D file provides translation from all of the reasons we return from the
+ * VMRUN/VMRESUME instruction. This is meant to be similar to
+ * /usr/lib/dtrace/errno.d
+ */
+
+inline int EXIT_REASON_EXCEPTION_NMI = 0;
+inline int EXIT_REASON_EXTERNAL_INTERRUPT = 1;
+inline int EXIT_REASON_TRIPLE_FAULT = 2;
+
+inline int EXIT_REASON_PENDING_INTERRUPT = 7;
+inline int EXIT_REASON_NMI_WINDOW = 8;
+inline int EXIT_REASON_TASK_SWITCH = 9;
+inline int EXIT_REASON_CPUID = 10;
+inline int EXIT_REASON_HLT = 12;
+inline int EXIT_REASON_INVLPG = 14;
+inline int EXIT_REASON_RDPMC = 15;
+inline int EXIT_REASON_RDTSC = 16;
+inline int EXIT_REASON_VMCALL = 18;
+inline int EXIT_REASON_VMCLEAR = 19;
+inline int EXIT_REASON_VMLAUNCH = 20;
+inline int EXIT_REASON_VMPTRLD = 21;
+inline int EXIT_REASON_VMPTRST = 22;
+inline int EXIT_REASON_VMREAD = 23;
+inline int EXIT_REASON_VMRESUME = 24;
+inline int EXIT_REASON_VMWRITE = 25;
+inline int EXIT_REASON_VMOFF = 26;
+inline int EXIT_REASON_VMON = 27;
+inline int EXIT_REASON_CR_ACCESS = 28;
+inline int EXIT_REASON_DR_ACCESS = 29;
+inline int EXIT_REASON_IO_INSTRUCTION = 30;
+inline int EXIT_REASON_MSR_READ = 31;
+inline int EXIT_REASON_MSR_WRITE = 32;
+inline int EXIT_REASON_MWAIT_INSTRUCTION = 36;
+inline int EXIT_REASON_MONITOR_INSTRUCTION = 39;
+inline int EXIT_REASON_PAUSE_INSTRUCTION = 40;
+inline int EXIT_REASON_MCE_DURING_VMENTRY = 41;
+inline int EXIT_REASON_TPR_BELOW_THRESHOLD = 43;
+inline int EXIT_REASON_APIC_ACCESS = 44;
+inline int EXIT_REASON_EPT_VIOLATION = 48;
+inline int EXIT_REASON_EPT_MISCONFIG = 49;
+inline int EXIT_REASON_WBINVD = 54;
+
+
+inline string strexitno[int32_t r] =
+ r == EXIT_REASON_EXCEPTION_NMI ? "EXIT_REASON_EXCEPTION_NMI" :
+ r == EXIT_REASON_EXTERNAL_INTERRUPT ? "EXIT_REASON_EXTERNAL_INTERRUPT" :
+ r == EXIT_REASON_TRIPLE_FAULT ? "EXIT_REASON_TRIPLE_FAULT" :
+ r == EXIT_REASON_PENDING_INTERRUPT ? "EXIT_REASON_PENDING_INTERRUPT" :
+ r == EXIT_REASON_NMI_WINDOW ? "EXIT_REASON_NMI_WINDOW" :
+ r == EXIT_REASON_TASK_SWITCH ? "EXIT_REASON_TASK_SWITCH" :
+ r == EXIT_REASON_CPUID ? "EXIT_REASON_CPUID" :
+ r == EXIT_REASON_HLT ? "EXIT_REASON_HLT" :
+ r == EXIT_REASON_INVLPG ? "EXIT_REASON_INVLPG" :
+ r == EXIT_REASON_RDPMC ? "EXIT_REASON_RDPMC" :
+ r == EXIT_REASON_RDTSC ? "EXIT_REASON_RDTSC" :
+ r == EXIT_REASON_VMCALL ? "EXIT_REASON_VMCALL" :
+ r == EXIT_REASON_VMCLEAR ? "EXIT_REASON_VMCLEAR" :
+ r == EXIT_REASON_VMLAUNCH ? "EXIT_REASON_VMLAUNCH" :
+ r == EXIT_REASON_VMPTRLD ? "EXIT_REASON_VMPTRLD" :
+ r == EXIT_REASON_VMPTRST ? "EXIT_REASON_VMPTRST" :
+ r == EXIT_REASON_VMREAD ? "EXIT_REASON_VMREAD" :
+ r == EXIT_REASON_VMRESUME ? "EXIT_REASON_VMRESUME" :
+ r == EXIT_REASON_VMWRITE ? "EXIT_REASON_VMWRITE" :
+ r == EXIT_REASON_VMOFF ? "EXIT_REASON_VMOFF" :
+ r == EXIT_REASON_VMON ? "EXIT_REASON_VMON" :
+ r == EXIT_REASON_CR_ACCESS ? "EXIT_REASON_CR_ACCESS" :
+ r == EXIT_REASON_DR_ACCESS ? "EXIT_REASON_DR_ACCESS" :
+ r == EXIT_REASON_IO_INSTRUCTION ? "EXIT_REASON_IO_INSTRUCTION" :
+ r == EXIT_REASON_MSR_READ ? "EXIT_REASON_MSR_READ" :
+ r == EXIT_REASON_MSR_WRITE ? "EXIT_REASON_MSR_WRITE" :
+ r == EXIT_REASON_MWAIT_INSTRUCTION ? "EXIT_REASON_MWAIT_INSTRUCTION" :
+ r == EXIT_REASON_MONITOR_INSTRUCTION ? "EXIT_REASON_MONITOR_INSTRUCTION" :
+ r == EXIT_REASON_PAUSE_INSTRUCTION ? "EXIT_REASON_PAUSE_INSTRUCTION" :
+ r == EXIT_REASON_MCE_DURING_VMENTRY ? "EXIT_REASON_MCE_DURING_VMENTRY" :
+ r == EXIT_REASON_TPR_BELOW_THRESHOLD ? "EXIT_REASON_TPR_BELOW_THRESHOLD" :
+ r == EXIT_REASON_APIC_ACCESS ? "EXIT_REASON_APIC_ACCESS" :
+ r == EXIT_REASON_EPT_VIOLATION ? "EXIT_REASON_EPT_VIOLATION" :
+ r == EXIT_REASON_EPT_MISCONFIG ? "EXIT_REASON_EPT_MISCONFIG" :
+ r == EXIT_REASON_WBINVD ? "EXIT_REASON_WBINVD" :
+ "<unknown>";
diff --git a/tools/whyexit.d b/tools/whyexit.d
new file mode 100644
index 0000000..fef4dff
--- /dev/null
+++ b/tools/whyexit.d
@@ -0,0 +1,13 @@
+#!/usr/sbin/dtrace -Zs
+
+#pragma D option quiet
+
+/*
+ * This checks for why we've exited based on using the library file for exit
+ * errnos: exitno.d
+ */
+
+kvm-vexit
+{
+ printf("Exited: %s\n", strexitno[arg1]);
+}