@@ -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))
@@ -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;
}