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>
10 #define COMPAT_USER_HZ 100
12 typedef u32 compat_size_t
;
13 typedef s32 compat_ssize_t
;
14 typedef s32 compat_time_t
;
15 typedef s32 compat_clock_t
;
16 typedef s32 compat_pid_t
;
17 typedef u16 __compat_uid_t
;
18 typedef u16 __compat_gid_t
;
19 typedef u32 __compat_uid32_t
;
20 typedef u32 __compat_gid32_t
;
21 typedef u16 compat_mode_t
;
22 typedef u32 compat_ino_t
;
23 typedef u16 compat_dev_t
;
24 typedef s32 compat_off_t
;
25 typedef s64 compat_loff_t
;
26 typedef u16 compat_nlink_t
;
27 typedef u16 compat_ipc_pid_t
;
28 typedef s32 compat_daddr_t
;
29 typedef u32 compat_caddr_t
;
30 typedef __kernel_fsid_t compat_fsid_t
;
31 typedef s32 compat_timer_t
;
32 typedef s32 compat_key_t
;
34 typedef s32 compat_int_t
;
35 typedef s32 compat_long_t
;
36 typedef u32 compat_uint_t
;
37 typedef u32 compat_ulong_t
;
39 struct compat_timespec
{
44 struct compat_timeval
{
53 compat_mode_t st_mode
;
54 compat_nlink_t st_nlink
;
55 __compat_uid_t st_uid
;
56 __compat_gid_t st_gid
;
80 #define F_GETLK64 12 /* using 'struct flock64' */
85 * IA32 uses 4 byte alignment for 64 bit quantities,
86 * so we need to pack this structure.
88 struct compat_flock64
{
91 compat_loff_t l_start
;
94 } __attribute__((packed
));
96 struct compat_statfs
{
104 compat_fsid_t f_fsid
;
105 int f_namelen
; /* SunOS ignores this field. */
110 #define COMPAT_RLIM_OLD_INFINITY 0x7fffffff
111 #define COMPAT_RLIM_INFINITY 0xffffffff
113 typedef u32 compat_old_sigset_t
; /* at least 32 bits */
115 #define _COMPAT_NSIG 64
116 #define _COMPAT_NSIG_BPW 32
118 typedef u32 compat_sigset_word
;
120 #define COMPAT_OFF_T_MAX 0x7fffffff
121 #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
123 struct compat_ipc64_perm
{
125 __compat_uid32_t uid
;
126 __compat_gid32_t gid
;
127 __compat_uid32_t cuid
;
128 __compat_gid32_t cgid
;
130 unsigned short __pad1
;
132 unsigned short __pad2
;
133 compat_ulong_t unused1
;
134 compat_ulong_t unused2
;
137 struct compat_semid64_ds
{
138 struct compat_ipc64_perm sem_perm
;
139 compat_time_t sem_otime
;
140 compat_ulong_t __unused1
;
141 compat_time_t sem_ctime
;
142 compat_ulong_t __unused2
;
143 compat_ulong_t sem_nsems
;
144 compat_ulong_t __unused3
;
145 compat_ulong_t __unused4
;
148 struct compat_msqid64_ds
{
149 struct compat_ipc64_perm msg_perm
;
150 compat_time_t msg_stime
;
151 compat_ulong_t __unused1
;
152 compat_time_t msg_rtime
;
153 compat_ulong_t __unused2
;
154 compat_time_t msg_ctime
;
155 compat_ulong_t __unused3
;
156 compat_ulong_t msg_cbytes
;
157 compat_ulong_t msg_qnum
;
158 compat_ulong_t msg_qbytes
;
159 compat_pid_t msg_lspid
;
160 compat_pid_t msg_lrpid
;
161 compat_ulong_t __unused4
;
162 compat_ulong_t __unused5
;
165 struct compat_shmid64_ds
{
166 struct compat_ipc64_perm shm_perm
;
167 compat_size_t shm_segsz
;
168 compat_time_t shm_atime
;
169 compat_ulong_t __unused1
;
170 compat_time_t shm_dtime
;
171 compat_ulong_t __unused2
;
172 compat_time_t shm_ctime
;
173 compat_ulong_t __unused3
;
174 compat_pid_t shm_cpid
;
175 compat_pid_t shm_lpid
;
176 compat_ulong_t shm_nattch
;
177 compat_ulong_t __unused4
;
178 compat_ulong_t __unused5
;
182 * A pointer passed in from user mode. This should not
183 * be used for syscall parameters, just declare them
184 * as pointers because the syscall entry code will have
185 * appropriately comverted them already.
187 typedef u32 compat_uptr_t
;
189 static inline void __user
*compat_ptr(compat_uptr_t uptr
)
191 return (void __user
*)(unsigned long)uptr
;
194 static inline compat_uptr_t
ptr_to_compat(void __user
*uptr
)
196 return (u32
)(unsigned long)uptr
;
199 static __inline__
void __user
*compat_alloc_user_space(long len
)
201 struct pt_regs
*regs
= task_pt_regs(current
);
202 return (void __user
*)regs
->rsp
- len
;
205 static inline int is_compat_task(void)
207 return current_thread_info()->status
& TS_COMPAT
;
210 #endif /* _ASM_X86_64_COMPAT_H */