| .. | .. | 
|---|
| 12 | 12 | #include <asm/user32.h> | 
|---|
| 13 | 13 | #include <asm/unistd.h> | 
|---|
| 14 | 14 |  | 
|---|
|  | 15 | +#include <asm-generic/compat.h> | 
|---|
|  | 16 | + | 
|---|
| 15 | 17 | #define COMPAT_USER_HZ		100 | 
|---|
| 16 | 18 | #define COMPAT_UTS_MACHINE	"i686\0\0" | 
|---|
| 17 | 19 |  | 
|---|
| 18 |  | -typedef u32		compat_size_t; | 
|---|
| 19 |  | -typedef s32		compat_ssize_t; | 
|---|
| 20 |  | -typedef s32		compat_clock_t; | 
|---|
| 21 |  | -typedef s32		compat_pid_t; | 
|---|
| 22 | 20 | typedef u16		__compat_uid_t; | 
|---|
| 23 | 21 | typedef u16		__compat_gid_t; | 
|---|
| 24 | 22 | typedef u32		__compat_uid32_t; | 
|---|
| 25 | 23 | typedef u32		__compat_gid32_t; | 
|---|
| 26 | 24 | typedef u16		compat_mode_t; | 
|---|
| 27 |  | -typedef u32		compat_ino_t; | 
|---|
| 28 | 25 | typedef u16		compat_dev_t; | 
|---|
| 29 |  | -typedef s32		compat_off_t; | 
|---|
| 30 |  | -typedef s64		compat_loff_t; | 
|---|
| 31 | 26 | typedef u16		compat_nlink_t; | 
|---|
| 32 | 27 | typedef u16		compat_ipc_pid_t; | 
|---|
| 33 |  | -typedef s32		compat_daddr_t; | 
|---|
| 34 | 28 | typedef u32		compat_caddr_t; | 
|---|
| 35 | 29 | typedef __kernel_fsid_t	compat_fsid_t; | 
|---|
| 36 |  | -typedef s32		compat_timer_t; | 
|---|
| 37 |  | -typedef s32		compat_key_t; | 
|---|
| 38 |  | - | 
|---|
| 39 |  | -typedef s32		compat_int_t; | 
|---|
| 40 |  | -typedef s32		compat_long_t; | 
|---|
| 41 |  | -typedef s64 __attribute__((aligned(4))) compat_s64; | 
|---|
| 42 |  | -typedef u32		compat_uint_t; | 
|---|
| 43 |  | -typedef u32		compat_ulong_t; | 
|---|
| 44 |  | -typedef u32		compat_u32; | 
|---|
| 45 |  | -typedef u64 __attribute__((aligned(4))) compat_u64; | 
|---|
| 46 |  | -typedef u32		compat_uptr_t; | 
|---|
| 47 | 30 |  | 
|---|
| 48 | 31 | struct compat_stat { | 
|---|
| 49 |  | -	compat_dev_t	st_dev; | 
|---|
| 50 |  | -	u16		__pad1; | 
|---|
|  | 32 | +	u32		st_dev; | 
|---|
| 51 | 33 | compat_ino_t	st_ino; | 
|---|
| 52 | 34 | compat_mode_t	st_mode; | 
|---|
| 53 | 35 | compat_nlink_t	st_nlink; | 
|---|
| 54 | 36 | __compat_uid_t	st_uid; | 
|---|
| 55 | 37 | __compat_gid_t	st_gid; | 
|---|
| 56 |  | -	compat_dev_t	st_rdev; | 
|---|
| 57 |  | -	u16		__pad2; | 
|---|
|  | 38 | +	u32		st_rdev; | 
|---|
| 58 | 39 | u32		st_size; | 
|---|
| 59 | 40 | u32		st_blksize; | 
|---|
| 60 | 41 | u32		st_blocks; | 
|---|
| .. | .. | 
|---|
| 192 | 173 | (!!(task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT)) | 
|---|
| 193 | 174 | #endif | 
|---|
| 194 | 175 |  | 
|---|
| 195 |  | -/* | 
|---|
| 196 |  | - * A pointer passed in from user mode. This should not | 
|---|
| 197 |  | - * be used for syscall parameters, just declare them | 
|---|
| 198 |  | - * as pointers because the syscall entry code will have | 
|---|
| 199 |  | - * appropriately converted them already. | 
|---|
| 200 |  | - */ | 
|---|
| 201 |  | - | 
|---|
| 202 |  | -static inline void __user *compat_ptr(compat_uptr_t uptr) | 
|---|
| 203 |  | -{ | 
|---|
| 204 |  | -	return (void __user *)(unsigned long)uptr; | 
|---|
| 205 |  | -} | 
|---|
| 206 |  | - | 
|---|
| 207 |  | -static inline compat_uptr_t ptr_to_compat(void __user *uptr) | 
|---|
| 208 |  | -{ | 
|---|
| 209 |  | -	return (u32)(unsigned long)uptr; | 
|---|
| 210 |  | -} | 
|---|
| 211 |  | - | 
|---|
| 212 | 176 | static inline void __user *arch_compat_alloc_user_space(long len) | 
|---|
| 213 | 177 | { | 
|---|
| 214 | 178 | compat_uptr_t sp; | 
|---|
| .. | .. | 
|---|
| 232 | 196 | return false; | 
|---|
| 233 | 197 | } | 
|---|
| 234 | 198 |  | 
|---|
| 235 |  | -static inline bool in_compat_syscall(void) | 
|---|
|  | 199 | +static inline bool in_32bit_syscall(void) | 
|---|
| 236 | 200 | { | 
|---|
| 237 | 201 | return in_ia32_syscall() || in_x32_syscall(); | 
|---|
| 238 | 202 | } | 
|---|
|  | 203 | + | 
|---|
|  | 204 | +#ifdef CONFIG_COMPAT | 
|---|
|  | 205 | +static inline bool in_compat_syscall(void) | 
|---|
|  | 206 | +{ | 
|---|
|  | 207 | +	return in_32bit_syscall(); | 
|---|
|  | 208 | +} | 
|---|
| 239 | 209 | #define in_compat_syscall in_compat_syscall	/* override the generic impl */ | 
|---|
|  | 210 | +#define compat_need_64bit_alignment_fixup in_ia32_syscall | 
|---|
|  | 211 | +#endif | 
|---|
| 240 | 212 |  | 
|---|
| 241 | 213 | struct compat_siginfo; | 
|---|
| 242 |  | -int __copy_siginfo_to_user32(struct compat_siginfo __user *to, | 
|---|
| 243 |  | -		const siginfo_t *from, bool x32_ABI); | 
|---|
|  | 214 | + | 
|---|
|  | 215 | +#ifdef CONFIG_X86_X32_ABI | 
|---|
|  | 216 | +int copy_siginfo_to_user32(struct compat_siginfo __user *to, | 
|---|
|  | 217 | +		const kernel_siginfo_t *from); | 
|---|
|  | 218 | +#define copy_siginfo_to_user32 copy_siginfo_to_user32 | 
|---|
|  | 219 | +#endif /* CONFIG_X86_X32_ABI */ | 
|---|
| 244 | 220 |  | 
|---|
| 245 | 221 | #endif /* _ASM_X86_COMPAT_H */ | 
|---|