Skip to content

Commit

Permalink
asm-generic: compat: Support BE for long long args in 32-bit ABIs
Browse files Browse the repository at this point in the history
32-bit ABIs support passing 64-bit integers by registers via argument
translation. Commit 59c10c5 ("riscv: compat: syscall: Add
compat_sys_call_table implementation") implements the compat_arg_u64
macro for efficiently defining little endian compatibility syscalls.

Architectures supporting big endianness may benefit from reciprocal
argument translation, but are welcome also to implement their own.

Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Arnd Bergmann <arnd@anrdb.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220921065605.1051927-10-rmclure@linux.ibm.com
  • Loading branch information
Rohan McLure authored and Michael Ellerman committed Sep 26, 2022
1 parent 016ff72 commit 43d5de2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions include/asm-generic/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@
#define COMPAT_OFF_T_MAX 0x7fffffff
#endif

#if !defined(compat_arg_u64) && !defined(CONFIG_CPU_BIG_ENDIAN)
#ifndef compat_arg_u64
#ifdef CONFIG_CPU_BIG_ENDIAN
#define compat_arg_u64(name) u32 name##_lo, u32 name##_hi
#define compat_arg_u64_dual(name) u32, name##_lo, u32, name##_hi
#else
#define compat_arg_u64(name) u32 name##_hi, u32 name##_lo
#define compat_arg_u64_dual(name) u32, name##_hi, u32, name##_lo
#endif
#define compat_arg_u64_glue(name) (((u64)name##_lo & 0xffffffffUL) | \
((u64)name##_hi << 32))
#endif
#endif /* compat_arg_u64 */

/* These types are common across all compat ABIs */
typedef u32 compat_size_t;
Expand Down

0 comments on commit 43d5de2

Please sign in to comment.