1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_S390X_COMPAT_H
3 #define _ASM_S390X_COMPAT_H
5 * Architecture specific compatibility types
7 #include <linux/types.h>
8 #include <linux/sched.h>
9 #include <linux/sched/task_stack.h>
10 #include <linux/thread_info.h>
11 #include <asm/ptrace.h>
13 #define compat_mode_t compat_mode_t
14 typedef u16 compat_mode_t;
16 #define __compat_uid_t __compat_uid_t
17 typedef u16 __compat_uid_t;
18 typedef u16 __compat_gid_t;
20 #define compat_dev_t compat_dev_t
21 typedef u16 compat_dev_t;
23 #define compat_ipc_pid_t compat_ipc_pid_t
24 typedef u16 compat_ipc_pid_t;
26 #define compat_statfs compat_statfs
28 #include <asm-generic/compat.h>
30 #define __TYPE_IS_PTR(t) (!__builtin_types_compatible_p( \
31 typeof(0?(__force t)0:0ULL), u64))
33 #define __SC_DELOUSE(t,v) ({ \
34 BUILD_BUG_ON(sizeof(t) > 4 && !__TYPE_IS_PTR(t)); \
35 (__force t)(__TYPE_IS_PTR(t) ? ((v) & 0x7fffffff) : (v)); \
38 #define PSW32_MASK_USER 0x0000FF00UL
40 #define PSW32_USER_BITS (PSW32_MASK_DAT | PSW32_MASK_IO | PSW32_MASK_EXT | \
41 PSW32_DEFAULT_KEY | PSW32_MASK_BASE | \
42 PSW32_MASK_MCHECK | PSW32_MASK_PSTATE | \
45 #define COMPAT_UTS_MACHINE "s390\0\0\0\0"
47 typedef u16 compat_nlink_t;
52 } __aligned(8) psw_compat_t;
62 u32 gprs_high[NUM_GPRS];
63 } s390_compat_regs_high;
69 compat_mode_t st_mode;
70 compat_nlink_t st_nlink;
71 __compat_uid_t st_uid;
72 __compat_gid_t st_gid;
88 struct compat_statfs {
103 struct compat_statfs64 {
111 compat_fsid_t f_fsid;
119 * A pointer passed in from user mode. This should not
120 * be used for syscall parameters, just declare them
121 * as pointers because the syscall entry code will have
122 * appropriately converted them already.
125 static inline void __user *compat_ptr(compat_uptr_t uptr)
127 return (void __user *)(unsigned long)(uptr & 0x7fffffffUL);
129 #define compat_ptr(uptr) compat_ptr(uptr)
133 static inline int is_compat_task(void)
135 return test_thread_flag(TIF_31BIT);
140 #endif /* _ASM_S390X_COMPAT_H */