1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_POWERPC_COMPAT_H
3 #define _ASM_POWERPC_COMPAT_H
6 * Architecture specific compatibility types
8 #include <linux/types.h>
9 #include <linux/sched.h>
11 #include <asm-generic/compat.h>
13 #define COMPAT_USER_HZ 100
15 #define COMPAT_UTS_MACHINE "ppc\0\0"
17 #define COMPAT_UTS_MACHINE "ppcle\0\0"
20 typedef u32 __compat_uid_t;
21 typedef u32 __compat_gid_t;
22 typedef u32 compat_dev_t;
23 typedef s16 compat_nlink_t;
24 typedef u16 compat_ipc_pid_t;
25 typedef __kernel_fsid_t compat_fsid_t;
30 compat_mode_t st_mode;
31 compat_nlink_t st_nlink;
32 __compat_uid32_t st_uid;
33 __compat_gid32_t st_gid;
36 compat_off_t st_blksize;
37 compat_off_t st_blocks;
38 old_time32_t st_atime;
40 old_time32_t st_mtime;
42 old_time32_t st_ctime;
55 #define F_GETLK64 12 /* using 'struct flock64' */
59 struct compat_flock64 {
62 compat_loff_t l_start;
67 struct compat_statfs {
76 int f_namelen; /* SunOS ignores this field. */
82 #define COMPAT_RLIM_INFINITY 0xffffffff
84 #define COMPAT_OFF_T_MAX 0x7fffffff
86 static inline void __user *arch_compat_alloc_user_space(long len)
88 struct pt_regs *regs = current->thread.regs;
89 unsigned long usp = regs->gpr[1];
92 * We can't access below the stack pointer in the 32bit ABI and
93 * can access 288 bytes in the 64bit big-endian ABI,
94 * or 512 bytes with the new ELFv2 little-endian ABI.
97 usp -= USER_REDZONE_SIZE;
99 return (void __user *) (usp - len);
103 * ipc64_perm is actually 32/64bit clean but since the compat layer refers to
104 * it we may as well define it.
106 struct compat_ipc64_perm {
115 unsigned long __unused1; /* yes they really are 64bit pads */
116 unsigned long __unused2;
119 struct compat_semid64_ds {
120 struct compat_ipc64_perm sem_perm;
121 unsigned int sem_otime_high;
122 unsigned int sem_otime;
123 unsigned int sem_ctime_high;
124 unsigned int sem_ctime;
125 compat_ulong_t sem_nsems;
126 compat_ulong_t __unused3;
127 compat_ulong_t __unused4;
130 struct compat_msqid64_ds {
131 struct compat_ipc64_perm msg_perm;
132 unsigned int msg_stime_high;
133 unsigned int msg_stime;
134 unsigned int msg_rtime_high;
135 unsigned int msg_rtime;
136 unsigned int msg_ctime_high;
137 unsigned int msg_ctime;
138 compat_ulong_t msg_cbytes;
139 compat_ulong_t msg_qnum;
140 compat_ulong_t msg_qbytes;
141 compat_pid_t msg_lspid;
142 compat_pid_t msg_lrpid;
143 compat_ulong_t __unused4;
144 compat_ulong_t __unused5;
147 struct compat_shmid64_ds {
148 struct compat_ipc64_perm shm_perm;
149 unsigned int shm_atime_high;
150 unsigned int shm_atime;
151 unsigned int shm_dtime_high;
152 unsigned int shm_dtime;
153 unsigned int shm_ctime_high;
154 unsigned int shm_ctime;
155 unsigned int __unused4;
156 compat_size_t shm_segsz;
157 compat_pid_t shm_cpid;
158 compat_pid_t shm_lpid;
159 compat_ulong_t shm_nattch;
160 compat_ulong_t __unused5;
161 compat_ulong_t __unused6;
164 static inline int is_compat_task(void)
166 return is_32bit_task();
169 #endif /* __KERNEL__ */
170 #endif /* _ASM_POWERPC_COMPAT_H */