]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/s390/include/asm/compat.h
Merge branch 'fix/asoc' into for-linus
[net-next-2.6.git] / arch / s390 / include / asm / compat.h
CommitLineData
1da177e4
LT
1#ifndef _ASM_S390X_COMPAT_H
2#define _ASM_S390X_COMPAT_H
3/*
4 * Architecture specific compatibility types
5 */
6#include <linux/types.h>
7#include <linux/sched.h>
7757591a 8#include <linux/thread_info.h>
1da177e4 9
c1821c2e
GS
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_MCHECK 0x00040000UL
16#define PSW32_MASK_WAIT 0x00020000UL
17#define PSW32_MASK_PSTATE 0x00010000UL
18#define PSW32_MASK_ASC 0x0000C000UL
19#define PSW32_MASK_CC 0x00003000UL
20#define PSW32_MASK_PM 0x00000f00UL
21
22#define PSW32_ADDR_AMODE31 0x80000000UL
23#define PSW32_ADDR_INSN 0x7FFFFFFFUL
24
25#define PSW32_BASE_BITS 0x00080000UL
26
27#define PSW32_ASC_PRIMARY 0x00000000UL
28#define PSW32_ASC_ACCREG 0x00004000UL
29#define PSW32_ASC_SECONDARY 0x00008000UL
30#define PSW32_ASC_HOME 0x0000C000UL
31
32#define PSW32_MASK_MERGE(CURRENT,NEW) \
33 (((CURRENT) & ~(PSW32_MASK_CC|PSW32_MASK_PM)) | \
34 ((NEW) & (PSW32_MASK_CC|PSW32_MASK_PM)))
35
36extern long psw32_user_bits;
37
e28cbf22
CH
38#define COMPAT_USER_HZ 100
39#define COMPAT_UTS_MACHINE "s390\0\0\0\0"
1da177e4
LT
40
41typedef u32 compat_size_t;
42typedef s32 compat_ssize_t;
43typedef s32 compat_time_t;
44typedef s32 compat_clock_t;
45typedef s32 compat_pid_t;
202e5979
SR
46typedef u16 __compat_uid_t;
47typedef u16 __compat_gid_t;
48typedef u32 __compat_uid32_t;
49typedef u32 __compat_gid32_t;
1da177e4
LT
50typedef u16 compat_mode_t;
51typedef u32 compat_ino_t;
52typedef u16 compat_dev_t;
53typedef s32 compat_off_t;
54typedef s64 compat_loff_t;
55typedef u16 compat_nlink_t;
56typedef u16 compat_ipc_pid_t;
57typedef s32 compat_daddr_t;
58typedef u32 compat_caddr_t;
59typedef __kernel_fsid_t compat_fsid_t;
60typedef s32 compat_key_t;
61typedef s32 compat_timer_t;
62
63typedef s32 compat_int_t;
64typedef s32 compat_long_t;
4b777587 65typedef s64 compat_s64;
1da177e4
LT
66typedef u32 compat_uint_t;
67typedef u32 compat_ulong_t;
4b777587 68typedef u64 compat_u64;
1da177e4
LT
69
70struct compat_timespec {
71 compat_time_t tv_sec;
72 s32 tv_nsec;
73};
74
75struct compat_timeval {
76 compat_time_t tv_sec;
77 s32 tv_usec;
78};
79
80struct compat_stat {
81 compat_dev_t st_dev;
82 u16 __pad1;
83 compat_ino_t st_ino;
84 compat_mode_t st_mode;
85 compat_nlink_t st_nlink;
202e5979
SR
86 __compat_uid_t st_uid;
87 __compat_gid_t st_gid;
1da177e4
LT
88 compat_dev_t st_rdev;
89 u16 __pad2;
90 u32 st_size;
91 u32 st_blksize;
92 u32 st_blocks;
93 u32 st_atime;
94 u32 st_atime_nsec;
95 u32 st_mtime;
96 u32 st_mtime_nsec;
97 u32 st_ctime;
98 u32 st_ctime_nsec;
99 u32 __unused4;
100 u32 __unused5;
101};
102
103struct compat_flock {
104 short l_type;
105 short l_whence;
106 compat_off_t l_start;
107 compat_off_t l_len;
108 compat_pid_t l_pid;
109};
110
111#define F_GETLK64 12
112#define F_SETLK64 13
113#define F_SETLKW64 14
114
115struct compat_flock64 {
116 short l_type;
117 short l_whence;
118 compat_loff_t l_start;
119 compat_loff_t l_len;
120 compat_pid_t l_pid;
121};
122
123struct compat_statfs {
124 s32 f_type;
125 s32 f_bsize;
126 s32 f_blocks;
127 s32 f_bfree;
128 s32 f_bavail;
129 s32 f_files;
130 s32 f_ffree;
131 compat_fsid_t f_fsid;
132 s32 f_namelen;
133 s32 f_frsize;
134 s32 f_spare[6];
135};
136
137#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff
138#define COMPAT_RLIM_INFINITY 0xffffffff
139
140typedef u32 compat_old_sigset_t; /* at least 32 bits */
141
142#define _COMPAT_NSIG 64
143#define _COMPAT_NSIG_BPW 32
144
145typedef u32 compat_sigset_word;
146
147#define COMPAT_OFF_T_MAX 0x7fffffff
148#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
149
150/*
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
8b3de0df 154 * appropriately converted them already.
1da177e4
LT
155 */
156typedef u32 compat_uptr_t;
157
158static inline void __user *compat_ptr(compat_uptr_t uptr)
159{
160 return (void __user *)(unsigned long)(uptr & 0x7fffffffUL);
161}
162
f267fa9f
IM
163static inline compat_uptr_t ptr_to_compat(void __user *uptr)
164{
165 return (u32)(unsigned long)uptr;
166}
167
7757591a
HC
168#ifdef CONFIG_COMPAT
169
170static inline int is_compat_task(void)
171{
172 return test_thread_flag(TIF_31BIT);
173}
174
175#else
176
177static inline int is_compat_task(void)
178{
179 return 0;
180}
181
182#endif
183
c41d68a5 184static inline void __user *arch_compat_alloc_user_space(long len)
1da177e4
LT
185{
186 unsigned long stack;
187
188 stack = KSTK_ESP(current);
7757591a 189 if (is_compat_task())
1da177e4
LT
190 stack &= 0x7fffffffUL;
191 return (void __user *) (stack - len);
192}
193
194struct compat_ipc64_perm {
195 compat_key_t key;
202e5979
SR
196 __compat_uid32_t uid;
197 __compat_gid32_t gid;
198 __compat_uid32_t cuid;
199 __compat_gid32_t cgid;
1da177e4
LT
200 compat_mode_t mode;
201 unsigned short __pad1;
202 unsigned short seq;
203 unsigned short __pad2;
204 unsigned int __unused1;
205 unsigned int __unused2;
206};
207
208struct compat_semid64_ds {
209 struct compat_ipc64_perm sem_perm;
210 compat_time_t sem_otime;
211 compat_ulong_t __pad1;
212 compat_time_t sem_ctime;
213 compat_ulong_t __pad2;
214 compat_ulong_t sem_nsems;
215 compat_ulong_t __unused1;
216 compat_ulong_t __unused2;
217};
218
219struct compat_msqid64_ds {
220 struct compat_ipc64_perm msg_perm;
221 compat_time_t msg_stime;
222 compat_ulong_t __pad1;
223 compat_time_t msg_rtime;
224 compat_ulong_t __pad2;
225 compat_time_t msg_ctime;
226 compat_ulong_t __pad3;
227 compat_ulong_t msg_cbytes;
228 compat_ulong_t msg_qnum;
229 compat_ulong_t msg_qbytes;
230 compat_pid_t msg_lspid;
231 compat_pid_t msg_lrpid;
232 compat_ulong_t __unused1;
233 compat_ulong_t __unused2;
234};
235
236struct compat_shmid64_ds {
237 struct compat_ipc64_perm shm_perm;
238 compat_size_t shm_segsz;
239 compat_time_t shm_atime;
240 compat_ulong_t __pad1;
241 compat_time_t shm_dtime;
242 compat_ulong_t __pad2;
243 compat_time_t shm_ctime;
244 compat_ulong_t __pad3;
245 compat_pid_t shm_cpid;
246 compat_pid_t shm_lpid;
247 compat_ulong_t shm_nattch;
248 compat_ulong_t __unused1;
249 compat_ulong_t __unused2;
250};
251#endif /* _ASM_S390X_COMPAT_H */