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-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Access to user system call parameters and results
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * See asm-generic/syscall.h for function descriptions.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Copyright (C) 2015 Mickaël Salaün <mic@digikod.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifndef __UM_SYSCALL_GENERIC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define __UM_SYSCALL_GENERIC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <asm/ptrace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <sysdep/ptrace.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	return PT_REGS_SYSCALL_NR(regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) static inline void syscall_rollback(struct task_struct *task,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 				    struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	/* do nothing */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static inline long syscall_get_error(struct task_struct *task,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 				     struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	const long error = regs_return_value(regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	return IS_ERR_VALUE(error) ? error : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) static inline long syscall_get_return_value(struct task_struct *task,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 					    struct pt_regs *regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	return regs_return_value(regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) static inline void syscall_set_return_value(struct task_struct *task,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 					    struct pt_regs *regs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 					    int error, long val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	PT_REGS_SET_SYSCALL_RETURN(regs, (long) error ?: val);
^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) static inline void syscall_get_arguments(struct task_struct *task,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 					 struct pt_regs *regs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 					 unsigned long *args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	const struct uml_pt_regs *r = &regs->regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	*args++ = UPT_SYSCALL_ARG1(r);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	*args++ = UPT_SYSCALL_ARG2(r);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	*args++ = UPT_SYSCALL_ARG3(r);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	*args++ = UPT_SYSCALL_ARG4(r);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	*args++ = UPT_SYSCALL_ARG5(r);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	*args   = UPT_SYSCALL_ARG6(r);
^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) static inline void syscall_set_arguments(struct task_struct *task,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 					 struct pt_regs *regs,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 					 const unsigned long *args)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	struct uml_pt_regs *r = &regs->regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 	UPT_SYSCALL_ARG1(r) = *args++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	UPT_SYSCALL_ARG2(r) = *args++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	UPT_SYSCALL_ARG3(r) = *args++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	UPT_SYSCALL_ARG4(r) = *args++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	UPT_SYSCALL_ARG5(r) = *args++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 	UPT_SYSCALL_ARG6(r) = *args;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) /* See arch/x86/um/asm/syscall.h for syscall_get_arch() definition. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) #endif	/* __UM_SYSCALL_GENERIC_H */