drm/vkms: Switch to dynamic allocation for CRTC
[drm/drm-misc.git] / arch / x86 / include / asm / compat.h
blobb1221da477b7438bf7a562fbbec3069b254addc0
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_COMPAT_H
3 #define _ASM_X86_COMPAT_H
5 /*
6 * Architecture specific compatibility types
7 */
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;
36 struct compat_stat {
37 u32 st_dev;
38 compat_ino_t st_ino;
39 compat_mode_t st_mode;
40 compat_nlink_t st_nlink;
41 __compat_uid_t st_uid;
42 __compat_gid_t st_gid;
43 u32 st_rdev;
44 u32 st_size;
45 u32 st_blksize;
46 u32 st_blocks;
47 u32 st_atime;
48 u32 st_atime_nsec;
49 u32 st_mtime;
50 u32 st_mtime_nsec;
51 u32 st_ctime;
52 u32 st_ctime_nsec;
53 u32 __unused4;
54 u32 __unused5;
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 {
64 int f_type;
65 int f_bsize;
66 int f_blocks;
67 int f_bfree;
68 int f_bavail;
69 int f_files;
70 int f_ffree;
71 compat_fsid_t f_fsid;
72 int f_namelen; /* SunOS ignores this field. */
73 int f_frsize;
74 int f_flags;
75 int f_spare[4];
78 #ifdef CONFIG_X86_X32_ABI
79 #define COMPAT_USE_64BIT_TIME \
80 (!!(task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT))
81 #endif
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)
87 return true;
88 #endif
89 return false;
92 static inline bool in_32bit_syscall(void)
94 return in_ia32_syscall() || in_x32_syscall();
97 #ifdef CONFIG_COMPAT
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
104 #endif
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 */