1 #ifndef _ASM_X86_64_COMPAT_H
2 #define _ASM_X86_64_COMPAT_H
5 * Architecture specific compatibility types
7 #include <linux/types.h>
8 #include <linux/sched.h>
9 #include <asm/user32.h>
11 #define COMPAT_USER_HZ 100
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 u16 __compat_uid_t;
19 typedef u16 __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 u16 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 __kernel_fsid_t compat_fsid_t;
32 typedef s32 compat_timer_t;
33 typedef s32 compat_key_t;
35 typedef s32 compat_int_t;
36 typedef s32 compat_long_t;
37 typedef s64 __attribute__((aligned(4))) compat_s64;
38 typedef u32 compat_uint_t;
39 typedef u32 compat_ulong_t;
40 typedef u64 __attribute__((aligned(4))) compat_u64;
42 struct compat_timespec {
47 struct compat_timeval {
56 compat_mode_t st_mode;
57 compat_nlink_t st_nlink;
58 __compat_uid_t st_uid;
59 __compat_gid_t st_gid;
83 #define F_GETLK64 12 /* using 'struct flock64' */
88 * IA32 uses 4 byte alignment for 64 bit quantities,
89 * so we need to pack this structure.
91 struct compat_flock64 {
94 compat_loff_t l_start;
97 } __attribute__((packed));
99 struct compat_statfs {
107 compat_fsid_t f_fsid;
108 int f_namelen; /* SunOS ignores this field. */
113 #define COMPAT_RLIM_OLD_INFINITY 0x7fffffff
114 #define COMPAT_RLIM_INFINITY 0xffffffff
116 typedef u32 compat_old_sigset_t; /* at least 32 bits */
118 #define _COMPAT_NSIG 64
119 #define _COMPAT_NSIG_BPW 32
121 typedef u32 compat_sigset_word;
123 #define COMPAT_OFF_T_MAX 0x7fffffff
124 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
126 struct compat_ipc64_perm {
128 __compat_uid32_t uid;
129 __compat_gid32_t gid;
130 __compat_uid32_t cuid;
131 __compat_gid32_t cgid;
133 unsigned short __pad1;
135 unsigned short __pad2;
136 compat_ulong_t unused1;
137 compat_ulong_t unused2;
140 struct compat_semid64_ds {
141 struct compat_ipc64_perm sem_perm;
142 compat_time_t sem_otime;
143 compat_ulong_t __unused1;
144 compat_time_t sem_ctime;
145 compat_ulong_t __unused2;
146 compat_ulong_t sem_nsems;
147 compat_ulong_t __unused3;
148 compat_ulong_t __unused4;
151 struct compat_msqid64_ds {
152 struct compat_ipc64_perm msg_perm;
153 compat_time_t msg_stime;
154 compat_ulong_t __unused1;
155 compat_time_t msg_rtime;
156 compat_ulong_t __unused2;
157 compat_time_t msg_ctime;
158 compat_ulong_t __unused3;
159 compat_ulong_t msg_cbytes;
160 compat_ulong_t msg_qnum;
161 compat_ulong_t msg_qbytes;
162 compat_pid_t msg_lspid;
163 compat_pid_t msg_lrpid;
164 compat_ulong_t __unused4;
165 compat_ulong_t __unused5;
168 struct compat_shmid64_ds {
169 struct compat_ipc64_perm shm_perm;
170 compat_size_t shm_segsz;
171 compat_time_t shm_atime;
172 compat_ulong_t __unused1;
173 compat_time_t shm_dtime;
174 compat_ulong_t __unused2;
175 compat_time_t shm_ctime;
176 compat_ulong_t __unused3;
177 compat_pid_t shm_cpid;
178 compat_pid_t shm_lpid;
179 compat_ulong_t shm_nattch;
180 compat_ulong_t __unused4;
181 compat_ulong_t __unused5;
185 * The type of struct elf_prstatus.pr_reg in compatible core dumps.
187 typedef struct user_regs_struct32 compat_elf_gregset_t;
190 * A pointer passed in from user mode. This should not
191 * be used for syscall parameters, just declare them
192 * as pointers because the syscall entry code will have
193 * appropriately converted them already.
195 typedef u32 compat_uptr_t;
197 static inline void __user *compat_ptr(compat_uptr_t uptr)
199 return (void __user *)(unsigned long)uptr;
202 static inline compat_uptr_t ptr_to_compat(void __user *uptr)
204 return (u32)(unsigned long)uptr;
207 static inline void __user *compat_alloc_user_space(long len)
209 struct pt_regs *regs = task_pt_regs(current);
210 return (void __user *)regs->sp - len;
213 static inline int is_compat_task(void)
215 return current_thread_info()->status & TS_COMPAT;
218 #endif /* _ASM_X86_64_COMPAT_H */