1#ifndef _ASM_COMPAT_H 2#define _ASM_COMPAT_H 3/* 4 * Architecture specific compatibility types 5 */ 6#include <linux/types.h> 7#include <asm/page.h> 8#include <asm/ptrace.h> 9 10#define COMPAT_USER_HZ 100 11 12typedef u32 compat_size_t; 13typedef s32 compat_ssize_t; 14typedef s32 compat_time_t; 15typedef s32 compat_clock_t; 16typedef s32 compat_suseconds_t; 17 18typedef s32 compat_pid_t; 19typedef s32 __compat_uid_t; 20typedef s32 __compat_gid_t; 21typedef __compat_uid_t __compat_uid32_t; 22typedef __compat_gid_t __compat_gid32_t; 23typedef u32 compat_mode_t; 24typedef u32 compat_ino_t; 25typedef u32 compat_dev_t; 26typedef s32 compat_off_t; 27typedef s64 compat_loff_t; 28typedef u32 compat_nlink_t; 29typedef s32 compat_ipc_pid_t; 30typedef s32 compat_daddr_t; 31typedef s32 compat_caddr_t; 32typedef struct { 33 s32 val[2]; 34} compat_fsid_t; 35typedef s32 compat_timer_t; 36typedef s32 compat_key_t; 37 38typedef s32 compat_int_t; 39typedef s32 compat_long_t; 40typedef u32 compat_uint_t; 41typedef u32 compat_ulong_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; 55 s32 st_pad1[3]; 56 compat_ino_t st_ino; 57 compat_mode_t st_mode; 58 compat_nlink_t st_nlink; 59 __compat_uid_t st_uid; 60 __compat_gid_t st_gid; 61 compat_dev_t st_rdev; 62 s32 st_pad2[2]; 63 compat_off_t st_size; 64 s32 st_pad3; 65 compat_time_t st_atime; 66 s32 st_atime_nsec; 67 compat_time_t st_mtime; 68 s32 st_mtime_nsec; 69 compat_time_t st_ctime; 70 s32 st_ctime_nsec; 71 s32 st_blksize; 72 s32 st_blocks; 73 s32 st_pad4[14]; 74}; 75 76struct compat_flock { 77 short l_type; 78 short l_whence; 79 compat_off_t l_start; 80 compat_off_t l_len; 81 s32 l_sysid; 82 compat_pid_t l_pid; 83 short __unused; 84 s32 pad[4]; 85}; 86 87#define F_GETLK64 33 88#define F_SETLK64 34 89#define F_SETLKW64 35 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 int f_type; 101 int f_bsize; 102 int f_frsize; 103 int f_blocks; 104 int f_bfree; 105 int f_files; 106 int f_ffree; 107 int f_bavail; 108 compat_fsid_t f_fsid; 109 int f_namelen; 110 int f_spare[6]; 111}; 112 113#define COMPAT_RLIM_INFINITY 0x7fffffffUL 114 115typedef u32 compat_old_sigset_t; /* at least 32 bits */ 116 117#define _COMPAT_NSIG 128 /* Don't ask !$@#% ... */ 118#define _COMPAT_NSIG_BPW 32 119 120typedef u32 compat_sigset_word; 121 122#define COMPAT_OFF_T_MAX 0x7fffffff 123#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL 124 125/* 126 * A pointer passed in from user mode. This should not 127 * be used for syscall parameters, just declare them 128 * as pointers because the syscall entry code will have 129 * appropriately comverted them already. 130 */ 131typedef u32 compat_uptr_t; 132 133static inline void __user *compat_ptr(compat_uptr_t uptr) 134{ 135 return (void __user *)(long)uptr; 136} 137 138static inline compat_uptr_t ptr_to_compat(void __user *uptr) 139{ 140 return (u32)(unsigned long)uptr; 141} 142 143static inline void __user *compat_alloc_user_space(long len) 144{ 145 struct pt_regs *regs = (struct pt_regs *) 146 ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1; 147 148 return (void __user *) (regs->regs[29] - len); 149} 150 151struct compat_ipc64_perm { 152 compat_key_t key; 153 __compat_uid32_t uid; 154 __compat_gid32_t gid; 155 __compat_uid32_t cuid; 156 __compat_gid32_t cgid; 157 compat_mode_t mode; 158 unsigned short seq; 159 unsigned short __pad2; 160 compat_ulong_t __unused1; 161 compat_ulong_t __unused2; 162}; 163 164struct compat_semid64_ds { 165 struct compat_ipc64_perm sem_perm; 166 compat_time_t sem_otime; 167 compat_time_t sem_ctime; 168 compat_ulong_t sem_nsems; 169 compat_ulong_t __unused1; 170 compat_ulong_t __unused2; 171}; 172 173struct compat_msqid64_ds { 174 struct compat_ipc64_perm msg_perm; 175#ifndef CONFIG_CPU_LITTLE_ENDIAN 176 compat_ulong_t __unused1; 177#endif 178 compat_time_t msg_stime; 179#ifdef CONFIG_CPU_LITTLE_ENDIAN 180 compat_ulong_t __unused1; 181#endif 182#ifndef CONFIG_CPU_LITTLE_ENDIAN 183 compat_ulong_t __unused2; 184#endif 185 compat_time_t msg_rtime; 186#ifdef CONFIG_CPU_LITTLE_ENDIAN 187 compat_ulong_t __unused2; 188#endif 189#ifndef CONFIG_CPU_LITTLE_ENDIAN 190 compat_ulong_t __unused3; 191#endif 192 compat_time_t msg_ctime; 193#ifdef CONFIG_CPU_LITTLE_ENDIAN 194 compat_ulong_t __unused3; 195#endif 196 compat_ulong_t msg_cbytes; 197 compat_ulong_t msg_qnum; 198 compat_ulong_t msg_qbytes; 199 compat_pid_t msg_lspid; 200 compat_pid_t msg_lrpid; 201 compat_ulong_t __unused4; 202 compat_ulong_t __unused5; 203}; 204 205struct compat_shmid64_ds { 206 struct compat_ipc64_perm shm_perm; 207 compat_size_t shm_segsz; 208 compat_time_t shm_atime; 209 compat_time_t shm_dtime; 210 compat_time_t shm_ctime; 211 compat_pid_t shm_cpid; 212 compat_pid_t shm_lpid; 213 compat_ulong_t shm_nattch; 214 compat_ulong_t __unused1; 215 compat_ulong_t __unused2; 216}; 217 218#endif /* _ASM_COMPAT_H */ 219