]> xenbits.xensource.com Git - xen.git/commitdiff
Intel VPID: Do not crash if INVVPID is attempted before VMXON.
authorKeir Fraser <keir.fraser@citrix.com>
Fri, 25 Apr 2008 12:38:22 +0000 (13:38 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Fri, 25 Apr 2008 12:38:22 +0000 (13:38 +0100)
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
xen/include/asm-x86/hvm/vmx/vmx.h

index c94549caecc24925082625496bd8c1ce1b9c5732..58834e7f7d9565493fb3c52ec1e063c63cf9339d 100644 (file)
@@ -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" );