[PATCH 7/9] powerpc: Add little endian variants of LHZX_BE and friends
Christophe Leroy
christophe.leroy at csgroup.eu
Sat Aug 17 00:36:54 AEST 2024
To support getrandom in VDSO which is based on little endian storage,
add macros equivalent to LHZX_BE for little endian accesses.
And move it outside of __powerpc64__ #ifdef so that it can also be
used for PPC32.
Signed-off-by: Christophe Leroy <christophe.leroy at csgroup.eu>
---
arch/powerpc/include/asm/asm-compat.h | 40 +++++++++++++++++----------
1 file changed, 26 insertions(+), 14 deletions(-)
diff --git a/arch/powerpc/include/asm/asm-compat.h b/arch/powerpc/include/asm/asm-compat.h
index 2bc53c646ccd..ef8e79ae669a 100644
--- a/arch/powerpc/include/asm/asm-compat.h
+++ b/arch/powerpc/include/asm/asm-compat.h
@@ -25,20 +25,6 @@
#define PPC_LR_STKOFF 16
#define PPC_MIN_STKFRM 112
-#ifdef __BIG_ENDIAN__
-#define LHZX_BE stringify_in_c(lhzx)
-#define LWZX_BE stringify_in_c(lwzx)
-#define LDX_BE stringify_in_c(ldx)
-#define STWX_BE stringify_in_c(stwx)
-#define STDX_BE stringify_in_c(stdx)
-#else
-#define LHZX_BE stringify_in_c(lhbrx)
-#define LWZX_BE stringify_in_c(lwbrx)
-#define LDX_BE stringify_in_c(ldbrx)
-#define STWX_BE stringify_in_c(stwbrx)
-#define STDX_BE stringify_in_c(stdbrx)
-#endif
-
#else /* 32-bit */
/* operations for longs and pointers */
@@ -61,4 +47,30 @@
#endif
+#ifdef __BIG_ENDIAN__
+#define LHZX_BE stringify_in_c(lhzx)
+#define LWZX_BE stringify_in_c(lwzx)
+#define LDX_BE stringify_in_c(ldx)
+#define STWX_BE stringify_in_c(stwx)
+#define STDX_BE stringify_in_c(stdx)
+
+#define LHZX_LE stringify_in_c(lhbrx)
+#define LWZX_LE stringify_in_c(lwbrx)
+#define LDX_LE stringify_in_c(ldbrx)
+#define STWX_LE stringify_in_c(stwbrx)
+#define STDX_LE stringify_in_c(stdbrx)
+#else
+#define LHZX_BE stringify_in_c(lhbrx)
+#define LWZX_BE stringify_in_c(lwbrx)
+#define LDX_BE stringify_in_c(ldbrx)
+#define STWX_BE stringify_in_c(stwbrx)
+#define STDX_BE stringify_in_c(stdbrx)
+
+#define LHZX_LE stringify_in_c(lhzx)
+#define LWZX_LE stringify_in_c(lwzx)
+#define LDX_LE stringify_in_c(ldx)
+#define STWX_LE stringify_in_c(stwx)
+#define STDX_LE stringify_in_c(stdx)
+#endif
+
#endif /* _ASM_POWERPC_ASM_COMPAT_H */
--
2.44.0
More information about the Linuxppc-dev
mailing list