]> xenbits.xensource.com Git - people/royger/xen-test-framework.git/commitdiff
Provide a Forced Emulation identifier rather than hand-rolling assembly
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 13 Jan 2016 10:49:46 +0000 (10:49 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 13 Jan 2016 10:54:07 +0000 (10:54 +0000)
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/setup.c
include/xen/arch-x86/xen.h

index 914fd389073d12d0606fecc4479c03a8c03db688..a039aa1b25e303c590f0d3b16f0bf8ea734c2053 100644 (file)
@@ -149,7 +149,7 @@ void test_setup(void)
      * for the #UD exception if FEP is not available.
      */
     asm volatile ("xor %0, %0;"
-                  "1: ud2a; .ascii \"xen\";"
+                  "1:" _ASM_XEN_FEP
                   "mov $1, %0;"
                   "2:"
                   _ASM_EXTABLE(1b, 2b)
index 8642eae66bae8e104b9714c4bfda40746733c05f..19a1c0fd3233de73c9c7f9c01f9e5537e481a0f2 100644 (file)
@@ -38,6 +38,22 @@ struct xen_trap_info {
 
 #endif
 
+/**
+ * Xen Forced Emulation Prefix.
+ *
+ * For PV guests, may prefix a `cpuid` instruction to allow Xen to fill in
+ * information, rather than reading the hardware values.
+ *
+ * For HVM guests (and with the Xen 'hvm_fep' command line option enabled),
+ * may be used for cause any arbitrary instruction to be emulated in the
+ * hypervisor's x86 emulator.
+ */
+#ifdef __ASSEMBLY__
+#define _ASM_XEN_FEP ud2a; .ascii "xen";
+#else
+#define _ASM_XEN_FEP "ud2a; .ascii \"xen\";"
+#endif
+
 #endif /* XEN_PUBLIC_ARCH_X86_XEN_H */
 
 /*