1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (C) 2012 ARM Ltd. 4 */ 5 #ifndef __ASM_COMPAT_H 6 #define __ASM_COMPAT_H 7 8 #define compat_mode_t compat_mode_t 9 typedef u16 compat_mode_t; 10 11 #define __compat_uid_t __compat_uid_t 12 typedef u16 __compat_uid_t; 13 typedef u16 __compat_gid_t; 14 15 #define compat_ipc_pid_t compat_ipc_pid_t 16 typedef u16 compat_ipc_pid_t; 17 18 #define compat_statfs compat_statfs 19 20 #include <asm-generic/compat.h> 21 22 #ifdef CONFIG_COMPAT 23 24 /* 25 * Architecture specific compatibility types 26 */ 27 #include <linux/types.h> 28 #include <linux/sched.h> 29 #include <linux/sched/task_stack.h> 30 31 #define COMPAT_UTS_MACHINE "armv8l\0\0" 32 33 typedef u16 __compat_uid16_t; 34 typedef u16 __compat_gid16_t; 35 typedef s32 compat_nlink_t; 36 37 struct compat_stat { 38 compat_dev_t st_dev; 39 compat_ino_t st_ino; 40 compat_mode_t st_mode; 41 compat_ushort_t st_nlink; 42 __compat_uid16_t st_uid; 43 __compat_gid16_t st_gid; 44 compat_dev_t st_rdev; 45 compat_off_t st_size; 46 compat_off_t st_blksize; 47 compat_off_t st_blocks; 48 old_time32_t st_atime; 49 compat_ulong_t st_atime_nsec; 50 old_time32_t st_mtime; 51 compat_ulong_t st_mtime_nsec; 52 old_time32_t st_ctime; 53 compat_ulong_t st_ctime_nsec; 54 compat_ulong_t __unused4[2]; 55 }; 56 57 struct compat_statfs { 58 int f_type; 59 int f_bsize; 60 int f_blocks; 61 int f_bfree; 62 int f_bavail; 63 int f_files; 64 int f_ffree; 65 compat_fsid_t f_fsid; 66 int f_namelen; /* SunOS ignores this field. */ 67 int f_frsize; 68 int f_flags; 69 int f_spare[4]; 70 }; 71 72 #define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current))) 73 #define COMPAT_MINSIGSTKSZ 2048 74 75 static inline int is_compat_task(void) 76 { 77 return test_thread_flag(TIF_32BIT); 78 } 79 80 static inline int is_compat_thread(struct thread_info *thread) 81 { 82 return test_ti_thread_flag(thread, TIF_32BIT); 83 } 84 85 long compat_arm_syscall(struct pt_regs *regs, int scno); 86 87 #else /* !CONFIG_COMPAT */ 88 89 static inline int is_compat_thread(struct thread_info *thread) 90 { 91 return 0; 92 } 93 94 #endif /* CONFIG_COMPAT */ 95 #endif /* __ASM_COMPAT_H */ 96