1 /* SPDX-License-Identifier: GPL-2.0 */
5 * Architecture specific compatibility types
7 #include <linux/thread_info.h>
8 #include <linux/types.h>
10 #include <asm/ptrace.h>
12 typedef s32 __compat_uid_t;
13 typedef s32 __compat_gid_t;
14 typedef __compat_uid_t __compat_uid32_t;
15 typedef __compat_gid_t __compat_gid32_t;
16 #define __compat_uid32_t __compat_uid32_t
17 #define __compat_gid32_t __compat_gid32_t
19 #define _COMPAT_NSIG 128 /* Don't ask !$@#% ... */
20 #define _COMPAT_NSIG_BPW 32
21 typedef u32 compat_sigset_word;
23 #include <asm-generic/compat.h>
25 #define COMPAT_USER_HZ 100
26 #define COMPAT_UTS_MACHINE "mips\0\0\0"
28 typedef u32 compat_dev_t;
29 typedef u32 compat_nlink_t;
30 typedef s32 compat_ipc_pid_t;
39 compat_mode_t st_mode;
40 compat_nlink_t st_nlink;
41 __compat_uid_t st_uid;
42 __compat_gid_t st_gid;
47 old_time32_t st_atime;
49 old_time32_t st_mtime;
51 old_time32_t st_ctime;
72 struct compat_flock64 {
75 compat_loff_t l_start;
80 struct compat_statfs {
95 #define COMPAT_RLIM_INFINITY 0x7fffffffUL
97 #define COMPAT_OFF_T_MAX 0x7fffffff
99 static inline void __user *arch_compat_alloc_user_space(long len)
101 struct pt_regs *regs = (struct pt_regs *)
102 ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
104 return (void __user *) (regs->regs[29] - len);
107 struct compat_ipc64_perm {
109 __compat_uid32_t uid;
110 __compat_gid32_t gid;
111 __compat_uid32_t cuid;
112 __compat_gid32_t cgid;
115 unsigned short __pad2;
116 compat_ulong_t __unused1;
117 compat_ulong_t __unused2;
120 struct compat_semid64_ds {
121 struct compat_ipc64_perm sem_perm;
122 compat_ulong_t sem_otime;
123 compat_ulong_t sem_ctime;
124 compat_ulong_t sem_nsems;
125 compat_ulong_t sem_otime_high;
126 compat_ulong_t sem_ctime_high;
129 struct compat_msqid64_ds {
130 struct compat_ipc64_perm msg_perm;
131 #ifndef CONFIG_CPU_LITTLE_ENDIAN
132 compat_ulong_t msg_stime_high;
134 compat_ulong_t msg_stime;
135 #ifdef CONFIG_CPU_LITTLE_ENDIAN
136 compat_ulong_t msg_stime_high;
138 #ifndef CONFIG_CPU_LITTLE_ENDIAN
139 compat_ulong_t msg_rtime_high;
141 compat_ulong_t msg_rtime;
142 #ifdef CONFIG_CPU_LITTLE_ENDIAN
143 compat_ulong_t msg_rtime_high;
145 #ifndef CONFIG_CPU_LITTLE_ENDIAN
146 compat_ulong_t msg_ctime_high;
148 compat_ulong_t msg_ctime;
149 #ifdef CONFIG_CPU_LITTLE_ENDIAN
150 compat_ulong_t msg_ctime_high;
152 compat_ulong_t msg_cbytes;
153 compat_ulong_t msg_qnum;
154 compat_ulong_t msg_qbytes;
155 compat_pid_t msg_lspid;
156 compat_pid_t msg_lrpid;
157 compat_ulong_t __unused4;
158 compat_ulong_t __unused5;
161 struct compat_shmid64_ds {
162 struct compat_ipc64_perm shm_perm;
163 compat_size_t shm_segsz;
164 compat_ulong_t shm_atime;
165 compat_ulong_t shm_dtime;
166 compat_ulong_t shm_ctime;
167 compat_pid_t shm_cpid;
168 compat_pid_t shm_lpid;
169 compat_ulong_t shm_nattch;
170 compat_ushort_t shm_atime_high;
171 compat_ushort_t shm_dtime_high;
172 compat_ushort_t shm_ctime_high;
173 compat_ushort_t __unused2;
176 /* MIPS has unusual order of fields in stack_t */
177 typedef struct compat_sigaltstack {
179 compat_size_t ss_size;
182 #define compat_sigaltstack compat_sigaltstack
184 static inline int is_compat_task(void)
186 return test_thread_flag(TIF_32BIT_ADDR);
189 #endif /* _ASM_COMPAT_H */