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>
8 #include <linux/thread_info.h>
10 #define PSW32_MASK_PER 0x40000000UL
11 #define PSW32_MASK_DAT 0x04000000UL
12 #define PSW32_MASK_IO 0x02000000UL
13 #define PSW32_MASK_EXT 0x01000000UL
14 #define PSW32_MASK_KEY 0x00F00000UL
15 #define PSW32_MASK_BASE 0x00080000UL /* Always one */
16 #define PSW32_MASK_MCHECK 0x00040000UL
17 #define PSW32_MASK_WAIT 0x00020000UL
18 #define PSW32_MASK_PSTATE 0x00010000UL
19 #define PSW32_MASK_ASC 0x0000C000UL
20 #define PSW32_MASK_CC 0x00003000UL
21 #define PSW32_MASK_PM 0x00000f00UL
23 #define PSW32_MASK_USER 0x00003F00UL
25 #define PSW32_ADDR_AMODE 0x80000000UL
26 #define PSW32_ADDR_INSN 0x7FFFFFFFUL
28 #define PSW32_DEFAULT_KEY (((u32) PAGE_DEFAULT_ACC) << 20)
30 #define PSW32_ASC_PRIMARY 0x00000000UL
31 #define PSW32_ASC_ACCREG 0x00004000UL
32 #define PSW32_ASC_SECONDARY 0x00008000UL
33 #define PSW32_ASC_HOME 0x0000C000UL
35 extern u32 psw32_user_bits
;
37 #define COMPAT_USER_HZ 100
38 #define COMPAT_UTS_MACHINE "s390\0\0\0\0"
40 typedef u32 compat_size_t
;
41 typedef s32 compat_ssize_t
;
42 typedef s32 compat_time_t
;
43 typedef s32 compat_clock_t
;
44 typedef s32 compat_pid_t
;
45 typedef u16 __compat_uid_t
;
46 typedef u16 __compat_gid_t
;
47 typedef u32 __compat_uid32_t
;
48 typedef u32 __compat_gid32_t
;
49 typedef u16 compat_mode_t
;
50 typedef u32 compat_ino_t
;
51 typedef u16 compat_dev_t
;
52 typedef s32 compat_off_t
;
53 typedef s64 compat_loff_t
;
54 typedef u16 compat_nlink_t
;
55 typedef u16 compat_ipc_pid_t
;
56 typedef s32 compat_daddr_t
;
57 typedef u32 compat_caddr_t
;
58 typedef __kernel_fsid_t compat_fsid_t
;
59 typedef s32 compat_key_t
;
60 typedef s32 compat_timer_t
;
62 typedef s32 compat_int_t
;
63 typedef s32 compat_long_t
;
64 typedef s64 compat_s64
;
65 typedef u32 compat_uint_t
;
66 typedef u32 compat_ulong_t
;
67 typedef u64 compat_u64
;
69 struct compat_timespec
{
74 struct compat_timeval
{
83 compat_mode_t st_mode
;
84 compat_nlink_t st_nlink
;
85 __compat_uid_t st_uid
;
86 __compat_gid_t st_gid
;
102 struct compat_flock
{
105 compat_off_t l_start
;
112 #define F_SETLKW64 14
114 struct compat_flock64
{
117 compat_loff_t l_start
;
122 struct compat_statfs
{
130 compat_fsid_t f_fsid
;
137 #define COMPAT_RLIM_OLD_INFINITY 0x7fffffff
138 #define COMPAT_RLIM_INFINITY 0xffffffff
140 typedef u32 compat_old_sigset_t
; /* at least 32 bits */
142 #define _COMPAT_NSIG 64
143 #define _COMPAT_NSIG_BPW 32
145 typedef u32 compat_sigset_word
;
147 #define COMPAT_OFF_T_MAX 0x7fffffff
148 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
151 * A pointer passed in from user mode. This should not
152 * be used for syscall parameters, just declare them
153 * as pointers because the syscall entry code will have
154 * appropriately converted them already.
156 typedef u32 compat_uptr_t
;
158 static inline void __user
*compat_ptr(compat_uptr_t uptr
)
160 return (void __user
*)(unsigned long)(uptr
& 0x7fffffffUL
);
163 static inline compat_uptr_t
ptr_to_compat(void __user
*uptr
)
165 return (u32
)(unsigned long)uptr
;
170 static inline int is_compat_task(void)
172 return is_32bit_task();
177 static inline void __user
*arch_compat_alloc_user_space(long len
)
181 stack
= KSTK_ESP(current
);
182 if (is_compat_task())
183 stack
&= 0x7fffffffUL
;
184 return (void __user
*) (stack
- len
);
187 struct compat_ipc64_perm
{
189 __compat_uid32_t uid
;
190 __compat_gid32_t gid
;
191 __compat_uid32_t cuid
;
192 __compat_gid32_t cgid
;
194 unsigned short __pad1
;
196 unsigned short __pad2
;
197 unsigned int __unused1
;
198 unsigned int __unused2
;
201 struct compat_semid64_ds
{
202 struct compat_ipc64_perm sem_perm
;
203 compat_time_t sem_otime
;
204 compat_ulong_t __pad1
;
205 compat_time_t sem_ctime
;
206 compat_ulong_t __pad2
;
207 compat_ulong_t sem_nsems
;
208 compat_ulong_t __unused1
;
209 compat_ulong_t __unused2
;
212 struct compat_msqid64_ds
{
213 struct compat_ipc64_perm msg_perm
;
214 compat_time_t msg_stime
;
215 compat_ulong_t __pad1
;
216 compat_time_t msg_rtime
;
217 compat_ulong_t __pad2
;
218 compat_time_t msg_ctime
;
219 compat_ulong_t __pad3
;
220 compat_ulong_t msg_cbytes
;
221 compat_ulong_t msg_qnum
;
222 compat_ulong_t msg_qbytes
;
223 compat_pid_t msg_lspid
;
224 compat_pid_t msg_lrpid
;
225 compat_ulong_t __unused1
;
226 compat_ulong_t __unused2
;
229 struct compat_shmid64_ds
{
230 struct compat_ipc64_perm shm_perm
;
231 compat_size_t shm_segsz
;
232 compat_time_t shm_atime
;
233 compat_ulong_t __pad1
;
234 compat_time_t shm_dtime
;
235 compat_ulong_t __pad2
;
236 compat_time_t shm_ctime
;
237 compat_ulong_t __pad3
;
238 compat_pid_t shm_cpid
;
239 compat_pid_t shm_lpid
;
240 compat_ulong_t shm_nattch
;
241 compat_ulong_t __unused1
;
242 compat_ulong_t __unused2
;
244 #endif /* _ASM_S390X_COMPAT_H */