From 6e128c6f3d76868627eb5132463f31dc51b54b26 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 25 Apr 2008 13:38:22 +0100 Subject: [PATCH] Intel VPID: Do not crash if INVVPID is attempted before VMXON. Signed-off-by: Keir Fraser --- xen/include/asm-x86/hvm/vmx/vmx.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/xen/include/asm-x86/hvm/vmx/vmx.h b/xen/include/asm-x86/hvm/vmx/vmx.h index c94549caec..58834e7f7d 100644 --- a/xen/include/asm-x86/hvm/vmx/vmx.h +++ b/xen/include/asm-x86/hvm/vmx/vmx.h @@ -263,7 +263,7 @@ static inline void __invept(int ext, u64 eptp, u64 gpa) asm volatile ( INVEPT_OPCODE MODRM_EAX_08 - /* CF==1 or ZF==1 --> rc = -1 */ + /* CF==1 or ZF==1 --> crash (ud2) */ "ja 1f ; ud2 ; 1:\n" : : "a" (&operand), "c" (ext) @@ -278,10 +278,14 @@ static inline void __invvpid(int ext, u16 vpid, u64 gva) u64 gva; } __attribute__ ((packed)) operand = {vpid, 0, gva}; - asm volatile ( INVVPID_OPCODE - MODRM_EAX_08 - /* CF==1 or ZF==1 --> rc = -1 */ - "ja 1f ; ud2 ; 1:\n" + /* Fix up #UD exceptions which occur when TLBs are flushed before VMXON. */ + asm volatile ( "1: " INVVPID_OPCODE MODRM_EAX_08 + /* CF==1 or ZF==1 --> crash (ud2) */ + "ja 2f ; ud2 ; 2:\n" + ".section __ex_table,\"a\"\n" + " "__FIXUP_ALIGN"\n" + " "__FIXUP_WORD" 1b,2b\n" + ".previous" : : "a" (&operand), "c" (ext) : "memory" ); -- 2.39.5