Skip to contentSkip to conversation

x86/nVMX: Test L1 interception of #BP and #OF in the L2 guest

PATCH New Jim Mattson 1 participant 1 message Dec 14, 2016 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/nVMX: Test L1 interception of #BP and #OF in the L2 guest

Int3 (#BP) and INTO (#OF) are unusual, in that they are reported as "software exception" rather than "hardware exception" in the VM-exit interruption information field of the VMCS.

---
 lib/x86/processor.h |  5 ++++
 x86/vmx.h           | 19 ++++++++++++++
 x86/vmx_tests.c     | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 100 insertions(+)
lib/x86/processor.h +5 -0
index ee7f180..895d992 100644
@@ -41,6 +41,11 @@
 #define X86_IA32_EFER          0xc0000080
 #define X86_EFER_LMA           (1UL << 8)
 
+struct far_pointer32 {
+	u32 offset;
+	u16 selector;
+} __attribute__((packed));
+
 struct descriptor_table_ptr {
     u16 limit;
     ulong base;
x86/vmx.h +19 -0
index 432ffa6..a2bacd3 100644
@@ -377,6 +377,25 @@ enum Ctrl1 {
 	CPU_RDRAND		= 1ul << 11,
 };
 
+enum Intr_type {
+	VMX_INTR_TYPE_EXT_INTR = 0,
+	VMX_INTR_TYPE_NMI_INTR = 2,
+	VMX_INTR_TYPE_HARD_EXCEPTION = 3,
+	VMX_INTR_TYPE_SOFT_INTR = 4,
+	VMX_INTR_TYPE_SOFT_EXCEPTION = 6,
+};
+
+/*
+ * Interruption-information format
+ */
+#define INTR_INFO_VECTOR_MASK           0xff            /* 7:0 */
+#define INTR_INFO_INTR_TYPE_MASK        0x700           /* 10:8 */
+#define INTR_INFO_DELIVER_CODE_MASK     0x800           /* 11 */
+#define INTR_INFO_UNBLOCK_NMI_MASK      0x1000          /* 12 */
+#define INTR_INFO_VALID_MASK            0x80000000      /* 31 */
+
+#define INTR_INFO_INTR_TYPE_SHIFT       8
+
 #define SAVE_GPR				\
 	"xchg %rax, regs\n\t"			\
 	"xchg %rbx, regs+0x8\n\t"		\
x86/vmx_tests.c +76 -0

87 lines not on this page · raw message

Signature · 1 line
2.8.0.rc3.226.g39d4020