^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _ASM_PARISC_COMPAT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _ASM_PARISC_COMPAT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Architecture specific compatibility types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/thread_info.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <asm-generic/compat.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define COMPAT_USER_HZ 100
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define COMPAT_UTS_MACHINE "parisc\0\0"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) typedef u32 __compat_uid_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) typedef u32 __compat_gid_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) typedef u32 __compat_uid32_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) typedef u32 __compat_gid32_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) typedef u16 compat_mode_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) typedef u32 compat_dev_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) typedef u16 compat_nlink_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) typedef u16 compat_ipc_pid_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) typedef u32 compat_caddr_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) struct compat_stat {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) compat_dev_t st_dev; /* dev_t is 32 bits on parisc */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) compat_ino_t st_ino; /* 32 bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) compat_mode_t st_mode; /* 16 bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) compat_nlink_t st_nlink; /* 16 bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) u16 st_reserved1; /* old st_uid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) u16 st_reserved2; /* old st_gid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) compat_dev_t st_rdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) compat_off_t st_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) old_time32_t st_atime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u32 st_atime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) old_time32_t st_mtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) u32 st_mtime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) old_time32_t st_ctime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) u32 st_ctime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) s32 st_blksize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) s32 st_blocks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) u32 __unused1; /* ACL stuff */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) compat_dev_t __unused2; /* network */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) compat_ino_t __unused3; /* network */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) u32 __unused4; /* cnodes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) u16 __unused5; /* netsite */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) short st_fstype;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) compat_dev_t st_realdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) u16 st_basemode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) u16 st_spareshort;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) __compat_uid32_t st_uid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) __compat_gid32_t st_gid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) u32 st_spare4[3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) struct compat_flock {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) short l_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) short l_whence;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) compat_off_t l_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) compat_off_t l_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) compat_pid_t l_pid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) struct compat_flock64 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) short l_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) short l_whence;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) compat_loff_t l_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) compat_loff_t l_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) compat_pid_t l_pid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) struct compat_statfs {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) s32 f_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) s32 f_bsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) s32 f_blocks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) s32 f_bfree;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) s32 f_bavail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) s32 f_files;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) s32 f_ffree;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) __kernel_fsid_t f_fsid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) s32 f_namelen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) s32 f_frsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) s32 f_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) s32 f_spare[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) struct compat_sigcontext {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) compat_int_t sc_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) compat_int_t sc_gr[32]; /* PSW in sc_gr[0] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) u64 sc_fr[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) compat_int_t sc_iasq[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) compat_int_t sc_iaoq[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) compat_int_t sc_sar; /* cr11 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) #define COMPAT_RLIM_INFINITY 0xffffffff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) typedef u32 compat_old_sigset_t; /* at least 32 bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #define _COMPAT_NSIG 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #define _COMPAT_NSIG_BPW 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) typedef u32 compat_sigset_word;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #define COMPAT_OFF_T_MAX 0x7fffffff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) struct compat_ipc64_perm {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) compat_key_t key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) __compat_uid_t uid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) __compat_gid_t gid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) __compat_uid_t cuid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) __compat_gid_t cgid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) unsigned short int __pad1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) compat_mode_t mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) unsigned short int __pad2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) unsigned short int seq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) unsigned int __pad3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) unsigned long __unused1; /* yes they really are 64bit pads */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) unsigned long __unused2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) struct compat_semid64_ds {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) struct compat_ipc64_perm sem_perm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) unsigned int sem_otime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) unsigned int sem_otime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) unsigned int sem_ctime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) unsigned int sem_ctime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) compat_ulong_t sem_nsems;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) compat_ulong_t __unused3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) compat_ulong_t __unused4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) struct compat_msqid64_ds {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) struct compat_ipc64_perm msg_perm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) unsigned int msg_stime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) unsigned int msg_stime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) unsigned int msg_rtime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) unsigned int msg_rtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) unsigned int msg_ctime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) unsigned int msg_ctime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) compat_ulong_t msg_cbytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) compat_ulong_t msg_qnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) compat_ulong_t msg_qbytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) compat_pid_t msg_lspid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) compat_pid_t msg_lrpid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) compat_ulong_t __unused4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) compat_ulong_t __unused5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) struct compat_shmid64_ds {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) struct compat_ipc64_perm shm_perm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) unsigned int shm_atime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) unsigned int shm_atime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) unsigned int shm_dtime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) unsigned int shm_dtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) unsigned int shm_ctime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) unsigned int shm_ctime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) unsigned int __unused4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) compat_size_t shm_segsz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) compat_pid_t shm_cpid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) compat_pid_t shm_lpid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) compat_ulong_t shm_nattch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) compat_ulong_t __unused5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) compat_ulong_t __unused6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) * The type of struct elf_prstatus.pr_reg in compatible core dumps.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) #define COMPAT_ELF_NGREG 80
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) typedef compat_ulong_t compat_elf_gregset_t[COMPAT_ELF_NGREG];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) static __inline__ void __user *arch_compat_alloc_user_space(long len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) struct pt_regs *regs = ¤t->thread.regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) return (void __user *)regs->gr[30];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) static inline int __is_compat_task(struct task_struct *t)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) return test_ti_thread_flag(task_thread_info(t), TIF_32BIT);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) static inline int is_compat_task(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) return __is_compat_task(current);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) #endif /* _ASM_PARISC_COMPAT_H */