1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Copyright (C) 2020 Collabora Ltd.
4  */
5 #ifndef _SYSCALL_USER_DISPATCH_H
6 #define _SYSCALL_USER_DISPATCH_H
7 
8 #include <linux/thread_info.h>
9 
10 #ifdef CONFIG_GENERIC_ENTRY
11 
12 struct syscall_user_dispatch {
13 	char __user	*selector;
14 	unsigned long	offset;
15 	unsigned long	len;
16 	bool		on_dispatch;
17 };
18 
19 int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,
20 			      unsigned long len, char __user *selector);
21 
22 #define clear_syscall_work_syscall_user_dispatch(tsk) \
23 	clear_task_syscall_work(tsk, SYSCALL_USER_DISPATCH)
24 
25 int syscall_user_dispatch_get_config(struct task_struct *task, unsigned long size,
26 				     void __user *data);
27 
28 int syscall_user_dispatch_set_config(struct task_struct *task, unsigned long size,
29 				     void __user *data);
30 
31 #else
32 struct syscall_user_dispatch {};
33 
set_syscall_user_dispatch(unsigned long mode,unsigned long offset,unsigned long len,char __user * selector)34 static inline int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,
35 					    unsigned long len, char __user *selector)
36 {
37 	return -EINVAL;
38 }
39 
clear_syscall_work_syscall_user_dispatch(struct task_struct * tsk)40 static inline void clear_syscall_work_syscall_user_dispatch(struct task_struct *tsk)
41 {
42 }
43 
syscall_user_dispatch_get_config(struct task_struct * task,unsigned long size,void __user * data)44 static inline int syscall_user_dispatch_get_config(struct task_struct *task,
45 						   unsigned long size, void __user *data)
46 {
47 	return -EINVAL;
48 }
49 
syscall_user_dispatch_set_config(struct task_struct * task,unsigned long size,void __user * data)50 static inline int syscall_user_dispatch_set_config(struct task_struct *task,
51 						   unsigned long size, void __user *data)
52 {
53 	return -EINVAL;
54 }
55 
56 #endif /* CONFIG_GENERIC_ENTRY */
57 
58 #endif /* _SYSCALL_USER_DISPATCH_H */
59