1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2012 ARM Ltd.
8 #define compat_mode_t compat_mode_t
9 typedef u16 compat_mode_t;
11 #include <asm-generic/compat.h>
16 * Architecture specific compatibility types
18 #include <linux/types.h>
19 #include <linux/sched.h>
20 #include <linux/sched/task_stack.h>
22 #define COMPAT_USER_HZ 100
24 #define COMPAT_UTS_MACHINE "armv8b\0\0"
26 #define COMPAT_UTS_MACHINE "armv8l\0\0"
29 typedef u16 __compat_uid_t;
30 typedef u16 __compat_gid_t;
31 typedef u16 __compat_uid16_t;
32 typedef u16 __compat_gid16_t;
33 typedef u32 compat_dev_t;
34 typedef s32 compat_nlink_t;
35 typedef u16 compat_ipc_pid_t;
36 typedef __kernel_fsid_t compat_fsid_t;
46 compat_mode_t st_mode;
47 compat_ushort_t st_nlink;
48 __compat_uid16_t st_uid;
49 __compat_gid16_t st_gid;
57 compat_off_t st_blksize;
58 compat_off_t st_blocks;
59 old_time32_t st_atime;
60 compat_ulong_t st_atime_nsec;
61 old_time32_t st_mtime;
62 compat_ulong_t st_mtime_nsec;
63 old_time32_t st_ctime;
64 compat_ulong_t st_ctime_nsec;
65 compat_ulong_t __unused4[2];
76 #define F_GETLK64 12 /* using 'struct flock64' */
80 struct compat_flock64 {
83 compat_loff_t l_start;
88 struct compat_statfs {
97 int f_namelen; /* SunOS ignores this field. */
103 #define COMPAT_RLIM_INFINITY 0xffffffff
105 #define COMPAT_OFF_T_MAX 0x7fffffff
107 #define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
108 #define COMPAT_MINSIGSTKSZ 2048
110 static inline void __user *arch_compat_alloc_user_space(long len)
112 return (void __user *)compat_user_stack_pointer() - len;
115 struct compat_ipc64_perm {
117 __compat_uid32_t uid;
118 __compat_gid32_t gid;
119 __compat_uid32_t cuid;
120 __compat_gid32_t cgid;
122 unsigned short __pad1;
124 unsigned short __pad2;
125 compat_ulong_t unused1;
126 compat_ulong_t unused2;
129 struct compat_semid64_ds {
130 struct compat_ipc64_perm sem_perm;
131 compat_ulong_t sem_otime;
132 compat_ulong_t sem_otime_high;
133 compat_ulong_t sem_ctime;
134 compat_ulong_t sem_ctime_high;
135 compat_ulong_t sem_nsems;
136 compat_ulong_t __unused3;
137 compat_ulong_t __unused4;
140 struct compat_msqid64_ds {
141 struct compat_ipc64_perm msg_perm;
142 compat_ulong_t msg_stime;
143 compat_ulong_t msg_stime_high;
144 compat_ulong_t msg_rtime;
145 compat_ulong_t msg_rtime_high;
146 compat_ulong_t msg_ctime;
147 compat_ulong_t msg_ctime_high;
148 compat_ulong_t msg_cbytes;
149 compat_ulong_t msg_qnum;
150 compat_ulong_t msg_qbytes;
151 compat_pid_t msg_lspid;
152 compat_pid_t msg_lrpid;
153 compat_ulong_t __unused4;
154 compat_ulong_t __unused5;
157 struct compat_shmid64_ds {
158 struct compat_ipc64_perm shm_perm;
159 compat_size_t shm_segsz;
160 compat_ulong_t shm_atime;
161 compat_ulong_t shm_atime_high;
162 compat_ulong_t shm_dtime;
163 compat_ulong_t shm_dtime_high;
164 compat_ulong_t shm_ctime;
165 compat_ulong_t shm_ctime_high;
166 compat_pid_t shm_cpid;
167 compat_pid_t shm_lpid;
168 compat_ulong_t shm_nattch;
169 compat_ulong_t __unused4;
170 compat_ulong_t __unused5;
173 static inline int is_compat_task(void)
175 return test_thread_flag(TIF_32BIT);
178 static inline int is_compat_thread(struct thread_info *thread)
180 return test_ti_thread_flag(thread, TIF_32BIT);
183 #else /* !CONFIG_COMPAT */
185 static inline int is_compat_thread(struct thread_info *thread)
190 #endif /* CONFIG_COMPAT */
191 #endif /* __ASM_COMPAT_H */