]> xenbits.xensource.com Git - xen.git/commitdiff
x86emul: fix 32-bit test build
authorJan Beulich <jbeulich@suse.com>
Mon, 14 Mar 2016 12:02:56 +0000 (13:02 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 14 Mar 2016 12:02:56 +0000 (13:02 +0100)
Commit 5644ce0142 ("x86emul: relax asm() constraints") introduced a
64-bit only instruction suffix, which breaks running the emulator test
on a 32-bit system. Mirror __OS (and _OP for completeness) to the test
wrapper source file.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
tools/tests/x86_emulator/x86_emulate.c
xen/arch/x86/x86_emulate/x86_emulate.c

index f5b450d2a0de89ac632cb0d4c386f707409dbb47..5d7fae43e718dc827067ba6f43391026691cb660 100644 (file)
@@ -18,6 +18,15 @@ typedef bool bool_t;
 
 #define __packed __attribute__((packed))
 
+/* For generic assembly code: use macros to define operation/operand sizes. */
+#ifdef __i386__
+# define __OS          "l"  /* Operation Suffix */
+# define __OP          "e"  /* Operand Prefix */
+#else
+# define __OS          "q"  /* Operation Suffix */
+# define __OP          "r"  /* Operand Prefix */
+#endif
+
 #include "x86_emulate/x86_emulate.h"
 
 #define get_stub(stb) ((void *)((stb).addr = (uintptr_t)(stb).buf))
index 07fdaeb7cef21de654bfb63a3f4e90a4a040942f..10a295969066839da1b3dc1d4869722f386a26af 100644 (file)
@@ -853,7 +853,7 @@ static bool_t div_dbl(unsigned long u[2], unsigned long v)
 {
     if ( (v == 0) || (u[1] >= v) )
         return 1;
-    asm ( "divq %2" : "+a" (u[0]), "+d" (u[1]) : "rm" (v) );
+    asm ( "div"__OS" %2" : "+a" (u[0]), "+d" (u[1]) : "rm" (v) );
     return 0;
 }