File s390-tools-sles15sp2-20-Support-lib-zt_common.h-to-be-used-in-assembler-and-.patch of Package s390-tools.17983
Subject: [PATCH] [FEAT VS1804] Support `lib/zt_common.h` to be used in assembler and add `_AC` macro
From: Marc Hartmayer <mhartmay@linux.ibm.com>
Summary: genprotimg: Introduce new tool for the creation of PV images
Description: genprotimg takes a kernel, host-key documents, optionally an
initrd, optionally a file with the kernel command line, and it
generates a single, loadable image file. The image consists of a
concatenation of a plain text boot loader, the encrypted
components for kernel, initrd, and cmdline, and the
integrity-protected PV header, containing metadata necessary for
running the guest in PV mode. It's possible to use this image file
as a kernel for zIPL or for a direct kernel boot using QEMU.
Upstream-ID: 400167f5128a14ba48b0d05b7b777b42c450c73f
Problem-ID: VS1804
Upstream-Description:
Support `lib/zt_common.h` to be used in assembler and add `_AC` macro
Support `lib/zt_common.h` to be used in assembler files. In addition,
add the macro `_AC` that can be used to make constant macros usable in
both assembler and C code.
Suggested-by: Philipp Rudo <prudo@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Reviewed-by: Philipp Rudo <prudo@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Marc Hartmayer <mhartmay@linux.ibm.com>
---
include/lib/zt_common.h | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
--- a/include/lib/zt_common.h
+++ b/include/lib/zt_common.h
@@ -15,6 +15,21 @@
#define STRINGIFY_1(x) #x
#define STRINGIFY(x) STRINGIFY_1(x)
+/* Use this macro to make constant macros usable in both assembler and
+ * C code.
+ *
+ * Usage example:
+ * #define IMAGE_ENTRY _AC(0x10000, UL)
+ */
+#ifdef __ASSEMBLER__
+#define _AC(X, TYPE) X
+#else
+#define _AC(X, TYPE) X##TYPE
+#endif
+
+
+#ifndef __ASSEMBLER__
+
#ifdef UNUSED
#elif defined(__GNUC__)
# define UNUSED(x) UNUSED_ ## x __attribute__((unused))
@@ -50,4 +65,5 @@ typedef signed short int s16;
typedef unsigned char u8;
typedef signed char s8;
+#endif /* __ASSEMBLER__ */
#endif /* LIB_ZT_COMMON_H */