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 13 typedef u32 compat_size_t; 14 typedef s32 compat_ssize_t; 15 typedef s32 compat_time_t; 16 typedef s32 compat_clock_t; 17 typedef s32 compat_pid_t; 18 typedef u32 __compat_uid_t; 19 typedef u32 __compat_gid_t; 20 typedef u32 __compat_uid32_t; 21 typedef u32 __compat_gid32_t; 22 typedef u16 compat_mode_t; 23 typedef u32 compat_ino_t; 24 typedef u32 compat_dev_t; 25 typedef s32 compat_off_t; 26 typedef s64 compat_loff_t; 27 typedef u16 compat_nlink_t; 28 typedef u16 compat_ipc_pid_t; 29 typedef s32 compat_daddr_t; 30 typedef u32 compat_caddr_t; 31 typedef s32 compat_timer_t; 32 33 typedef s32 compat_int_t; 34 typedef s32 compat_long_t; 35 typedef s64 compat_s64; 36 typedef u32 compat_uint_t; 37 typedef u32 compat_ulong_t; 38 typedef u64 compat_u64; 39 typedef u32 compat_uptr_t; 40 41 struct compat_timespec { 42 compat_time_t tv_sec; 43 s32 tv_nsec; 44 }; 45 46 struct compat_timeval { 47 compat_time_t tv_sec; 48 s32 tv_usec; 49 }; 50 51 struct compat_stat { 52 compat_dev_t st_dev; /* dev_t is 32 bits on parisc */ 53 compat_ino_t st_ino; /* 32 bits */ 54 compat_mode_t st_mode; /* 16 bits */ 55 compat_nlink_t st_nlink; /* 16 bits */ 56 u16 st_reserved1; /* old st_uid */ 57 u16 st_reserved2; /* old st_gid */ 58 compat_dev_t st_rdev; 59 compat_off_t st_size; 60 compat_time_t st_atime; 61 u32 st_atime_nsec; 62 compat_time_t st_mtime; 63 u32 st_mtime_nsec; 64 compat_time_t st_ctime; 65 u32 st_ctime_nsec; 66 s32 st_blksize; 67 s32 st_blocks; 68 u32 __unused1; /* ACL stuff */ 69 compat_dev_t __unused2; /* network */ 70 compat_ino_t __unused3; /* network */ 71 u32 __unused4; /* cnodes */ 72 u16 __unused5; /* netsite */ 73 short st_fstype; 74 compat_dev_t st_realdev; 75 u16 st_basemode; 76 u16 st_spareshort; 77 __compat_uid32_t st_uid; 78 __compat_gid32_t st_gid; 79 u32 st_spare4[3]; 80 }; 81 82 struct compat_flock { 83 short l_type; 84 short l_whence; 85 compat_off_t l_start; 86 compat_off_t l_len; 87 compat_pid_t l_pid; 88 }; 89 90 struct compat_flock64 { 91 short l_type; 92 short l_whence; 93 compat_loff_t l_start; 94 compat_loff_t l_len; 95 compat_pid_t l_pid; 96 }; 97 98 struct compat_statfs { 99 s32 f_type; 100 s32 f_bsize; 101 s32 f_blocks; 102 s32 f_bfree; 103 s32 f_bavail; 104 s32 f_files; 105 s32 f_ffree; 106 __kernel_fsid_t f_fsid; 107 s32 f_namelen; 108 s32 f_frsize; 109 s32 f_flags; 110 s32 f_spare[4]; 111 }; 112 113 struct compat_sigcontext { 114 compat_int_t sc_flags; 115 compat_int_t sc_gr[32]; /* PSW in sc_gr[0] */ 116 u64 sc_fr[32]; 117 compat_int_t sc_iasq[2]; 118 compat_int_t sc_iaoq[2]; 119 compat_int_t sc_sar; /* cr11 */ 120 }; 121 122 #define COMPAT_RLIM_INFINITY 0xffffffff 123 124 typedef u32 compat_old_sigset_t; /* at least 32 bits */ 125 126 #define _COMPAT_NSIG 64 127 #define _COMPAT_NSIG_BPW 32 128 129 typedef u32 compat_sigset_word; 130 131 typedef union compat_sigval { 132 compat_int_t sival_int; 133 compat_uptr_t sival_ptr; 134 } compat_sigval_t; 135 136 typedef struct compat_siginfo { 137 int si_signo; 138 int si_errno; 139 int si_code; 140 141 union { 142 int _pad[128/sizeof(int) - 3]; 143 144 /* kill() */ 145 struct { 146 unsigned int _pid; /* sender's pid */ 147 unsigned int _uid; /* sender's uid */ 148 } _kill; 149 150 /* POSIX.1b timers */ 151 struct { 152 compat_timer_t _tid; /* timer id */ 153 int _overrun; /* overrun count */ 154 char _pad[sizeof(unsigned int) - sizeof(int)]; 155 compat_sigval_t _sigval; /* same as below */ 156 int _sys_private; /* not to be passed to user */ 157 } _timer; 158 159 /* POSIX.1b signals */ 160 struct { 161 unsigned int _pid; /* sender's pid */ 162 unsigned int _uid; /* sender's uid */ 163 compat_sigval_t _sigval; 164 } _rt; 165 166 /* SIGCHLD */ 167 struct { 168 unsigned int _pid; /* which child */ 169 unsigned int _uid; /* sender's uid */ 170 int _status; /* exit code */ 171 compat_clock_t _utime; 172 compat_clock_t _stime; 173 } _sigchld; 174 175 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ 176 struct { 177 unsigned int _addr; /* faulting insn/memory ref. */ 178 } _sigfault; 179 180 /* SIGPOLL */ 181 struct { 182 int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ 183 int _fd; 184 } _sigpoll; 185 } _sifields; 186 } compat_siginfo_t; 187 188 #define COMPAT_OFF_T_MAX 0x7fffffff 189 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL 190 191 /* 192 * A pointer passed in from user mode. This should not 193 * be used for syscall parameters, just declare them 194 * as pointers because the syscall entry code will have 195 * appropriately converted them already. 196 */ 197 198 static inline void __user *compat_ptr(compat_uptr_t uptr) 199 { 200 return (void __user *)(unsigned long)uptr; 201 } 202 203 static inline compat_uptr_t ptr_to_compat(void __user *uptr) 204 { 205 return (u32)(unsigned long)uptr; 206 } 207 208 static __inline__ void __user *arch_compat_alloc_user_space(long len) 209 { 210 struct pt_regs *regs = ¤t->thread.regs; 211 return (void __user *)regs->gr[30]; 212 } 213 214 static inline int __is_compat_task(struct task_struct *t) 215 { 216 return test_ti_thread_flag(task_thread_info(t), TIF_32BIT); 217 } 218 219 static inline int is_compat_task(void) 220 { 221 return __is_compat_task(current); 222 } 223 224 #endif /* _ASM_PARISC_COMPAT_H */ 225