aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>2024-02-29 09:22:28 -0500
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>2024-02-29 09:36:46 -0500
commit4cb890a63f74b399dfb7428b5aa716808c2500f9 (patch)
treeca19f39a2eef1fa3e861d24965c0d3555b4a77db
parentff36aa74f9bbf9ad5103cbb531adea6de929d3f3 (diff)
downloadlibrseq-4cb890a63f74b399dfb7428b5aa716808c2500f9.tar.gz
arm: Fix big endian, introduce RSEQ_ASM_U64_PTR
Fix support for Big endian ARM by introducing RSEQ_ASM_U64_PTR. This will allow moving __RSEQ_ASM_DEFINE_TABLE and RSEQ_ASM_DEFINE_EXIT_POINT to a generic common header file. Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Change-Id: I6271f217b0e1463968bd7d520ddd0fb61678bb84
-rw-r--r--include/rseq/arch/arm.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/include/rseq/arch/arm.h b/include/rseq/arch/arm.h
index 7b7e64d..1a6ad12 100644
--- a/include/rseq/arch/arm.h
+++ b/include/rseq/arch/arm.h
@@ -99,6 +99,12 @@ do { \
RSEQ_WRITE_ONCE(*(p), v); \
} while (0)
+#ifdef __ARMEB__ /* Big endian */
+# define RSEQ_ASM_U64_PTR(x) ".word 0x0, " x
+#else /* Little endian */
+# define RSEQ_ASM_U64_PTR(x) ".word " x ", 0x0"
+#endif
+
/* Only used in RSEQ_ASM_DEFINE_TABLE. */
#define __RSEQ_ASM_DEFINE_TABLE(label, version, flags, start_ip, \
post_commit_offset, abort_ip) \
@@ -106,10 +112,12 @@ do { \
".balign 32\n\t" \
__rseq_str(label) ":\n\t" \
".word " __rseq_str(version) ", " __rseq_str(flags) "\n\t" \
- ".word " __rseq_str(start_ip) ", 0x0, " __rseq_str(post_commit_offset) ", 0x0, " __rseq_str(abort_ip) ", 0x0\n\t" \
+ RSEQ_ASM_U64_PTR(__rseq_str(start_ip)) "\n\t" \
+ RSEQ_ASM_U64_PTR(__rseq_str(post_commit_offset)) "\n\t" \
+ RSEQ_ASM_U64_PTR(__rseq_str(abort_ip)) "\n\t" \
".popsection\n\t" \
".pushsection __rseq_cs_ptr_array, \"aw\"\n\t" \
- ".word " __rseq_str(label) "b, 0x0\n\t" \
+ RSEQ_ASM_U64_PTR(__rseq_str(label) "b") "\n\t" \
".popsection\n\t"
/*
@@ -151,7 +159,8 @@ do { \
*/
#define RSEQ_ASM_DEFINE_EXIT_POINT(start_ip, exit_ip) \
".pushsection __rseq_exit_point_array, \"aw\"\n\t" \
- ".word " __rseq_str(start_ip) ", 0x0, " __rseq_str(exit_ip) ", 0x0\n\t" \
+ RSEQ_ASM_U64_PTR(__rseq_str(start_ip)) "\n\t" \
+ RSEQ_ASM_U64_PTR(__rseq_str(exit_ip)) "\n\t" \
".popsection\n\t"
/*
@@ -181,7 +190,9 @@ do { \
".balign 32\n\t" \
__rseq_str(table_label) ":\n\t" \
".word " __rseq_str(version) ", " __rseq_str(flags) "\n\t" \
- ".word " __rseq_str(start_ip) ", 0x0, " __rseq_str(post_commit_offset) ", 0x0, " __rseq_str(abort_ip) ", 0x0\n\t" \
+ RSEQ_ASM_U64_PTR(__rseq_str(start_ip)) "\n\t" \
+ RSEQ_ASM_U64_PTR(__rseq_str(post_commit_offset)) "\n\t" \
+ RSEQ_ASM_U64_PTR(__rseq_str(abort_ip)) "\n\t" \
".word " __rseq_str(RSEQ_SIG) "\n\t" \
__rseq_str(label) ":\n\t" \
teardown \