Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_SPARC64_COMPAT_H
0003 #define _ASM_SPARC64_COMPAT_H
0004 /*
0005  * Architecture specific compatibility types
0006  */
0007 #include <linux/types.h>
0008 
0009 #define compat_mode_t   compat_mode_t
0010 typedef u16     compat_mode_t;
0011 
0012 #define __compat_uid_t  __compat_uid_t
0013 typedef u16     __compat_uid_t;
0014 typedef u16     __compat_gid_t;
0015 
0016 #define compat_dev_t    compat_dev_t
0017 typedef u16     compat_dev_t;
0018 
0019 #define compat_ipc_pid_t compat_ipc_pid_t
0020 typedef u16      compat_ipc_pid_t;
0021 
0022 #define compat_ipc64_perm compat_ipc64_perm
0023 
0024 #define COMPAT_RLIM_INFINITY 0x7fffffff
0025 
0026 #include <asm-generic/compat.h>
0027 
0028 #define COMPAT_UTS_MACHINE  "sparc\0\0"
0029 
0030 typedef s16     compat_nlink_t;
0031 
0032 struct compat_stat {
0033     compat_dev_t    st_dev;
0034     compat_ino_t    st_ino;
0035     compat_mode_t   st_mode;
0036     compat_nlink_t  st_nlink;
0037     __compat_uid_t  st_uid;
0038     __compat_gid_t  st_gid;
0039     compat_dev_t    st_rdev;
0040     compat_off_t    st_size;
0041     old_time32_t    st_atime;
0042     compat_ulong_t  st_atime_nsec;
0043     old_time32_t    st_mtime;
0044     compat_ulong_t  st_mtime_nsec;
0045     old_time32_t    st_ctime;
0046     compat_ulong_t  st_ctime_nsec;
0047     compat_off_t    st_blksize;
0048     compat_off_t    st_blocks;
0049     u32     __unused4[2];
0050 };
0051 
0052 struct compat_stat64 {
0053     unsigned long long  st_dev;
0054 
0055     unsigned long long  st_ino;
0056 
0057     unsigned int    st_mode;
0058     unsigned int    st_nlink;
0059 
0060     unsigned int    st_uid;
0061     unsigned int    st_gid;
0062 
0063     unsigned long long  st_rdev;
0064 
0065     unsigned char   __pad3[8];
0066 
0067     long long   st_size;
0068     unsigned int    st_blksize;
0069 
0070     unsigned char   __pad4[8];
0071     unsigned int    st_blocks;
0072 
0073     unsigned int    st_atime;
0074     unsigned int    st_atime_nsec;
0075 
0076     unsigned int    st_mtime;
0077     unsigned int    st_mtime_nsec;
0078 
0079     unsigned int    st_ctime;
0080     unsigned int    st_ctime_nsec;
0081 
0082     unsigned int    __unused4;
0083     unsigned int    __unused5;
0084 };
0085 
0086 #define __ARCH_COMPAT_FLOCK_PAD     short __unused;
0087 
0088 struct compat_ipc64_perm {
0089     compat_key_t key;
0090     __compat_uid32_t uid;
0091     __compat_gid32_t gid;
0092     __compat_uid32_t cuid;
0093     __compat_gid32_t cgid;
0094     unsigned short __pad1;
0095     compat_mode_t mode;
0096     unsigned short __pad2;
0097     unsigned short seq;
0098     unsigned long __unused1;    /* yes they really are 64bit pads */
0099     unsigned long __unused2;
0100 };
0101 
0102 struct compat_semid64_ds {
0103     struct compat_ipc64_perm sem_perm;
0104     unsigned int    sem_otime_high;
0105     unsigned int    sem_otime;
0106     unsigned int    sem_ctime_high;
0107     unsigned int    sem_ctime;
0108     u32     sem_nsems;
0109     u32     __unused1;
0110     u32     __unused2;
0111 };
0112 
0113 struct compat_msqid64_ds {
0114     struct compat_ipc64_perm msg_perm;
0115     unsigned int    msg_stime_high;
0116     unsigned int    msg_stime;
0117     unsigned int    msg_rtime_high;
0118     unsigned int    msg_rtime;
0119     unsigned int    msg_ctime_high;
0120     unsigned int    msg_ctime;
0121     unsigned int    msg_cbytes;
0122     unsigned int    msg_qnum;
0123     unsigned int    msg_qbytes;
0124     compat_pid_t    msg_lspid;
0125     compat_pid_t    msg_lrpid;
0126     unsigned int    __unused1;
0127     unsigned int    __unused2;
0128 };
0129 
0130 struct compat_shmid64_ds {
0131     struct compat_ipc64_perm shm_perm;
0132     unsigned int    shm_atime_high;
0133     unsigned int    shm_atime;
0134     unsigned int    shm_dtime_high;
0135     unsigned int    shm_dtime;
0136     unsigned int    shm_ctime_high;
0137     unsigned int    shm_ctime;
0138     compat_size_t   shm_segsz;
0139     compat_pid_t    shm_cpid;
0140     compat_pid_t    shm_lpid;
0141     unsigned int    shm_nattch;
0142     unsigned int    __unused1;
0143     unsigned int    __unused2;
0144 };
0145 
0146 #ifdef CONFIG_COMPAT
0147 static inline int is_compat_task(void)
0148 {
0149     return test_thread_flag(TIF_32BIT);
0150 }
0151 
0152 static inline bool in_compat_syscall(void)
0153 {
0154     /* Vector 0x110 is LINUX_32BIT_SYSCALL_TRAP */
0155     return pt_regs_trap_type(current_pt_regs()) == 0x110;
0156 }
0157 #define in_compat_syscall in_compat_syscall
0158 #endif
0159 
0160 #endif /* _ASM_SPARC64_COMPAT_H */