Skip to contentSkip to conversation

x86emul: make test harness build again as 32-bit binary

PATCH In review Jan Beulich 2 participants 2 messages Mar 31, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86emul: make test harness build again as 32-bit binary

Adding Q suffixes to FXSAVE/FXRSTOR did break the 32-bit build. Don't go back though, as the hand-coded 0x48 there weren't quite right either for the 32-bit case (they might well cause confusion when looking at the disassembly). Instead arrange for the compiler to DCE respective asm()-s, by short-circuiting REX_* to zero.

Fixes 5a33ea2800c1 ("x86emul: drop open-coding of REX.W prefixes")
xen/arch/x86/x86_emulate/private.h +8 -0
@@ -110,11 +110,19 @@ struct operand {
     } mem;
 };
 
+#if defined(__x86_64__)
 #define REX_PREFIX 0x40
 #define REX_B 0x01
 #define REX_X 0x02
 #define REX_R 0x04
 #define REX_W 0x08
+#elif defined(__i386__)
+#define REX_PREFIX 0
+#define REX_B 0
+#define REX_X 0
+#define REX_R 0
+#define REX_W 0
+#endif
 
 enum simd_opsize {
     simd_none,
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jan Beulich

Adding Q suffixes to FXSAVE/FXRSTOR did break the 32-bit build. Don't go back though, as the hand-coded 0x48 there weren't quite right either for the 32-bit case (they might well cause confusion when looking at the disassembly). Instead arrange for the compiler to DCE respective asm()-s, by short-circuiting REX_* to zero.

Fixes 5a33ea2800c1 ("x86emul: drop open-coding of REX.W prefixes")