Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
compat.h
Go to the documentation of this file.
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>
8 #include <linux/thread_info.h>
9 
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
22 
23 #define PSW32_MASK_USER 0x0000FF00UL
24 
25 #define PSW32_ADDR_AMODE 0x80000000UL
26 #define PSW32_ADDR_INSN 0x7FFFFFFFUL
27 
28 #define PSW32_DEFAULT_KEY (((u32) PAGE_DEFAULT_ACC) << 20)
29 
30 #define PSW32_ASC_PRIMARY 0x00000000UL
31 #define PSW32_ASC_ACCREG 0x00004000UL
32 #define PSW32_ASC_SECONDARY 0x00008000UL
33 #define PSW32_ASC_HOME 0x0000C000UL
34 
35 extern u32 psw32_user_bits;
36 
37 #define COMPAT_USER_HZ 100
38 #define COMPAT_UTS_MACHINE "s390\0\0\0\0"
39 
44 typedef s32 compat_pid_t;
50 typedef u32 compat_ino_t;
51 typedef u16 compat_dev_t;
52 typedef s32 compat_off_t;
59 typedef s32 compat_key_t;
61 
62 typedef s32 compat_int_t;
64 typedef s64 compat_s64;
67 typedef u64 compat_u64;
69 
70 struct compat_timespec {
72  s32 tv_nsec;
73 };
74 
75 struct compat_timeval {
77  s32 tv_usec;
78 };
79 
80 struct compat_stat {
99  u32 __unused4;
101 };
102 
103 struct compat_flock {
104  short l_type;
105  short l_whence;
109 };
110 
111 #define F_GETLK64 12
112 #define F_SETLK64 13
113 #define F_SETLKW64 14
114 
115 struct compat_flock64 {
116  short l_type;
117  short l_whence;
121 };
122 
123 struct 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;
132  s32 f_namelen;
133  s32 f_frsize;
134  s32 f_flags;
135  s32 f_spare[5];
136 };
137 
138 #define COMPAT_RLIM_OLD_INFINITY 0x7fffffff
139 #define COMPAT_RLIM_INFINITY 0xffffffff
140 
141 typedef u32 compat_old_sigset_t; /* at least 32 bits */
142 
143 #define _COMPAT_NSIG 64
144 #define _COMPAT_NSIG_BPW 32
145 
147 
148 typedef union compat_sigval {
152 
153 typedef struct compat_siginfo {
154  int si_signo;
155  int si_errno;
156  int si_code;
157 
158  union {
159  int _pad[128/sizeof(int) - 3];
160 
161  /* kill() */
162  struct {
163  pid_t _pid; /* sender's pid */
164  uid_t _uid; /* sender's uid */
165  } _kill;
166 
167  /* POSIX.1b timers */
168  struct {
169  compat_timer_t _tid; /* timer id */
170  int _overrun; /* overrun count */
171  compat_sigval_t _sigval; /* same as below */
172  int _sys_private; /* not to be passed to user */
173  } _timer;
174 
175  /* POSIX.1b signals */
176  struct {
177  pid_t _pid; /* sender's pid */
178  uid_t _uid; /* sender's uid */
180  } _rt;
181 
182  /* SIGCHLD */
183  struct {
184  pid_t _pid; /* which child */
185  uid_t _uid; /* sender's uid */
186  int _status;/* exit code */
189  } _sigchld;
190 
191  /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
192  struct {
193  __u32 _addr; /* faulting insn/memory ref. - pointer */
194  } _sigfault;
195 
196  /* SIGPOLL */
197  struct {
198  int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
199  int _fd;
200  } _sigpoll;
201  } _sifields;
203 
204 /*
205  * How these fields are to be accessed.
206  */
207 #define si_pid _sifields._kill._pid
208 #define si_uid _sifields._kill._uid
209 #define si_status _sifields._sigchld._status
210 #define si_utime _sifields._sigchld._utime
211 #define si_stime _sifields._sigchld._stime
212 #define si_value _sifields._rt._sigval
213 #define si_int _sifields._rt._sigval.sival_int
214 #define si_ptr _sifields._rt._sigval.sival_ptr
215 #define si_addr _sifields._sigfault._addr
216 #define si_band _sifields._sigpoll._band
217 #define si_fd _sifields._sigpoll._fd
218 #define si_tid _sifields._timer._tid
219 #define si_overrun _sifields._timer._overrun
220 
221 #define COMPAT_OFF_T_MAX 0x7fffffff
222 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
223 
224 /*
225  * A pointer passed in from user mode. This should not
226  * be used for syscall parameters, just declare them
227  * as pointers because the syscall entry code will have
228  * appropriately converted them already.
229  */
230 
231 static inline void __user *compat_ptr(compat_uptr_t uptr)
232 {
233  return (void __user *)(unsigned long)(uptr & 0x7fffffffUL);
234 }
235 
236 static inline compat_uptr_t ptr_to_compat(void __user *uptr)
237 {
238  return (u32)(unsigned long)uptr;
239 }
240 
241 #ifdef CONFIG_COMPAT
242 
243 static inline int is_compat_task(void)
244 {
245  return is_32bit_task();
246 }
247 
248 #endif
249 
250 static inline void __user *arch_compat_alloc_user_space(long len)
251 {
252  unsigned long stack;
253 
254  stack = KSTK_ESP(current);
255  if (is_compat_task())
256  stack &= 0x7fffffffUL;
257  return (void __user *) (stack - len);
258 }
259 
260 struct compat_ipc64_perm {
267  unsigned short __pad1;
268  unsigned short seq;
269  unsigned short __pad2;
270  unsigned int __unused1;
271  unsigned int __unused2;
272 };
273 
274 struct compat_semid64_ds {
275  struct compat_ipc64_perm sem_perm;
283 };
284 
285 struct compat_msqid64_ds {
286  struct compat_ipc64_perm msg_perm;
300 };
301 
302 struct compat_shmid64_ds {
303  struct compat_ipc64_perm shm_perm;
316 };
317 #endif /* _ASM_S390X_COMPAT_H */