Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2012 ARM Ltd.
0004  */
0005 #ifndef __ASM_COMPAT_H
0006 #define __ASM_COMPAT_H
0007 
0008 #define compat_mode_t compat_mode_t
0009 typedef u16     compat_mode_t;
0010 
0011 #define __compat_uid_t  __compat_uid_t
0012 typedef u16     __compat_uid_t;
0013 typedef u16     __compat_gid_t;
0014 
0015 #define compat_ipc_pid_t compat_ipc_pid_t
0016 typedef u16     compat_ipc_pid_t;
0017 
0018 #define compat_statfs   compat_statfs
0019 
0020 #include <asm-generic/compat.h>
0021 
0022 #ifdef CONFIG_COMPAT
0023 
0024 /*
0025  * Architecture specific compatibility types
0026  */
0027 #include <linux/types.h>
0028 #include <linux/sched.h>
0029 #include <linux/sched/task_stack.h>
0030 
0031 #ifdef __AARCH64EB__
0032 #define COMPAT_UTS_MACHINE  "armv8b\0\0"
0033 #else
0034 #define COMPAT_UTS_MACHINE  "armv8l\0\0"
0035 #endif
0036 
0037 typedef u16     __compat_uid16_t;
0038 typedef u16     __compat_gid16_t;
0039 typedef s32     compat_nlink_t;
0040 
0041 struct compat_stat {
0042 #ifdef __AARCH64EB__
0043     short       st_dev;
0044     short       __pad1;
0045 #else
0046     compat_dev_t    st_dev;
0047 #endif
0048     compat_ino_t    st_ino;
0049     compat_mode_t   st_mode;
0050     compat_ushort_t st_nlink;
0051     __compat_uid16_t    st_uid;
0052     __compat_gid16_t    st_gid;
0053 #ifdef __AARCH64EB__
0054     short       st_rdev;
0055     short       __pad2;
0056 #else
0057     compat_dev_t    st_rdev;
0058 #endif
0059     compat_off_t    st_size;
0060     compat_off_t    st_blksize;
0061     compat_off_t    st_blocks;
0062     old_time32_t    st_atime;
0063     compat_ulong_t  st_atime_nsec;
0064     old_time32_t    st_mtime;
0065     compat_ulong_t  st_mtime_nsec;
0066     old_time32_t    st_ctime;
0067     compat_ulong_t  st_ctime_nsec;
0068     compat_ulong_t  __unused4[2];
0069 };
0070 
0071 struct compat_statfs {
0072     int     f_type;
0073     int     f_bsize;
0074     int     f_blocks;
0075     int     f_bfree;
0076     int     f_bavail;
0077     int     f_files;
0078     int     f_ffree;
0079     compat_fsid_t   f_fsid;
0080     int     f_namelen;  /* SunOS ignores this field. */
0081     int     f_frsize;
0082     int     f_flags;
0083     int     f_spare[4];
0084 };
0085 
0086 #define COMPAT_RLIM_INFINITY        0xffffffff
0087 
0088 #define COMPAT_OFF_T_MAX    0x7fffffff
0089 
0090 #define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
0091 #define COMPAT_MINSIGSTKSZ  2048
0092 
0093 static inline int is_compat_task(void)
0094 {
0095     return test_thread_flag(TIF_32BIT);
0096 }
0097 
0098 static inline int is_compat_thread(struct thread_info *thread)
0099 {
0100     return test_ti_thread_flag(thread, TIF_32BIT);
0101 }
0102 
0103 #else /* !CONFIG_COMPAT */
0104 
0105 static inline int is_compat_thread(struct thread_info *thread)
0106 {
0107     return 0;
0108 }
0109 
0110 #endif /* CONFIG_COMPAT */
0111 #endif /* __ASM_COMPAT_H */