|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86emul: replace _BYTES_PER_LONG
commit 115f639142b28b75b8964918e9218207ffe3ff2a
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Apr 7 12:16:43 2025 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Apr 7 12:16:43 2025 +0200
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 <jbeulich@xxxxxxxx>
Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Acked-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
---
tools/firmware/hvmloader/util.h | 3 ---
tools/include/xen-tools/common-macros.h | 3 +++
xen/arch/x86/x86_emulate/private.h | 4 +---
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/tools/firmware/hvmloader/util.h b/tools/firmware/hvmloader/util.h
index 17ed3783f2..644450c51c 100644
--- a/tools/firmware/hvmloader/util.h
+++ b/tools/firmware/hvmloader/util.h
@@ -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
diff --git a/tools/include/xen-tools/common-macros.h
b/tools/include/xen-tools/common-macros.h
index 60912225cb..0088208c2e 100644
--- a/tools/include/xen-tools/common-macros.h
+++ b/tools/include/xen-tools/common-macros.h
@@ -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)
diff --git a/xen/arch/x86/x86_emulate/private.h
b/xen/arch/x86/x86_emulate/private.h
index f33330c787..30be595470 100644
--- a/xen/arch/x86/x86_emulate/private.h
+++ b/xen/arch/x86/x86_emulate/private.h
@@ -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; " \
--
generated by git-patchbot for /home/xen/git/xen.git#master
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |