1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_SPARC64_COMPAT_H
3 #define _ASM_SPARC64_COMPAT_H
5 * Architecture specific compatibility types
7 #include <linux/types.h>
9 #define compat_mode_t compat_mode_t
10 typedef u16 compat_mode_t;
12 #include <asm-generic/compat.h>
14 #define COMPAT_USER_HZ 100
15 #define COMPAT_UTS_MACHINE "sparc\0\0"
17 typedef u16 __compat_uid_t;
18 typedef u16 __compat_gid_t;
19 typedef u16 compat_dev_t;
20 typedef s16 compat_nlink_t;
21 typedef u16 compat_ipc_pid_t;
22 typedef __kernel_fsid_t compat_fsid_t;
27 compat_mode_t st_mode;
28 compat_nlink_t st_nlink;
29 __compat_uid_t st_uid;
30 __compat_gid_t st_gid;
33 old_time32_t st_atime;
34 compat_ulong_t st_atime_nsec;
35 old_time32_t st_mtime;
36 compat_ulong_t st_mtime_nsec;
37 old_time32_t st_ctime;
38 compat_ulong_t st_ctime_nsec;
39 compat_off_t st_blksize;
40 compat_off_t st_blocks;
44 struct compat_stat64 {
45 unsigned long long st_dev;
47 unsigned long long st_ino;
50 unsigned int st_nlink;
55 unsigned long long st_rdev;
57 unsigned char __pad3[8];
60 unsigned int st_blksize;
62 unsigned char __pad4[8];
63 unsigned int st_blocks;
65 unsigned int st_atime;
66 unsigned int st_atime_nsec;
68 unsigned int st_mtime;
69 unsigned int st_mtime_nsec;
71 unsigned int st_ctime;
72 unsigned int st_ctime_nsec;
74 unsigned int __unused4;
75 unsigned int __unused5;
91 struct compat_flock64 {
94 compat_loff_t l_start;
100 struct compat_statfs {
108 compat_fsid_t f_fsid;
109 int f_namelen; /* SunOS ignores this field. */
115 #define COMPAT_RLIM_INFINITY 0x7fffffff
117 #define COMPAT_OFF_T_MAX 0x7fffffff
120 static inline void __user *arch_compat_alloc_user_space(long len)
122 struct pt_regs *regs = current_thread_info()->kregs;
123 unsigned long usp = regs->u_regs[UREG_I6];
125 if (test_thread_64bit_stack(usp))
128 if (test_thread_flag(TIF_32BIT))
134 return (void __user *) usp;
138 struct compat_ipc64_perm {
140 __compat_uid32_t uid;
141 __compat_gid32_t gid;
142 __compat_uid32_t cuid;
143 __compat_gid32_t cgid;
144 unsigned short __pad1;
146 unsigned short __pad2;
148 unsigned long __unused1; /* yes they really are 64bit pads */
149 unsigned long __unused2;
152 struct compat_semid64_ds {
153 struct compat_ipc64_perm sem_perm;
154 unsigned int sem_otime_high;
155 unsigned int sem_otime;
156 unsigned int sem_ctime_high;
157 unsigned int sem_ctime;
163 struct compat_msqid64_ds {
164 struct compat_ipc64_perm msg_perm;
165 unsigned int msg_stime_high;
166 unsigned int msg_stime;
167 unsigned int msg_rtime_high;
168 unsigned int msg_rtime;
169 unsigned int msg_ctime_high;
170 unsigned int msg_ctime;
171 unsigned int msg_cbytes;
172 unsigned int msg_qnum;
173 unsigned int msg_qbytes;
174 compat_pid_t msg_lspid;
175 compat_pid_t msg_lrpid;
176 unsigned int __unused1;
177 unsigned int __unused2;
180 struct compat_shmid64_ds {
181 struct compat_ipc64_perm shm_perm;
182 unsigned int shm_atime_high;
183 unsigned int shm_atime;
184 unsigned int shm_dtime_high;
185 unsigned int shm_dtime;
186 unsigned int shm_ctime_high;
187 unsigned int shm_ctime;
188 compat_size_t shm_segsz;
189 compat_pid_t shm_cpid;
190 compat_pid_t shm_lpid;
191 unsigned int shm_nattch;
192 unsigned int __unused1;
193 unsigned int __unused2;
197 static inline int is_compat_task(void)
199 return test_thread_flag(TIF_32BIT);
202 static inline bool in_compat_syscall(void)
204 /* Vector 0x110 is LINUX_32BIT_SYSCALL_TRAP */
205 return pt_regs_trap_type(current_pt_regs()) == 0x110;
207 #define in_compat_syscall in_compat_syscall
210 #endif /* _ASM_SPARC64_COMPAT_H */