Linux Audio

Check our new training course

Loading...
v5.4
  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#ifdef CONFIG_COMPAT
  8
  9/*
 10 * Architecture specific compatibility types
 11 */
 12#include <linux/types.h>
 13#include <linux/sched.h>
 14#include <linux/sched/task_stack.h>
 15
 16#include <asm-generic/compat.h>
 17
 18#define COMPAT_USER_HZ		100
 19#ifdef __AARCH64EB__
 20#define COMPAT_UTS_MACHINE	"armv8b\0\0"
 21#else
 22#define COMPAT_UTS_MACHINE	"armv8l\0\0"
 23#endif
 24
 25typedef u16		__compat_uid_t;
 26typedef u16		__compat_gid_t;
 27typedef u16		__compat_uid16_t;
 28typedef u16		__compat_gid16_t;
 29typedef u32		__compat_uid32_t;
 30typedef u32		__compat_gid32_t;
 31typedef u16		compat_mode_t;
 32typedef u32		compat_dev_t;
 33typedef s32		compat_nlink_t;
 34typedef u16		compat_ipc_pid_t;
 35typedef u32		compat_caddr_t;
 36typedef __kernel_fsid_t	compat_fsid_t;
 37typedef s64		compat_s64;
 38typedef u64		compat_u64;
 39
 40struct compat_stat {
 41#ifdef __AARCH64EB__
 42	short		st_dev;
 43	short		__pad1;
 44#else
 45	compat_dev_t	st_dev;
 46#endif
 47	compat_ino_t	st_ino;
 48	compat_mode_t	st_mode;
 49	compat_ushort_t	st_nlink;
 50	__compat_uid16_t	st_uid;
 51	__compat_gid16_t	st_gid;
 52#ifdef __AARCH64EB__
 53	short		st_rdev;
 54	short		__pad2;
 55#else
 56	compat_dev_t	st_rdev;
 57#endif
 58	compat_off_t	st_size;
 59	compat_off_t	st_blksize;
 60	compat_off_t	st_blocks;
 61	old_time32_t	st_atime;
 62	compat_ulong_t	st_atime_nsec;
 63	old_time32_t	st_mtime;
 64	compat_ulong_t	st_mtime_nsec;
 65	old_time32_t	st_ctime;
 66	compat_ulong_t	st_ctime_nsec;
 67	compat_ulong_t	__unused4[2];
 68};
 69
 70struct compat_flock {
 71	short		l_type;
 72	short		l_whence;
 73	compat_off_t	l_start;
 74	compat_off_t	l_len;
 75	compat_pid_t	l_pid;
 76};
 77
 78#define F_GETLK64	12	/*  using 'struct flock64' */
 79#define F_SETLK64	13
 80#define F_SETLKW64	14
 81
 82struct compat_flock64 {
 83	short		l_type;
 84	short		l_whence;
 85	compat_loff_t	l_start;
 86	compat_loff_t	l_len;
 87	compat_pid_t	l_pid;
 88};
 89
 90struct compat_statfs {
 91	int		f_type;
 92	int		f_bsize;
 93	int		f_blocks;
 94	int		f_bfree;
 95	int		f_bavail;
 96	int		f_files;
 97	int		f_ffree;
 98	compat_fsid_t	f_fsid;
 99	int		f_namelen;	/* SunOS ignores this field. */
100	int		f_frsize;
101	int		f_flags;
102	int		f_spare[4];
103};
104
105#define COMPAT_RLIM_INFINITY		0xffffffff
106
107typedef u32		compat_old_sigset_t;
108
109#define _COMPAT_NSIG		64
110#define _COMPAT_NSIG_BPW	32
111
112typedef u32		compat_sigset_word;
113
114#define COMPAT_OFF_T_MAX	0x7fffffff
115
116/*
117 * A pointer passed in from user mode. This should not
118 * be used for syscall parameters, just declare them
119 * as pointers because the syscall entry code will have
120 * appropriately converted them already.
121 */
122
123static inline void __user *compat_ptr(compat_uptr_t uptr)
124{
125	return (void __user *)(unsigned long)uptr;
126}
127
128static inline compat_uptr_t ptr_to_compat(void __user *uptr)
129{
130	return (u32)(unsigned long)uptr;
131}
132
133#define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
134#define COMPAT_MINSIGSTKSZ	2048
135
136static inline void __user *arch_compat_alloc_user_space(long len)
137{
138	return (void __user *)compat_user_stack_pointer() - len;
139}
140
141struct compat_ipc64_perm {
142	compat_key_t key;
143	__compat_uid32_t uid;
144	__compat_gid32_t gid;
145	__compat_uid32_t cuid;
146	__compat_gid32_t cgid;
147	unsigned short mode;
148	unsigned short __pad1;
149	unsigned short seq;
150	unsigned short __pad2;
151	compat_ulong_t unused1;
152	compat_ulong_t unused2;
153};
154
155struct compat_semid64_ds {
156	struct compat_ipc64_perm sem_perm;
157	compat_ulong_t sem_otime;
158	compat_ulong_t sem_otime_high;
159	compat_ulong_t sem_ctime;
160	compat_ulong_t sem_ctime_high;
161	compat_ulong_t sem_nsems;
162	compat_ulong_t __unused3;
163	compat_ulong_t __unused4;
164};
165
166struct compat_msqid64_ds {
167	struct compat_ipc64_perm msg_perm;
168	compat_ulong_t msg_stime;
169	compat_ulong_t msg_stime_high;
170	compat_ulong_t msg_rtime;
171	compat_ulong_t msg_rtime_high;
172	compat_ulong_t msg_ctime;
173	compat_ulong_t msg_ctime_high;
174	compat_ulong_t msg_cbytes;
175	compat_ulong_t msg_qnum;
176	compat_ulong_t msg_qbytes;
177	compat_pid_t   msg_lspid;
178	compat_pid_t   msg_lrpid;
179	compat_ulong_t __unused4;
180	compat_ulong_t __unused5;
181};
182
183struct compat_shmid64_ds {
184	struct compat_ipc64_perm shm_perm;
185	compat_size_t  shm_segsz;
186	compat_ulong_t shm_atime;
187	compat_ulong_t shm_atime_high;
188	compat_ulong_t shm_dtime;
189	compat_ulong_t shm_dtime_high;
190	compat_ulong_t shm_ctime;
191	compat_ulong_t shm_ctime_high;
192	compat_pid_t   shm_cpid;
193	compat_pid_t   shm_lpid;
194	compat_ulong_t shm_nattch;
195	compat_ulong_t __unused4;
196	compat_ulong_t __unused5;
197};
198
199static inline int is_compat_task(void)
200{
201	return test_thread_flag(TIF_32BIT);
202}
203
204static inline int is_compat_thread(struct thread_info *thread)
205{
206	return test_ti_thread_flag(thread, TIF_32BIT);
207}
 
 
208
209#else /* !CONFIG_COMPAT */
210
211static inline int is_compat_thread(struct thread_info *thread)
212{
213	return 0;
214}
215
216#endif /* CONFIG_COMPAT */
217#endif /* __ASM_COMPAT_H */
v6.8
  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
  9typedef u16		compat_mode_t;
 10
 11#define __compat_uid_t	__compat_uid_t
 12typedef u16		__compat_uid_t;
 13typedef u16		__compat_gid_t;
 14
 15#define compat_ipc_pid_t compat_ipc_pid_t
 16typedef 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#ifdef __AARCH64EB__
 32#define COMPAT_UTS_MACHINE	"armv8b\0\0"
 33#else
 34#define COMPAT_UTS_MACHINE	"armv8l\0\0"
 35#endif
 36
 
 
 37typedef u16		__compat_uid16_t;
 38typedef u16		__compat_gid16_t;
 
 
 
 
 39typedef s32		compat_nlink_t;
 
 
 
 
 
 40
 41struct compat_stat {
 42#ifdef __AARCH64EB__
 43	short		st_dev;
 44	short		__pad1;
 45#else
 46	compat_dev_t	st_dev;
 47#endif
 48	compat_ino_t	st_ino;
 49	compat_mode_t	st_mode;
 50	compat_ushort_t	st_nlink;
 51	__compat_uid16_t	st_uid;
 52	__compat_gid16_t	st_gid;
 53#ifdef __AARCH64EB__
 54	short		st_rdev;
 55	short		__pad2;
 56#else
 57	compat_dev_t	st_rdev;
 58#endif
 59	compat_off_t	st_size;
 60	compat_off_t	st_blksize;
 61	compat_off_t	st_blocks;
 62	old_time32_t	st_atime;
 63	compat_ulong_t	st_atime_nsec;
 64	old_time32_t	st_mtime;
 65	compat_ulong_t	st_mtime_nsec;
 66	old_time32_t	st_ctime;
 67	compat_ulong_t	st_ctime_nsec;
 68	compat_ulong_t	__unused4[2];
 69};
 70
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 71struct compat_statfs {
 72	int		f_type;
 73	int		f_bsize;
 74	int		f_blocks;
 75	int		f_bfree;
 76	int		f_bavail;
 77	int		f_files;
 78	int		f_ffree;
 79	compat_fsid_t	f_fsid;
 80	int		f_namelen;	/* SunOS ignores this field. */
 81	int		f_frsize;
 82	int		f_flags;
 83	int		f_spare[4];
 84};
 85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 86#define compat_user_stack_pointer() (user_stack_pointer(task_pt_regs(current)))
 87#define COMPAT_MINSIGSTKSZ	2048
 88
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 89static inline int is_compat_task(void)
 90{
 91	return test_thread_flag(TIF_32BIT);
 92}
 93
 94static inline int is_compat_thread(struct thread_info *thread)
 95{
 96	return test_ti_thread_flag(thread, TIF_32BIT);
 97}
 98
 99long compat_arm_syscall(struct pt_regs *regs, int scno);
100
101#else /* !CONFIG_COMPAT */
102
103static inline int is_compat_thread(struct thread_info *thread)
104{
105	return 0;
106}
107
108#endif /* CONFIG_COMPAT */
109#endif /* __ASM_COMPAT_H */