hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/arch/x86/include/asm/compat.h
....@@ -12,49 +12,30 @@
1212 #include <asm/user32.h>
1313 #include <asm/unistd.h>
1414
15
+#include <asm-generic/compat.h>
16
+
1517 #define COMPAT_USER_HZ 100
1618 #define COMPAT_UTS_MACHINE "i686\0\0"
1719
18
-typedef u32 compat_size_t;
19
-typedef s32 compat_ssize_t;
20
-typedef s32 compat_clock_t;
21
-typedef s32 compat_pid_t;
2220 typedef u16 __compat_uid_t;
2321 typedef u16 __compat_gid_t;
2422 typedef u32 __compat_uid32_t;
2523 typedef u32 __compat_gid32_t;
2624 typedef u16 compat_mode_t;
27
-typedef u32 compat_ino_t;
2825 typedef u16 compat_dev_t;
29
-typedef s32 compat_off_t;
30
-typedef s64 compat_loff_t;
3126 typedef u16 compat_nlink_t;
3227 typedef u16 compat_ipc_pid_t;
33
-typedef s32 compat_daddr_t;
3428 typedef u32 compat_caddr_t;
3529 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;
4730
4831 struct compat_stat {
49
- compat_dev_t st_dev;
50
- u16 __pad1;
32
+ u32 st_dev;
5133 compat_ino_t st_ino;
5234 compat_mode_t st_mode;
5335 compat_nlink_t st_nlink;
5436 __compat_uid_t st_uid;
5537 __compat_gid_t st_gid;
56
- compat_dev_t st_rdev;
57
- u16 __pad2;
38
+ u32 st_rdev;
5839 u32 st_size;
5940 u32 st_blksize;
6041 u32 st_blocks;
....@@ -192,23 +173,6 @@
192173 (!!(task_pt_regs(current)->orig_ax & __X32_SYSCALL_BIT))
193174 #endif
194175
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
-
212176 static inline void __user *arch_compat_alloc_user_space(long len)
213177 {
214178 compat_uptr_t sp;
....@@ -232,14 +196,26 @@
232196 return false;
233197 }
234198
235
-static inline bool in_compat_syscall(void)
199
+static inline bool in_32bit_syscall(void)
236200 {
237201 return in_ia32_syscall() || in_x32_syscall();
238202 }
203
+
204
+#ifdef CONFIG_COMPAT
205
+static inline bool in_compat_syscall(void)
206
+{
207
+ return in_32bit_syscall();
208
+}
239209 #define in_compat_syscall in_compat_syscall /* override the generic impl */
210
+#define compat_need_64bit_alignment_fixup in_ia32_syscall
211
+#endif
240212
241213 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 */
244220
245221 #endif /* _ASM_X86_COMPAT_H */