xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86emul: fix 32-bit test build
@ 2016-03-14  7:50 Jan Beulich
  2016-03-14  8:21 ` Andrew Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2016-03-14  7:50 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper, Keir Fraser

[-- Attachment #1: Type: text/plain, Size: 1283 bytes --]

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>

--- a/tools/tests/x86_emulator/x86_emulate.c
+++ b/tools/tests/x86_emulator/x86_emulate.c
@@ -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))
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -853,7 +853,7 @@ static bool_t div_dbl(unsigned long u[2]
 {
     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;
 }
 




[-- Attachment #2: x86emul-test-32bit.patch --]
[-- Type: text/plain, Size: 1311 bytes --]

x86emul: fix 32-bit test build

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>

--- a/tools/tests/x86_emulator/x86_emulate.c
+++ b/tools/tests/x86_emulator/x86_emulate.c
@@ -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))
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -853,7 +853,7 @@ static bool_t div_dbl(unsigned long u[2]
 {
     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;
 }
 

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86emul: fix 32-bit test build
  2016-03-14  7:50 [PATCH] x86emul: fix 32-bit test build Jan Beulich
@ 2016-03-14  8:21 ` Andrew Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2016-03-14  8:21 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Keir Fraser

On 14/03/2016 07:50, Jan Beulich wrote:
> 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>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-14  8:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-14  7:50 [PATCH] x86emul: fix 32-bit test build Jan Beulich
2016-03-14  8:21 ` Andrew Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).