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 __TYPE_IS_PTR(t) (!__builtin_types_compatible_p(typeof(0?(t)0:0ULL), u64))
12 #define __SC_DELOUSE(t,v) ({ \
13 BUILD_BUG_ON(sizeof(t) > 4 && !__TYPE_IS_PTR(t)); \
14 (t)(__TYPE_IS_PTR(t) ? ((v) & 0x7fffffff) : (v)); \
17 #define PSW32_MASK_PER 0x40000000UL
18 #define PSW32_MASK_DAT 0x04000000UL
19 #define PSW32_MASK_IO 0x02000000UL
20 #define PSW32_MASK_EXT 0x01000000UL
21 #define PSW32_MASK_KEY 0x00F00000UL
22 #define PSW32_MASK_BASE 0x00080000UL /* Always one */
23 #define PSW32_MASK_MCHECK 0x00040000UL
24 #define PSW32_MASK_WAIT 0x00020000UL
25 #define PSW32_MASK_PSTATE 0x00010000UL
26 #define PSW32_MASK_ASC 0x0000C000UL
27 #define PSW32_MASK_CC 0x00003000UL
28 #define PSW32_MASK_PM 0x00000f00UL
29 #define PSW32_MASK_RI 0x00000080UL
31 #define PSW32_MASK_USER 0x0000FF00UL
33 #define PSW32_ADDR_AMODE 0x80000000UL
34 #define PSW32_ADDR_INSN 0x7FFFFFFFUL
36 #define PSW32_DEFAULT_KEY (((u32) PAGE_DEFAULT_ACC) << 20)
38 #define PSW32_ASC_PRIMARY 0x00000000UL
39 #define PSW32_ASC_ACCREG 0x00004000UL
40 #define PSW32_ASC_SECONDARY 0x00008000UL
41 #define PSW32_ASC_HOME 0x0000C000UL
43 #define PSW32_USER_BITS (PSW32_MASK_DAT | PSW32_MASK_IO | PSW32_MASK_EXT | \
44 PSW32_DEFAULT_KEY | PSW32_MASK_BASE | \
45 PSW32_MASK_MCHECK | PSW32_MASK_PSTATE | \
48 #define COMPAT_USER_HZ 100
49 #define COMPAT_UTS_MACHINE "s390\0\0\0\0"
51 typedef u32 compat_size_t
;
52 typedef s32 compat_ssize_t
;
53 typedef s32 compat_time_t
;
54 typedef s32 compat_clock_t
;
55 typedef s32 compat_pid_t
;
56 typedef u16 __compat_uid_t
;
57 typedef u16 __compat_gid_t
;
58 typedef u32 __compat_uid32_t
;
59 typedef u32 __compat_gid32_t
;
60 typedef u16 compat_mode_t
;
61 typedef u32 compat_ino_t
;
62 typedef u16 compat_dev_t
;
63 typedef s32 compat_off_t
;
64 typedef s64 compat_loff_t
;
65 typedef u16 compat_nlink_t
;
66 typedef u16 compat_ipc_pid_t
;
67 typedef s32 compat_daddr_t
;
68 typedef u32 compat_caddr_t
;
69 typedef __kernel_fsid_t compat_fsid_t
;
70 typedef s32 compat_key_t
;
71 typedef s32 compat_timer_t
;
73 typedef s32 compat_int_t
;
74 typedef s32 compat_long_t
;
75 typedef s64 compat_s64
;
76 typedef u32 compat_uint_t
;
77 typedef u32 compat_ulong_t
;
78 typedef u64 compat_u64
;
79 typedef u32 compat_uptr_t
;
84 } __aligned(8) psw_compat_t
;
94 u32 gprs_high
[NUM_GPRS
];
95 } s390_compat_regs_high
;
97 struct compat_timespec
{
102 struct compat_timeval
{
103 compat_time_t tv_sec
;
111 compat_mode_t st_mode
;
112 compat_nlink_t st_nlink
;
113 __compat_uid_t st_uid
;
114 __compat_gid_t st_gid
;
115 compat_dev_t st_rdev
;
130 struct compat_flock
{
133 compat_off_t l_start
;
140 #define F_SETLKW64 14
142 struct compat_flock64
{
145 compat_loff_t l_start
;
150 struct compat_statfs
{
158 compat_fsid_t f_fsid
;
165 struct compat_statfs64
{
173 compat_fsid_t f_fsid
;
180 #define COMPAT_RLIM_OLD_INFINITY 0x7fffffff
181 #define COMPAT_RLIM_INFINITY 0xffffffff
183 typedef u32 compat_old_sigset_t
; /* at least 32 bits */
185 #define _COMPAT_NSIG 64
186 #define _COMPAT_NSIG_BPW 32
188 typedef u32 compat_sigset_word
;
190 typedef union compat_sigval
{
191 compat_int_t sival_int
;
192 compat_uptr_t sival_ptr
;
195 typedef struct compat_siginfo
{
201 int _pad
[128/sizeof(int) - 3];
205 pid_t _pid
; /* sender's pid */
206 uid_t _uid
; /* sender's uid */
209 /* POSIX.1b timers */
211 compat_timer_t _tid
; /* timer id */
212 int _overrun
; /* overrun count */
213 compat_sigval_t _sigval
; /* same as below */
214 int _sys_private
; /* not to be passed to user */
217 /* POSIX.1b signals */
219 pid_t _pid
; /* sender's pid */
220 uid_t _uid
; /* sender's uid */
221 compat_sigval_t _sigval
;
226 pid_t _pid
; /* which child */
227 uid_t _uid
; /* sender's uid */
228 int _status
;/* exit code */
229 compat_clock_t _utime
;
230 compat_clock_t _stime
;
233 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
235 __u32 _addr
; /* faulting insn/memory ref. - pointer */
240 int _band
; /* POLL_IN, POLL_OUT, POLL_MSG */
247 * How these fields are to be accessed.
249 #define si_pid _sifields._kill._pid
250 #define si_uid _sifields._kill._uid
251 #define si_status _sifields._sigchld._status
252 #define si_utime _sifields._sigchld._utime
253 #define si_stime _sifields._sigchld._stime
254 #define si_value _sifields._rt._sigval
255 #define si_int _sifields._rt._sigval.sival_int
256 #define si_ptr _sifields._rt._sigval.sival_ptr
257 #define si_addr _sifields._sigfault._addr
258 #define si_band _sifields._sigpoll._band
259 #define si_fd _sifields._sigpoll._fd
260 #define si_tid _sifields._timer._tid
261 #define si_overrun _sifields._timer._overrun
263 #define COMPAT_OFF_T_MAX 0x7fffffff
264 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
267 * A pointer passed in from user mode. This should not
268 * be used for syscall parameters, just declare them
269 * as pointers because the syscall entry code will have
270 * appropriately converted them already.
273 static inline void __user
*compat_ptr(compat_uptr_t uptr
)
275 return (void __user
*)(unsigned long)(uptr
& 0x7fffffffUL
);
278 static inline compat_uptr_t
ptr_to_compat(void __user
*uptr
)
280 return (u32
)(unsigned long)uptr
;
285 static inline int is_compat_task(void)
287 return is_32bit_task();
290 static inline void __user
*arch_compat_alloc_user_space(long len
)
294 stack
= KSTK_ESP(current
);
295 if (is_compat_task())
296 stack
&= 0x7fffffffUL
;
297 return (void __user
*) (stack
- len
);
302 struct compat_ipc64_perm
{
304 __compat_uid32_t uid
;
305 __compat_gid32_t gid
;
306 __compat_uid32_t cuid
;
307 __compat_gid32_t cgid
;
309 unsigned short __pad1
;
311 unsigned short __pad2
;
312 unsigned int __unused1
;
313 unsigned int __unused2
;
316 struct compat_semid64_ds
{
317 struct compat_ipc64_perm sem_perm
;
318 compat_time_t sem_otime
;
319 compat_ulong_t __pad1
;
320 compat_time_t sem_ctime
;
321 compat_ulong_t __pad2
;
322 compat_ulong_t sem_nsems
;
323 compat_ulong_t __unused1
;
324 compat_ulong_t __unused2
;
327 struct compat_msqid64_ds
{
328 struct compat_ipc64_perm msg_perm
;
329 compat_time_t msg_stime
;
330 compat_ulong_t __pad1
;
331 compat_time_t msg_rtime
;
332 compat_ulong_t __pad2
;
333 compat_time_t msg_ctime
;
334 compat_ulong_t __pad3
;
335 compat_ulong_t msg_cbytes
;
336 compat_ulong_t msg_qnum
;
337 compat_ulong_t msg_qbytes
;
338 compat_pid_t msg_lspid
;
339 compat_pid_t msg_lrpid
;
340 compat_ulong_t __unused1
;
341 compat_ulong_t __unused2
;
344 struct compat_shmid64_ds
{
345 struct compat_ipc64_perm shm_perm
;
346 compat_size_t shm_segsz
;
347 compat_time_t shm_atime
;
348 compat_ulong_t __pad1
;
349 compat_time_t shm_dtime
;
350 compat_ulong_t __pad2
;
351 compat_time_t shm_ctime
;
352 compat_ulong_t __pad3
;
353 compat_pid_t shm_cpid
;
354 compat_pid_t shm_lpid
;
355 compat_ulong_t shm_nattch
;
356 compat_ulong_t __unused1
;
357 compat_ulong_t __unused2
;
359 #endif /* _ASM_S390X_COMPAT_H */