]> xenbits.xensource.com Git - xen.git/commitdiff
x86emul: replace _BYTES_PER_LONG
authorJan Beulich <jbeulich@suse.com>
Mon, 7 Apr 2025 10:16:43 +0000 (12:16 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 7 Apr 2025 10:16:43 +0000 (12:16 +0200)
We can now easily use __SIZEOF_LONG__ instead. For this to also work in
the test harness, move hvmloader's STR() to common-macros.h.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Anthony PERARD <anthony.perard@vates.tech>
tools/firmware/hvmloader/util.h
tools/include/xen-tools/common-macros.h
xen/arch/x86/x86_emulate/private.h

index 17ed3783f21328c62dfb887f2166ae75566dd9f2..644450c51cebe0cadc8a384eb56dda602b1763c7 100644 (file)
@@ -21,9 +21,6 @@ enum {
 /* Cause xs_wire.h to give us xsd_errors[]. */
 #define EINVAL EINVAL
 
-#define __STR(...) #__VA_ARGS__
-#define STR(...) __STR(__VA_ARGS__)
-
 /* GDT selector values. */
 #define SEL_CODE16          0x0008
 #define SEL_DATA16          0x0010
index 60912225cb7abaa3604ea6626710dc16b8f9641f..0088208c2ee933cf957e11dc8f2b77caf4e19897 100644 (file)
@@ -88,6 +88,9 @@
     (type *)((char *)mptr__ - offsetof(type, member));  \
 })
 
+#define __STR(...) #__VA_ARGS__
+#define STR(...) __STR(__VA_ARGS__)
+
 #define __AC(X, Y)   (X ## Y)
 #define _AC(X, Y)    __AC(X, Y)
 
index f33330c7874165064262e94bf1349339a80d4bed..30be595470323bd41a4abf37426a9cbee18a818c 100644 (file)
@@ -641,11 +641,9 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #if defined(__x86_64__)
 #define _LO32 "k"          /* force 32-bit operand */
 #define _STK  "%%rsp"      /* stack pointer */
-#define _BYTES_PER_LONG "8"
 #elif defined(__i386__)
 #define _LO32 ""           /* force 32-bit operand */
 #define _STK  "%%esp"      /* stack pointer */
-#define _BYTES_PER_LONG "4"
 #endif
 
 /* Before executing instruction: restore necessary bits in EFLAGS. */
@@ -659,7 +657,7 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 "pushf; "                                                       \
 "notl %"_LO32 _tmp"; "                                          \
 "andl %"_LO32 _tmp",("_STK"); "                                 \
-"andl %"_LO32 _tmp",2*"_BYTES_PER_LONG"("_STK"); "              \
+"andl %"_LO32 _tmp", 2 * " STR(__SIZEOF_LONG__) "("_STK"); "    \
 "pop  %"_tmp"; "                                                \
 "orl  %"_LO32 _tmp",("_STK"); "                                 \
 "popf; "                                                        \