1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_COMPAT_H
3 #define _ASM_X86_COMPAT_H
6 * Architecture specific compatibility types
8 #include <linux/types.h>
9 #include <linux/sched.h>
10 #include <linux/sched/task_stack.h>
11 #include <asm/processor.h>
12 #include <asm/user32.h>
13 #include <asm/unistd.h>
15 #define compat_mode_t compat_mode_t
16 typedef u16 compat_mode_t
;
18 #define __compat_uid_t __compat_uid_t
19 typedef u16 __compat_uid_t
;
20 typedef u16 __compat_gid_t
;
22 #define compat_dev_t compat_dev_t
23 typedef u16 compat_dev_t
;
25 #define compat_ipc_pid_t compat_ipc_pid_t
26 typedef u16 compat_ipc_pid_t
;
28 #define compat_statfs compat_statfs
30 #include <asm-generic/compat.h>
32 #define COMPAT_UTS_MACHINE "i686\0\0"
34 typedef u16 compat_nlink_t
;
39 compat_mode_t st_mode
;
40 compat_nlink_t st_nlink
;
41 __compat_uid_t st_uid
;
42 __compat_gid_t st_gid
;
58 * IA32 uses 4 byte alignment for 64 bit quantities, so we need to pack the
59 * compat flock64 structure.
61 #define __ARCH_NEED_COMPAT_FLOCK64_PACKED
63 struct compat_statfs
{
72 int f_namelen
; /* SunOS ignores this field. */
78 #ifdef CONFIG_X86_X32_ABI
79 #define COMPAT_USE_64BIT_TIME \
80 (!!(task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT))
83 static inline bool in_x32_syscall(void)
85 #ifdef CONFIG_X86_X32_ABI
86 if (task_pt_regs(current
)->orig_ax
& __X32_SYSCALL_BIT
)
92 static inline bool in_32bit_syscall(void)
94 return in_ia32_syscall() || in_x32_syscall();
98 static inline bool in_compat_syscall(void)
100 return in_32bit_syscall();
102 #define in_compat_syscall in_compat_syscall /* override the generic impl */
103 #define compat_need_64bit_alignment_fixup in_ia32_syscall
106 struct compat_siginfo
;
108 #ifdef CONFIG_X86_X32_ABI
109 int copy_siginfo_to_user32(struct compat_siginfo __user
*to
,
110 const kernel_siginfo_t
*from
);
111 #define copy_siginfo_to_user32 copy_siginfo_to_user32
112 #endif /* CONFIG_X86_X32_ABI */
114 #endif /* _ASM_X86_COMPAT_H */