Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _ASM_IA64_COMPAT_H |
| 2 | #define _ASM_IA64_COMPAT_H |
| 3 | /* |
| 4 | * Architecture specific compatibility types |
| 5 | */ |
| 6 | #include <linux/types.h> |
| 7 | |
| 8 | #define COMPAT_USER_HZ 100 |
| 9 | |
| 10 | typedef u32 compat_size_t; |
| 11 | typedef s32 compat_ssize_t; |
| 12 | typedef s32 compat_time_t; |
| 13 | typedef s32 compat_clock_t; |
| 14 | typedef s32 compat_key_t; |
| 15 | typedef s32 compat_pid_t; |
Stephen Rothwell | 202e597 | 2005-09-06 15:16:40 -0700 | [diff] [blame] | 16 | typedef u16 __compat_uid_t; |
| 17 | typedef u16 __compat_gid_t; |
| 18 | typedef u32 __compat_uid32_t; |
| 19 | typedef u32 __compat_gid32_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | typedef u16 compat_mode_t; |
| 21 | typedef u32 compat_ino_t; |
| 22 | typedef u16 compat_dev_t; |
| 23 | typedef s32 compat_off_t; |
| 24 | typedef s64 compat_loff_t; |
| 25 | typedef u16 compat_nlink_t; |
| 26 | typedef u16 compat_ipc_pid_t; |
| 27 | typedef s32 compat_daddr_t; |
| 28 | typedef u32 compat_caddr_t; |
| 29 | typedef __kernel_fsid_t compat_fsid_t; |
Stephen Rothwell | 0d77e5a | 2005-06-23 00:10:14 -0700 | [diff] [blame] | 30 | typedef s32 compat_timer_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
| 32 | typedef s32 compat_int_t; |
| 33 | typedef s32 compat_long_t; |
| 34 | typedef u32 compat_uint_t; |
| 35 | typedef u32 compat_ulong_t; |
| 36 | |
| 37 | struct compat_timespec { |
| 38 | compat_time_t tv_sec; |
| 39 | s32 tv_nsec; |
| 40 | }; |
| 41 | |
| 42 | struct compat_timeval { |
| 43 | compat_time_t tv_sec; |
| 44 | s32 tv_usec; |
| 45 | }; |
| 46 | |
| 47 | struct compat_stat { |
| 48 | compat_dev_t st_dev; |
| 49 | u16 __pad1; |
| 50 | compat_ino_t st_ino; |
| 51 | compat_mode_t st_mode; |
| 52 | compat_nlink_t st_nlink; |
Stephen Rothwell | 202e597 | 2005-09-06 15:16:40 -0700 | [diff] [blame] | 53 | __compat_uid_t st_uid; |
| 54 | __compat_gid_t st_gid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | compat_dev_t st_rdev; |
| 56 | u16 __pad2; |
| 57 | u32 st_size; |
| 58 | u32 st_blksize; |
| 59 | u32 st_blocks; |
| 60 | u32 st_atime; |
| 61 | u32 st_atime_nsec; |
| 62 | u32 st_mtime; |
| 63 | u32 st_mtime_nsec; |
| 64 | u32 st_ctime; |
| 65 | u32 st_ctime_nsec; |
| 66 | u32 __unused4; |
| 67 | u32 __unused5; |
| 68 | }; |
| 69 | |
| 70 | struct compat_flock { |
| 71 | short l_type; |
| 72 | short l_whence; |
| 73 | compat_off_t l_start; |
| 74 | compat_off_t l_len; |
| 75 | compat_pid_t l_pid; |
| 76 | }; |
| 77 | |
| 78 | #define F_GETLK64 12 |
| 79 | #define F_SETLK64 13 |
| 80 | #define F_SETLKW64 14 |
| 81 | |
| 82 | /* |
| 83 | * IA32 uses 4 byte alignment for 64 bit quantities, |
| 84 | * so we need to pack this structure. |
| 85 | */ |
| 86 | struct compat_flock64 { |
| 87 | short l_type; |
| 88 | short l_whence; |
| 89 | compat_loff_t l_start; |
| 90 | compat_loff_t l_len; |
| 91 | compat_pid_t l_pid; |
| 92 | } __attribute__((packed)); |
| 93 | |
| 94 | struct compat_statfs { |
| 95 | int f_type; |
| 96 | int f_bsize; |
| 97 | int f_blocks; |
| 98 | int f_bfree; |
| 99 | int f_bavail; |
| 100 | int f_files; |
| 101 | int f_ffree; |
| 102 | compat_fsid_t f_fsid; |
| 103 | int f_namelen; /* SunOS ignores this field. */ |
| 104 | int f_frsize; |
| 105 | int f_spare[5]; |
| 106 | }; |
| 107 | |
| 108 | #define COMPAT_RLIM_OLD_INFINITY 0x7fffffff |
| 109 | #define COMPAT_RLIM_INFINITY 0xffffffff |
| 110 | |
| 111 | typedef u32 compat_old_sigset_t; /* at least 32 bits */ |
| 112 | |
| 113 | #define _COMPAT_NSIG 64 |
| 114 | #define _COMPAT_NSIG_BPW 32 |
| 115 | |
| 116 | typedef u32 compat_sigset_word; |
| 117 | |
| 118 | #define COMPAT_OFF_T_MAX 0x7fffffff |
| 119 | #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL |
| 120 | |
| 121 | struct compat_ipc64_perm { |
| 122 | compat_key_t key; |
Stephen Rothwell | 202e597 | 2005-09-06 15:16:40 -0700 | [diff] [blame] | 123 | __compat_uid32_t uid; |
| 124 | __compat_gid32_t gid; |
| 125 | __compat_uid32_t cuid; |
| 126 | __compat_gid32_t cgid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | unsigned short mode; |
| 128 | unsigned short __pad1; |
| 129 | unsigned short seq; |
| 130 | unsigned short __pad2; |
| 131 | compat_ulong_t unused1; |
| 132 | compat_ulong_t unused2; |
| 133 | }; |
| 134 | |
| 135 | struct compat_semid64_ds { |
| 136 | struct compat_ipc64_perm sem_perm; |
| 137 | compat_time_t sem_otime; |
| 138 | compat_ulong_t __unused1; |
| 139 | compat_time_t sem_ctime; |
| 140 | compat_ulong_t __unused2; |
| 141 | compat_ulong_t sem_nsems; |
| 142 | compat_ulong_t __unused3; |
| 143 | compat_ulong_t __unused4; |
| 144 | }; |
| 145 | |
| 146 | struct compat_msqid64_ds { |
| 147 | struct compat_ipc64_perm msg_perm; |
| 148 | compat_time_t msg_stime; |
| 149 | compat_ulong_t __unused1; |
| 150 | compat_time_t msg_rtime; |
| 151 | compat_ulong_t __unused2; |
| 152 | compat_time_t msg_ctime; |
| 153 | compat_ulong_t __unused3; |
| 154 | compat_ulong_t msg_cbytes; |
| 155 | compat_ulong_t msg_qnum; |
| 156 | compat_ulong_t msg_qbytes; |
| 157 | compat_pid_t msg_lspid; |
| 158 | compat_pid_t msg_lrpid; |
| 159 | compat_ulong_t __unused4; |
| 160 | compat_ulong_t __unused5; |
| 161 | }; |
| 162 | |
| 163 | struct compat_shmid64_ds { |
| 164 | struct compat_ipc64_perm shm_perm; |
| 165 | compat_size_t shm_segsz; |
| 166 | compat_time_t shm_atime; |
| 167 | compat_ulong_t __unused1; |
| 168 | compat_time_t shm_dtime; |
| 169 | compat_ulong_t __unused2; |
| 170 | compat_time_t shm_ctime; |
| 171 | compat_ulong_t __unused3; |
| 172 | compat_pid_t shm_cpid; |
| 173 | compat_pid_t shm_lpid; |
| 174 | compat_ulong_t shm_nattch; |
| 175 | compat_ulong_t __unused4; |
| 176 | compat_ulong_t __unused5; |
| 177 | }; |
| 178 | |
| 179 | /* |
| 180 | * A pointer passed in from user mode. This should not be used for syscall parameters, |
| 181 | * just declare them as pointers because the syscall entry code will have appropriately |
| 182 | * comverted them already. |
| 183 | */ |
| 184 | typedef u32 compat_uptr_t; |
| 185 | |
| 186 | static inline void __user * |
| 187 | compat_ptr (compat_uptr_t uptr) |
| 188 | { |
| 189 | return (void __user *) (unsigned long) uptr; |
| 190 | } |
| 191 | |
Ingo Molnar | 66e863ac | 2006-03-27 01:16:06 -0800 | [diff] [blame] | 192 | static inline compat_uptr_t |
| 193 | ptr_to_compat(void __user *uptr) |
| 194 | { |
| 195 | return (u32)(unsigned long)uptr; |
| 196 | } |
| 197 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | static __inline__ void __user * |
| 199 | compat_alloc_user_space (long len) |
| 200 | { |
Al Viro | 6450578 | 2006-01-12 01:06:06 -0800 | [diff] [blame] | 201 | struct pt_regs *regs = task_pt_regs(current); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len); |
| 203 | } |
| 204 | |
| 205 | #endif /* _ASM_IA64_COMPAT_H */ |