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) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) #include <linux/sched/task_stack.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/smp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/sem.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/msg.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/shm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/stat.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/syscalls.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/mman.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/file.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <linux/ipc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <asm/cacheflush.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/unistd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/syscalls.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)  * sys_pipe() is the normal C calling standard for creating
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)  * a pipe. It's not the way Unix traditionally does this, though.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) asmlinkage int sys_sh_pipe(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	int fd[2];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	error = do_pipe_flags(fd, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	if (!error) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		current_pt_regs()->regs[1] = fd[1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 		return fd[0];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) asmlinkage ssize_t sys_pread_wrapper(unsigned int fd, char __user *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 			     size_t count, long dummy, loff_t pos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	return ksys_pread64(fd, buf, count, pos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) asmlinkage ssize_t sys_pwrite_wrapper(unsigned int fd, const char __user *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 			      size_t count, long dummy, loff_t pos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	return ksys_pwrite64(fd, buf, count, pos);
^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) asmlinkage int sys_fadvise64_64_wrapper(int fd, u32 offset0, u32 offset1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 				u32 len0, u32 len1, int advice)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #ifdef  __LITTLE_ENDIAN__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	return ksys_fadvise64_64(fd, (u64)offset1 << 32 | offset0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 				 (u64)len1 << 32 | len0, advice);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	return ksys_fadvise64_64(fd, (u64)offset0 << 32 | offset1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 				 (u64)len0 << 32 | len1, advice);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) }