x86emul: replace _BYTES_PER_LONG
PATCH 1/1 x86emul: replace _BYTES_PER_LONG
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 <[email protected]>
---
Quite likely libxl{,u}_internal.h's STRINGIFY() could then also be replaced.
xen/arch/x86/x86_emulate/private.h +1 -3
@@ -633,11 +633,9 @@ amd_like(const struct x86_emulate_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. */
@@ -651,7 +649,7 @@ amd_like(const struct x86_emulate_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; " \
tools/firmware/hvmloader/util.h +0 -3
@@ -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
tools/include/xen-tools/common-macros.h +3 -0
@@ -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)
Quoted 4 lines · Jan Beulich
We can now easily use
__SIZEOF_LONG__instead. For this to also work in the test harness, move hvmloader'sSTR()tocommon-macros.h.Signed-off-by Jan Beulich <[email protected]>
Acked-by Andrew Cooper <[email protected]>
Quoted 4 lines · Jan Beulich
We can now easily use
__SIZEOF_LONG__instead. For this to also work in the test harness, move hvmloader'sSTR()tocommon-macros.h.Signed-off-by Jan Beulich <[email protected]>
Acked-by Anthony PERARD <[email protected]>
Quoted 2 lines
Quite likely libxl{,u}_internal.h's
STRINGIFY()could then also be replaced.
Sounds good. It seems the different between STR() and TOSTRING() is that a comma can be use as well with STR, so not really a useful difference.
Thanks,
Signature · 5 lines
Anthony Perard | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech