linux/arch/parisc/include/asm/compat.h
<<
>>
Prefs
   1#ifndef _ASM_PARISC_COMPAT_H
   2#define _ASM_PARISC_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 COMPAT_USER_HZ          100
  11#define COMPAT_UTS_MACHINE      "parisc\0\0"
  12
  13typedef u32     compat_size_t;
  14typedef s32     compat_ssize_t;
  15typedef s32     compat_time_t;
  16typedef s32     compat_clock_t;
  17typedef s32     compat_pid_t;
  18typedef u32     __compat_uid_t;
  19typedef u32     __compat_gid_t;
  20typedef u32     __compat_uid32_t;
  21typedef u32     __compat_gid32_t;
  22typedef u16     compat_mode_t;
  23typedef u32     compat_ino_t;
  24typedef u32     compat_dev_t;
  25typedef s32     compat_off_t;
  26typedef s64     compat_loff_t;
  27typedef u16     compat_nlink_t;
  28typedef u16     compat_ipc_pid_t;
  29typedef s32     compat_daddr_t;
  30typedef u32     compat_caddr_t;
  31typedef s32     compat_key_t;
  32typedef s32     compat_timer_t;
  33
  34typedef s32     compat_int_t;
  35typedef s32     compat_long_t;
  36typedef s64     compat_s64;
  37typedef u32     compat_uint_t;
  38typedef u32     compat_ulong_t;
  39typedef u64     compat_u64;
  40typedef u32     compat_uptr_t;
  41
  42struct compat_timespec {
  43        compat_time_t           tv_sec;
  44        s32                     tv_nsec;
  45};
  46
  47struct compat_timeval {
  48        compat_time_t           tv_sec;
  49        s32                     tv_usec;
  50};
  51
  52struct compat_stat {
  53        compat_dev_t            st_dev; /* dev_t is 32 bits on parisc */
  54        compat_ino_t            st_ino; /* 32 bits */
  55        compat_mode_t           st_mode;        /* 16 bits */
  56        compat_nlink_t          st_nlink;       /* 16 bits */
  57        u16                     st_reserved1;   /* old st_uid */
  58        u16                     st_reserved2;   /* old st_gid */
  59        compat_dev_t            st_rdev;
  60        compat_off_t            st_size;
  61        compat_time_t           st_atime;
  62        u32                     st_atime_nsec;
  63        compat_time_t           st_mtime;
  64        u32                     st_mtime_nsec;
  65        compat_time_t           st_ctime;
  66        u32                     st_ctime_nsec;
  67        s32                     st_blksize;
  68        s32                     st_blocks;
  69        u32                     __unused1;      /* ACL stuff */
  70        compat_dev_t            __unused2;      /* network */
  71        compat_ino_t            __unused3;      /* network */
  72        u32                     __unused4;      /* cnodes */
  73        u16                     __unused5;      /* netsite */
  74        short                   st_fstype;
  75        compat_dev_t            st_realdev;
  76        u16                     st_basemode;
  77        u16                     st_spareshort;
  78        __compat_uid32_t        st_uid;
  79        __compat_gid32_t        st_gid;
  80        u32                     st_spare4[3];
  81};
  82
  83struct compat_flock {
  84        short                   l_type;
  85        short                   l_whence;
  86        compat_off_t            l_start;
  87        compat_off_t            l_len;
  88        compat_pid_t            l_pid;
  89};
  90
  91struct compat_flock64 {
  92        short                   l_type;
  93        short                   l_whence;
  94        compat_loff_t           l_start;
  95        compat_loff_t           l_len;
  96        compat_pid_t            l_pid;
  97};
  98
  99struct compat_statfs {
 100        s32             f_type;
 101        s32             f_bsize;
 102        s32             f_blocks;
 103        s32             f_bfree;
 104        s32             f_bavail;
 105        s32             f_files;
 106        s32             f_ffree;
 107        __kernel_fsid_t f_fsid;
 108        s32             f_namelen;
 109        s32             f_frsize;
 110        s32             f_flags;
 111        s32             f_spare[4];
 112};
 113
 114struct compat_sigcontext {
 115        compat_int_t sc_flags;
 116        compat_int_t sc_gr[32]; /* PSW in sc_gr[0] */
 117        u64 sc_fr[32];
 118        compat_int_t sc_iasq[2];
 119        compat_int_t sc_iaoq[2];
 120        compat_int_t sc_sar; /* cr11 */
 121};
 122
 123#define COMPAT_RLIM_INFINITY 0xffffffff
 124
 125typedef u32             compat_old_sigset_t;    /* at least 32 bits */
 126
 127#define _COMPAT_NSIG            64
 128#define _COMPAT_NSIG_BPW        32
 129
 130typedef u32             compat_sigset_word;
 131
 132typedef union compat_sigval {
 133        compat_int_t    sival_int;
 134        compat_uptr_t   sival_ptr;
 135} compat_sigval_t;
 136
 137typedef struct compat_siginfo {
 138        int si_signo;
 139        int si_errno;
 140        int si_code;
 141
 142        union {
 143                int _pad[128/sizeof(int) - 3];
 144
 145                /* kill() */
 146                struct {
 147                        unsigned int _pid;      /* sender's pid */
 148                        unsigned int _uid;      /* sender's uid */
 149                } _kill;
 150
 151                /* POSIX.1b timers */
 152                struct {
 153                        compat_timer_t _tid;            /* timer id */
 154                        int _overrun;           /* overrun count */
 155                        char _pad[sizeof(unsigned int) - sizeof(int)];
 156                        compat_sigval_t _sigval;        /* same as below */
 157                        int _sys_private;       /* not to be passed to user */
 158                } _timer;
 159
 160                /* POSIX.1b signals */
 161                struct {
 162                        unsigned int _pid;      /* sender's pid */
 163                        unsigned int _uid;      /* sender's uid */
 164                        compat_sigval_t _sigval;
 165                } _rt;
 166
 167                /* SIGCHLD */
 168                struct {
 169                        unsigned int _pid;      /* which child */
 170                        unsigned int _uid;      /* sender's uid */
 171                        int _status;            /* exit code */
 172                        compat_clock_t _utime;
 173                        compat_clock_t _stime;
 174                } _sigchld;
 175
 176                /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
 177                struct {
 178                        unsigned int _addr;     /* faulting insn/memory ref. */
 179                } _sigfault;
 180
 181                /* SIGPOLL */
 182                struct {
 183                        int _band;      /* POLL_IN, POLL_OUT, POLL_MSG */
 184                        int _fd;
 185                } _sigpoll;
 186
 187                /* SIGSYS */
 188                struct {
 189                        compat_uptr_t _call_addr; /* calling user insn */
 190                        int _syscall;   /* triggering system call number */
 191                        compat_uint_t _arch;    /* AUDIT_ARCH_* of syscall */
 192                } _sigsys;
 193        } _sifields;
 194} compat_siginfo_t;
 195
 196#define COMPAT_OFF_T_MAX        0x7fffffff
 197#define COMPAT_LOFF_T_MAX       0x7fffffffffffffffL
 198
 199struct compat_ipc64_perm {
 200        compat_key_t key;
 201        __compat_uid_t uid;
 202        __compat_gid_t gid;
 203        __compat_uid_t cuid;
 204        __compat_gid_t cgid;
 205        unsigned short int __pad1;
 206        compat_mode_t mode;
 207        unsigned short int __pad2;
 208        unsigned short int seq;
 209        unsigned int __pad3;
 210        unsigned long __unused1;        /* yes they really are 64bit pads */
 211        unsigned long __unused2;
 212};
 213
 214struct compat_semid64_ds {
 215        struct compat_ipc64_perm sem_perm;
 216        unsigned int __unused1;
 217        compat_time_t sem_otime;
 218        unsigned int __unused2;
 219        compat_time_t sem_ctime;
 220        compat_ulong_t sem_nsems;
 221        compat_ulong_t __unused3;
 222        compat_ulong_t __unused4;
 223};
 224
 225struct compat_msqid64_ds {
 226        struct compat_ipc64_perm msg_perm;
 227        unsigned int __unused1;
 228        compat_time_t msg_stime;
 229        unsigned int __unused2;
 230        compat_time_t msg_rtime;
 231        unsigned int __unused3;
 232        compat_time_t msg_ctime;
 233        compat_ulong_t msg_cbytes;
 234        compat_ulong_t msg_qnum;
 235        compat_ulong_t msg_qbytes;
 236        compat_pid_t msg_lspid;
 237        compat_pid_t msg_lrpid;
 238        compat_ulong_t __unused4;
 239        compat_ulong_t __unused5;
 240};
 241
 242struct compat_shmid64_ds {
 243        struct compat_ipc64_perm shm_perm;
 244        unsigned int __unused1;
 245        compat_time_t shm_atime;
 246        unsigned int __unused2;
 247        compat_time_t shm_dtime;
 248        unsigned int __unused3;
 249        compat_time_t shm_ctime;
 250        unsigned int __unused4;
 251        compat_size_t shm_segsz;
 252        compat_pid_t shm_cpid;
 253        compat_pid_t shm_lpid;
 254        compat_ulong_t shm_nattch;
 255        compat_ulong_t __unused5;
 256        compat_ulong_t __unused6;
 257};
 258
 259/*
 260 * A pointer passed in from user mode. This should not
 261 * be used for syscall parameters, just declare them
 262 * as pointers because the syscall entry code will have
 263 * appropriately converted them already.
 264 */
 265
 266static inline void __user *compat_ptr(compat_uptr_t uptr)
 267{
 268        return (void __user *)(unsigned long)uptr;
 269}
 270
 271static inline compat_uptr_t ptr_to_compat(void __user *uptr)
 272{
 273        return (u32)(unsigned long)uptr;
 274}
 275
 276static __inline__ void __user *arch_compat_alloc_user_space(long len)
 277{
 278        struct pt_regs *regs = &current->thread.regs;
 279        return (void __user *)regs->gr[30];
 280}
 281
 282static inline int __is_compat_task(struct task_struct *t)
 283{
 284        return test_ti_thread_flag(task_thread_info(t), TIF_32BIT);
 285}
 286
 287static inline int is_compat_task(void)
 288{
 289        return __is_compat_task(current);
 290}
 291
 292#endif /* _ASM_PARISC_COMPAT_H */
 293