0001
0002 #ifndef _ASM_X86_COMPAT_H
0003 #define _ASM_X86_COMPAT_H
0004
0005
0006
0007
0008 #include <linux/types.h>
0009 #include <linux/sched.h>
0010 #include <linux/sched/task_stack.h>
0011 #include <asm/processor.h>
0012 #include <asm/user32.h>
0013 #include <asm/unistd.h>
0014
0015 #define compat_mode_t compat_mode_t
0016 typedef u16 compat_mode_t;
0017
0018 #define __compat_uid_t __compat_uid_t
0019 typedef u16 __compat_uid_t;
0020 typedef u16 __compat_gid_t;
0021
0022 #define compat_dev_t compat_dev_t
0023 typedef u16 compat_dev_t;
0024
0025 #define compat_ipc_pid_t compat_ipc_pid_t
0026 typedef u16 compat_ipc_pid_t;
0027
0028 #define compat_statfs compat_statfs
0029
0030 #include <asm-generic/compat.h>
0031
0032 #define COMPAT_UTS_MACHINE "i686\0\0"
0033
0034 typedef u16 compat_nlink_t;
0035
0036 struct compat_stat {
0037 u32 st_dev;
0038 compat_ino_t st_ino;
0039 compat_mode_t st_mode;
0040 compat_nlink_t st_nlink;
0041 __compat_uid_t st_uid;
0042 __compat_gid_t st_gid;
0043 u32 st_rdev;
0044 u32 st_size;
0045 u32 st_blksize;
0046 u32 st_blocks;
0047 u32 st_atime;
0048 u32 st_atime_nsec;
0049 u32 st_mtime;
0050 u32 st_mtime_nsec;
0051 u32 st_ctime;
0052 u32 st_ctime_nsec;
0053 u32 __unused4;
0054 u32 __unused5;
0055 };
0056
0057
0058
0059
0060
0061 #define __ARCH_NEED_COMPAT_FLOCK64_PACKED
0062
0063 struct compat_statfs {
0064 int f_type;
0065 int f_bsize;
0066 int f_blocks;
0067 int f_bfree;
0068 int f_bavail;
0069 int f_files;
0070 int f_ffree;
0071 compat_fsid_t f_fsid;
0072 int f_namelen;
0073 int f_frsize;
0074 int f_flags;
0075 int f_spare[4];
0076 };
0077
0078 #ifdef CONFIG_X86_X32_ABI
0079 #define COMPAT_USE_64BIT_TIME \
0080 (!!(task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT))
0081 #endif
0082
0083 static inline bool in_x32_syscall(void)
0084 {
0085 #ifdef CONFIG_X86_X32_ABI
0086 if (task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT)
0087 return true;
0088 #endif
0089 return false;
0090 }
0091
0092 static inline bool in_32bit_syscall(void)
0093 {
0094 return in_ia32_syscall() || in_x32_syscall();
0095 }
0096
0097 #ifdef CONFIG_COMPAT
0098 static inline bool in_compat_syscall(void)
0099 {
0100 return in_32bit_syscall();
0101 }
0102 #define in_compat_syscall in_compat_syscall
0103 #define compat_need_64bit_alignment_fixup in_ia32_syscall
0104 #endif
0105
0106 struct compat_siginfo;
0107
0108 #ifdef CONFIG_X86_X32_ABI
0109 int copy_siginfo_to_user32(struct compat_siginfo __user *to,
0110 const kernel_siginfo_t *from);
0111 #define copy_siginfo_to_user32 copy_siginfo_to_user32
0112 #endif
0113
0114 #endif