linux/arch/s390/include/asm/compat.h
<<
>>
Prefs
   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_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
  38#define COMPAT_USER_HZ  100
  39
  40typedef u32             compat_size_t;
  41typedef s32             compat_ssize_t;
  42typedef s32             compat_time_t;
  43typedef s32             compat_clock_t;
  44typedef s32             compat_pid_t;
  45typedef u16             __compat_uid_t;
  46typedef u16             __compat_gid_t;
  47typedef u32             __compat_uid32_t;
  48typedef u32             __compat_gid32_t;
  49typedef u16             compat_mode_t;
  50typedef u32             compat_ino_t;
  51typedef u16             compat_dev_t;
  52typedef s32             compat_off_t;
  53typedef s64             compat_loff_t;
  54typedef u16             compat_nlink_t;
  55typedef u16             compat_ipc_pid_t;
  56typedef s32             compat_daddr_t;
  57typedef u32             compat_caddr_t;
  58typedef __kernel_fsid_t compat_fsid_t;
  59typedef s32             compat_key_t;
  60typedef s32             compat_timer_t;
  61
  62typedef s32             compat_int_t;
  63typedef s32             compat_long_t;
  64typedef s64             compat_s64;
  65typedef u32             compat_uint_t;
  66typedef u32             compat_ulong_t;
  67typedef u64             compat_u64;
  68
  69struct compat_timespec {
  70        compat_time_t   tv_sec;
  71        s32             tv_nsec;
  72};
  73
  74struct compat_timeval {
  75        compat_time_t   tv_sec;
  76        s32             tv_usec;
  77};
  78
  79struct compat_stat {
  80        compat_dev_t    st_dev;
  81        u16             __pad1;
  82        compat_ino_t    st_ino;
  83        compat_mode_t   st_mode;
  84        compat_nlink_t  st_nlink;
  85        __compat_uid_t  st_uid;
  86        __compat_gid_t  st_gid;
  87        compat_dev_t    st_rdev;
  88        u16             __pad2;
  89        u32             st_size;
  90        u32             st_blksize;
  91        u32             st_blocks;
  92        u32             st_atime;
  93        u32             st_atime_nsec;
  94        u32             st_mtime;
  95        u32             st_mtime_nsec;
  96        u32             st_ctime;
  97        u32             st_ctime_nsec;
  98        u32             __unused4;
  99        u32             __unused5;
 100};
 101
 102struct compat_flock {
 103        short           l_type;
 104        short           l_whence;
 105        compat_off_t    l_start;
 106        compat_off_t    l_len;
 107        compat_pid_t    l_pid;
 108};
 109
 110#define F_GETLK64       12
 111#define F_SETLK64       13
 112#define F_SETLKW64      14    
 113
 114struct compat_flock64 {
 115        short           l_type;
 116        short           l_whence;
 117        compat_loff_t   l_start;
 118        compat_loff_t   l_len;
 119        compat_pid_t    l_pid;
 120};
 121
 122struct compat_statfs {
 123        s32             f_type;
 124        s32             f_bsize;
 125        s32             f_blocks;
 126        s32             f_bfree;
 127        s32             f_bavail;
 128        s32             f_files;
 129        s32             f_ffree;
 130        compat_fsid_t   f_fsid;
 131        s32             f_namelen;
 132        s32             f_frsize;
 133        s32             f_spare[6];
 134};
 135
 136#define COMPAT_RLIM_OLD_INFINITY        0x7fffffff
 137#define COMPAT_RLIM_INFINITY            0xffffffff
 138
 139typedef u32             compat_old_sigset_t;    /* at least 32 bits */
 140
 141#define _COMPAT_NSIG            64
 142#define _COMPAT_NSIG_BPW        32
 143
 144typedef u32             compat_sigset_word;
 145
 146#define COMPAT_OFF_T_MAX        0x7fffffff
 147#define COMPAT_LOFF_T_MAX       0x7fffffffffffffffL
 148
 149/*
 150 * A pointer passed in from user mode. This should not
 151 * be used for syscall parameters, just declare them
 152 * as pointers because the syscall entry code will have
 153 * appropriately converted them already.
 154 */
 155typedef u32             compat_uptr_t;
 156
 157static inline void __user *compat_ptr(compat_uptr_t uptr)
 158{
 159        return (void __user *)(unsigned long)(uptr & 0x7fffffffUL);
 160}
 161
 162static inline compat_uptr_t ptr_to_compat(void __user *uptr)
 163{
 164        return (u32)(unsigned long)uptr;
 165}
 166
 167#ifdef CONFIG_COMPAT
 168
 169static inline int is_compat_task(void)
 170{
 171        return test_thread_flag(TIF_31BIT);
 172}
 173
 174#else
 175
 176static inline int is_compat_task(void)
 177{
 178        return 0;
 179}
 180
 181#endif
 182
 183static inline void __user *compat_alloc_user_space(long len)
 184{
 185        unsigned long stack;
 186
 187        stack = KSTK_ESP(current);
 188        if (is_compat_task())
 189                stack &= 0x7fffffffUL;
 190        return (void __user *) (stack - len);
 191}
 192
 193struct compat_ipc64_perm {
 194        compat_key_t key;
 195        __compat_uid32_t uid;
 196        __compat_gid32_t gid;
 197        __compat_uid32_t cuid;
 198        __compat_gid32_t cgid;
 199        compat_mode_t mode;
 200        unsigned short __pad1;
 201        unsigned short seq;
 202        unsigned short __pad2;
 203        unsigned int __unused1;
 204        unsigned int __unused2;
 205};
 206
 207struct compat_semid64_ds {
 208        struct compat_ipc64_perm sem_perm;
 209        compat_time_t  sem_otime;
 210        compat_ulong_t __pad1;
 211        compat_time_t  sem_ctime;
 212        compat_ulong_t __pad2;
 213        compat_ulong_t sem_nsems;
 214        compat_ulong_t __unused1;
 215        compat_ulong_t __unused2;
 216};
 217
 218struct compat_msqid64_ds {
 219        struct compat_ipc64_perm msg_perm;
 220        compat_time_t   msg_stime;
 221        compat_ulong_t __pad1;
 222        compat_time_t   msg_rtime;
 223        compat_ulong_t __pad2;
 224        compat_time_t   msg_ctime;
 225        compat_ulong_t __pad3;
 226        compat_ulong_t msg_cbytes;
 227        compat_ulong_t msg_qnum;
 228        compat_ulong_t msg_qbytes;
 229        compat_pid_t   msg_lspid;
 230        compat_pid_t   msg_lrpid;
 231        compat_ulong_t __unused1;
 232        compat_ulong_t __unused2;
 233};
 234
 235struct compat_shmid64_ds {
 236        struct compat_ipc64_perm shm_perm;
 237        compat_size_t  shm_segsz;
 238        compat_time_t  shm_atime;
 239        compat_ulong_t __pad1;
 240        compat_time_t  shm_dtime;
 241        compat_ulong_t __pad2;
 242        compat_time_t  shm_ctime;
 243        compat_ulong_t __pad3;
 244        compat_pid_t   shm_cpid;
 245        compat_pid_t   shm_lpid;
 246        compat_ulong_t shm_nattch;
 247        compat_ulong_t __unused1;
 248        compat_ulong_t __unused2;
 249};
 250#endif /* _ASM_S390X_COMPAT_H */
 251