linux/arch/parisc/include/asm/compat.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2#ifndef _ASM_PARISC_COMPAT_H
   3#define _ASM_PARISC_COMPAT_H
   4/*
   5 * Architecture specific compatibility types
   6 */
   7#include <linux/types.h>
   8#include <linux/sched.h>
   9#include <linux/thread_info.h>
  10
  11#define COMPAT_USER_HZ          100
  12#define COMPAT_UTS_MACHINE      "parisc\0\0"
  13
  14typedef u32     compat_size_t;
  15typedef s32     compat_ssize_t;
  16typedef s32     compat_time_t;
  17typedef s32     compat_clock_t;
  18typedef s32     compat_pid_t;
  19typedef u32     __compat_uid_t;
  20typedef u32     __compat_gid_t;
  21typedef u32     __compat_uid32_t;
  22typedef u32     __compat_gid32_t;
  23typedef u16     compat_mode_t;
  24typedef u32     compat_ino_t;
  25typedef u32     compat_dev_t;
  26typedef s32     compat_off_t;
  27typedef s64     compat_loff_t;
  28typedef u16     compat_nlink_t;
  29typedef u16     compat_ipc_pid_t;
  30typedef s32     compat_daddr_t;
  31typedef u32     compat_caddr_t;
  32typedef s32     compat_key_t;
  33typedef s32     compat_timer_t;
  34
  35typedef s32     compat_int_t;
  36typedef s32     compat_long_t;
  37typedef s64     compat_s64;
  38typedef u32     compat_uint_t;
  39typedef u32     compat_ulong_t;
  40typedef u64     compat_u64;
  41typedef u32     compat_uptr_t;
  42
  43struct compat_timespec {
  44        compat_time_t           tv_sec;
  45        s32                     tv_nsec;
  46};
  47
  48struct compat_timeval {
  49        compat_time_t           tv_sec;
  50        s32                     tv_usec;
  51};
  52
  53struct compat_stat {
  54        compat_dev_t            st_dev; /* dev_t is 32 bits on parisc */
  55        compat_ino_t            st_ino; /* 32 bits */
  56        compat_mode_t           st_mode;        /* 16 bits */
  57        compat_nlink_t          st_nlink;       /* 16 bits */
  58        u16                     st_reserved1;   /* old st_uid */
  59        u16                     st_reserved2;   /* old st_gid */
  60        compat_dev_t            st_rdev;
  61        compat_off_t            st_size;
  62        compat_time_t           st_atime;
  63        u32                     st_atime_nsec;
  64        compat_time_t           st_mtime;
  65        u32                     st_mtime_nsec;
  66        compat_time_t           st_ctime;
  67        u32                     st_ctime_nsec;
  68        s32                     st_blksize;
  69        s32                     st_blocks;
  70        u32                     __unused1;      /* ACL stuff */
  71        compat_dev_t            __unused2;      /* network */
  72        compat_ino_t            __unused3;      /* network */
  73        u32                     __unused4;      /* cnodes */
  74        u16                     __unused5;      /* netsite */
  75        short                   st_fstype;
  76        compat_dev_t            st_realdev;
  77        u16                     st_basemode;
  78        u16                     st_spareshort;
  79        __compat_uid32_t        st_uid;
  80        __compat_gid32_t        st_gid;
  81        u32                     st_spare4[3];
  82};
  83
  84struct compat_flock {
  85        short                   l_type;
  86        short                   l_whence;
  87        compat_off_t            l_start;
  88        compat_off_t            l_len;
  89        compat_pid_t            l_pid;
  90};
  91
  92struct compat_flock64 {
  93        short                   l_type;
  94        short                   l_whence;
  95        compat_loff_t           l_start;
  96        compat_loff_t           l_len;
  97        compat_pid_t            l_pid;
  98};
  99
 100struct compat_statfs {
 101        s32             f_type;
 102        s32             f_bsize;
 103        s32             f_blocks;
 104        s32             f_bfree;
 105        s32             f_bavail;
 106        s32             f_files;
 107        s32             f_ffree;
 108        __kernel_fsid_t f_fsid;
 109        s32             f_namelen;
 110        s32             f_frsize;
 111        s32             f_flags;
 112        s32             f_spare[4];
 113};
 114
 115struct compat_sigcontext {
 116        compat_int_t sc_flags;
 117        compat_int_t sc_gr[32]; /* PSW in sc_gr[0] */
 118        u64 sc_fr[32];
 119        compat_int_t sc_iasq[2];
 120        compat_int_t sc_iaoq[2];
 121        compat_int_t sc_sar; /* cr11 */
 122};
 123
 124#define COMPAT_RLIM_INFINITY 0xffffffff
 125
 126typedef u32             compat_old_sigset_t;    /* at least 32 bits */
 127
 128#define _COMPAT_NSIG            64
 129#define _COMPAT_NSIG_BPW        32
 130
 131typedef u32             compat_sigset_word;
 132
 133#define COMPAT_OFF_T_MAX        0x7fffffff
 134
 135struct compat_ipc64_perm {
 136        compat_key_t key;
 137        __compat_uid_t uid;
 138        __compat_gid_t gid;
 139        __compat_uid_t cuid;
 140        __compat_gid_t cgid;
 141        unsigned short int __pad1;
 142        compat_mode_t mode;
 143        unsigned short int __pad2;
 144        unsigned short int seq;
 145        unsigned int __pad3;
 146        unsigned long __unused1;        /* yes they really are 64bit pads */
 147        unsigned long __unused2;
 148};
 149
 150struct compat_semid64_ds {
 151        struct compat_ipc64_perm sem_perm;
 152        unsigned int __unused1;
 153        compat_time_t sem_otime;
 154        unsigned int __unused2;
 155        compat_time_t sem_ctime;
 156        compat_ulong_t sem_nsems;
 157        compat_ulong_t __unused3;
 158        compat_ulong_t __unused4;
 159};
 160
 161struct compat_msqid64_ds {
 162        struct compat_ipc64_perm msg_perm;
 163        unsigned int __unused1;
 164        compat_time_t msg_stime;
 165        unsigned int __unused2;
 166        compat_time_t msg_rtime;
 167        unsigned int __unused3;
 168        compat_time_t msg_ctime;
 169        compat_ulong_t msg_cbytes;
 170        compat_ulong_t msg_qnum;
 171        compat_ulong_t msg_qbytes;
 172        compat_pid_t msg_lspid;
 173        compat_pid_t msg_lrpid;
 174        compat_ulong_t __unused4;
 175        compat_ulong_t __unused5;
 176};
 177
 178struct compat_shmid64_ds {
 179        struct compat_ipc64_perm shm_perm;
 180        unsigned int __unused1;
 181        compat_time_t shm_atime;
 182        unsigned int __unused2;
 183        compat_time_t shm_dtime;
 184        unsigned int __unused3;
 185        compat_time_t shm_ctime;
 186        unsigned int __unused4;
 187        compat_size_t shm_segsz;
 188        compat_pid_t shm_cpid;
 189        compat_pid_t shm_lpid;
 190        compat_ulong_t shm_nattch;
 191        compat_ulong_t __unused5;
 192        compat_ulong_t __unused6;
 193};
 194
 195/*
 196 * A pointer passed in from user mode. This should not
 197 * be used for syscall parameters, just declare them
 198 * as pointers because the syscall entry code will have
 199 * appropriately converted them already.
 200 */
 201
 202static inline void __user *compat_ptr(compat_uptr_t uptr)
 203{
 204        return (void __user *)(unsigned long)uptr;
 205}
 206
 207static inline compat_uptr_t ptr_to_compat(void __user *uptr)
 208{
 209        return (u32)(unsigned long)uptr;
 210}
 211
 212static __inline__ void __user *arch_compat_alloc_user_space(long len)
 213{
 214        struct pt_regs *regs = &current->thread.regs;
 215        return (void __user *)regs->gr[30];
 216}
 217
 218static inline int __is_compat_task(struct task_struct *t)
 219{
 220        return test_ti_thread_flag(task_thread_info(t), TIF_32BIT);
 221}
 222
 223static inline int is_compat_task(void)
 224{
 225        return __is_compat_task(current);
 226}
 227
 228#endif /* _ASM_PARISC_COMPAT_H */
 229