1 #ifndef _ASM_S390X_COMPAT_H
2 #define _ASM_S390X_COMPAT_H
4 * Architecture specific compatibility types
6 #include <linux/types.h>
7 #include <linux/sched.h>
9 #define PSW32_MASK_PER 0x40000000UL
10 #define PSW32_MASK_DAT 0x04000000UL
11 #define PSW32_MASK_IO 0x02000000UL
12 #define PSW32_MASK_EXT 0x01000000UL
13 #define PSW32_MASK_KEY 0x00F00000UL
14 #define PSW32_MASK_MCHECK 0x00040000UL
15 #define PSW32_MASK_WAIT 0x00020000UL
16 #define PSW32_MASK_PSTATE 0x00010000UL
17 #define PSW32_MASK_ASC 0x0000C000UL
18 #define PSW32_MASK_CC 0x00003000UL
19 #define PSW32_MASK_PM 0x00000f00UL
21 #define PSW32_ADDR_AMODE31 0x80000000UL
22 #define PSW32_ADDR_INSN 0x7FFFFFFFUL
24 #define PSW32_BASE_BITS 0x00080000UL
26 #define PSW32_ASC_PRIMARY 0x00000000UL
27 #define PSW32_ASC_ACCREG 0x00004000UL
28 #define PSW32_ASC_SECONDARY 0x00008000UL
29 #define PSW32_ASC_HOME 0x0000C000UL
31 #define PSW32_MASK_MERGE(CURRENT,NEW) \
32 (((CURRENT) & ~(PSW32_MASK_CC|PSW32_MASK_PM)) | \
33 ((NEW) & (PSW32_MASK_CC|PSW32_MASK_PM)))
35 extern long psw32_user_bits;
37 #define COMPAT_USER_HZ 100
39 typedef u32 compat_size_t;
40 typedef s32 compat_ssize_t;
41 typedef s32 compat_time_t;
42 typedef s32 compat_clock_t;
43 typedef s32 compat_pid_t;
44 typedef u16 __compat_uid_t;
45 typedef u16 __compat_gid_t;
46 typedef u32 __compat_uid32_t;
47 typedef u32 __compat_gid32_t;
48 typedef u16 compat_mode_t;
49 typedef u32 compat_ino_t;
50 typedef u16 compat_dev_t;
51 typedef s32 compat_off_t;
52 typedef s64 compat_loff_t;
53 typedef u16 compat_nlink_t;
54 typedef u16 compat_ipc_pid_t;
55 typedef s32 compat_daddr_t;
56 typedef u32 compat_caddr_t;
57 typedef __kernel_fsid_t compat_fsid_t;
58 typedef s32 compat_key_t;
59 typedef s32 compat_timer_t;
61 typedef s32 compat_int_t;
62 typedef s32 compat_long_t;
63 typedef s64 compat_s64;
64 typedef u32 compat_uint_t;
65 typedef u32 compat_ulong_t;
66 typedef u64 compat_u64;
68 struct compat_timespec {
73 struct compat_timeval {
82 compat_mode_t st_mode;
83 compat_nlink_t st_nlink;
84 __compat_uid_t st_uid;
85 __compat_gid_t st_gid;
101 struct compat_flock {
104 compat_off_t l_start;
111 #define F_SETLKW64 14
113 struct compat_flock64 {
116 compat_loff_t l_start;
121 struct compat_statfs {
129 compat_fsid_t f_fsid;
135 #define COMPAT_RLIM_OLD_INFINITY 0x7fffffff
136 #define COMPAT_RLIM_INFINITY 0xffffffff
138 typedef u32 compat_old_sigset_t; /* at least 32 bits */
140 #define _COMPAT_NSIG 64
141 #define _COMPAT_NSIG_BPW 32
143 typedef u32 compat_sigset_word;
145 #define COMPAT_OFF_T_MAX 0x7fffffff
146 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
149 * A pointer passed in from user mode. This should not
150 * be used for syscall parameters, just declare them
151 * as pointers because the syscall entry code will have
152 * appropriately comverted them already.
154 typedef u32 compat_uptr_t;
156 static inline void __user *compat_ptr(compat_uptr_t uptr)
158 return (void __user *)(unsigned long)(uptr & 0x7fffffffUL);
161 static inline compat_uptr_t ptr_to_compat(void __user *uptr)
163 return (u32)(unsigned long)uptr;
166 static inline void __user *compat_alloc_user_space(long len)
170 stack = KSTK_ESP(current);
171 if (test_thread_flag(TIF_31BIT))
172 stack &= 0x7fffffffUL;
173 return (void __user *) (stack - len);
176 struct compat_ipc64_perm {
178 __compat_uid32_t uid;
179 __compat_gid32_t gid;
180 __compat_uid32_t cuid;
181 __compat_gid32_t cgid;
183 unsigned short __pad1;
185 unsigned short __pad2;
186 unsigned int __unused1;
187 unsigned int __unused2;
190 struct compat_semid64_ds {
191 struct compat_ipc64_perm sem_perm;
192 compat_time_t sem_otime;
193 compat_ulong_t __pad1;
194 compat_time_t sem_ctime;
195 compat_ulong_t __pad2;
196 compat_ulong_t sem_nsems;
197 compat_ulong_t __unused1;
198 compat_ulong_t __unused2;
201 struct compat_msqid64_ds {
202 struct compat_ipc64_perm msg_perm;
203 compat_time_t msg_stime;
204 compat_ulong_t __pad1;
205 compat_time_t msg_rtime;
206 compat_ulong_t __pad2;
207 compat_time_t msg_ctime;
208 compat_ulong_t __pad3;
209 compat_ulong_t msg_cbytes;
210 compat_ulong_t msg_qnum;
211 compat_ulong_t msg_qbytes;
212 compat_pid_t msg_lspid;
213 compat_pid_t msg_lrpid;
214 compat_ulong_t __unused1;
215 compat_ulong_t __unused2;
218 struct compat_shmid64_ds {
219 struct compat_ipc64_perm shm_perm;
220 compat_size_t shm_segsz;
221 compat_time_t shm_atime;
222 compat_ulong_t __pad1;
223 compat_time_t shm_dtime;
224 compat_ulong_t __pad2;
225 compat_time_t shm_ctime;
226 compat_ulong_t __pad3;
227 compat_pid_t shm_cpid;
228 compat_pid_t shm_lpid;
229 compat_ulong_t shm_nattch;
230 compat_ulong_t __unused1;
231 compat_ulong_t __unused2;
233 #endif /* _ASM_S390X_COMPAT_H */