Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^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_POWERPC_COMPAT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define _ASM_POWERPC_COMPAT_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) #ifdef __KERNEL__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Architecture specific compatibility types
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/sched.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) #ifdef __BIG_ENDIAN__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #define COMPAT_UTS_MACHINE	"ppc\0\0"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #define COMPAT_UTS_MACHINE	"ppcle\0\0"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) typedef u32		__compat_uid_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) typedef u32		__compat_gid_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) typedef u32		__compat_uid32_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) typedef u32		__compat_gid32_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) typedef u32		compat_mode_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) typedef u32		compat_dev_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) typedef s16		compat_nlink_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) typedef u16		compat_ipc_pid_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) typedef u32		compat_caddr_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) typedef __kernel_fsid_t	compat_fsid_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) struct compat_stat {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	compat_dev_t	st_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	compat_ino_t	st_ino;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	compat_mode_t	st_mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	compat_nlink_t	st_nlink;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	__compat_uid32_t	st_uid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	__compat_gid32_t	st_gid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	compat_dev_t	st_rdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	compat_off_t	st_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	compat_off_t	st_blksize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	compat_off_t	st_blocks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	old_time32_t	st_atime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	u32		st_atime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	old_time32_t	st_mtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	u32		st_mtime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	old_time32_t	st_ctime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	u32		st_ctime_nsec;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	u32		__unused4[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) struct compat_flock {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	short		l_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	short		l_whence;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	compat_off_t	l_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	compat_off_t	l_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	compat_pid_t	l_pid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) #define F_GETLK64	12	/*  using 'struct flock64' */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) #define F_SETLK64	13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #define F_SETLKW64	14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) struct compat_flock64 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	short		l_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	short		l_whence;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	compat_loff_t	l_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	compat_loff_t	l_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	compat_pid_t	l_pid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) struct compat_statfs {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	int		f_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	int		f_bsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	int		f_blocks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	int		f_bfree;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	int		f_bavail;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	int		f_files;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	int		f_ffree;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	compat_fsid_t	f_fsid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	int		f_namelen;	/* SunOS ignores this field. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	int		f_frsize;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	int		f_flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	int		f_spare[4];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) #define COMPAT_RLIM_INFINITY		0xffffffff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) typedef u32		compat_old_sigset_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) #define _COMPAT_NSIG		64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) #define _COMPAT_NSIG_BPW	32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) typedef u32		compat_sigset_word;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) #define COMPAT_OFF_T_MAX	0x7fffffff
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) static inline void __user *arch_compat_alloc_user_space(long len)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	struct pt_regs *regs = current->thread.regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	unsigned long usp = regs->gpr[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	 * We can't access below the stack pointer in the 32bit ABI and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	 * can access 288 bytes in the 64bit big-endian ABI,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	 * or 512 bytes with the new ELFv2 little-endian ABI.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	if (!is_32bit_task())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		usp -= USER_REDZONE_SIZE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	return (void __user *) (usp - len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114)  * ipc64_perm is actually 32/64bit clean but since the compat layer refers to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)  * it we may as well define it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) struct compat_ipc64_perm {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	compat_key_t key;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	__compat_uid_t uid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	__compat_gid_t gid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	__compat_uid_t cuid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	__compat_gid_t cgid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	compat_mode_t mode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	unsigned int seq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	unsigned int __pad2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	unsigned long __unused1;	/* yes they really are 64bit pads */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	unsigned long __unused2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) struct compat_semid64_ds {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	struct compat_ipc64_perm sem_perm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	unsigned int sem_otime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	unsigned int sem_otime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	unsigned int sem_ctime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	unsigned int sem_ctime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	compat_ulong_t sem_nsems;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	compat_ulong_t __unused3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	compat_ulong_t __unused4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) struct compat_msqid64_ds {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	struct compat_ipc64_perm msg_perm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	unsigned int msg_stime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	unsigned int msg_stime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	unsigned int msg_rtime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	unsigned int msg_rtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	unsigned int msg_ctime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	unsigned int msg_ctime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	compat_ulong_t msg_cbytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	compat_ulong_t msg_qnum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	compat_ulong_t msg_qbytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	compat_pid_t msg_lspid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	compat_pid_t msg_lrpid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	compat_ulong_t __unused4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	compat_ulong_t __unused5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) struct compat_shmid64_ds {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	struct compat_ipc64_perm shm_perm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	unsigned int shm_atime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	unsigned int shm_atime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	unsigned int shm_dtime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	unsigned int shm_dtime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	unsigned int shm_ctime_high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	unsigned int shm_ctime;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	unsigned int __unused4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	compat_size_t shm_segsz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	compat_pid_t shm_cpid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	compat_pid_t shm_lpid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	compat_ulong_t shm_nattch;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	compat_ulong_t __unused5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	compat_ulong_t __unused6;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) static inline int is_compat_task(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	return is_32bit_task();
^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) #endif /* __KERNEL__ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) #endif /* _ASM_POWERPC_COMPAT_H */