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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2)  * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * License.  See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Copyright (C) 1995, 96, 97, 98, 99, 2000, 01 by Ralf Baechle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * Copyright (C) 2001 MIPS Technologies, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <asm/asm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <asm/asmmacro.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <asm/irqflags.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <asm/mipsregs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <asm/regdef.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <asm/stackframe.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <asm/thread_info.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <asm/unistd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #ifndef CONFIG_MIPS32_O32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) /* No O32, so define handle_sys here */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define handle_sysn32 handle_sys
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	.align	5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) NESTED(handle_sysn32, PT_SIZE, sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #ifndef CONFIG_MIPS32_O32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	.set	noat
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	SAVE_SOME
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	TRACE_IRQS_ON_RELOAD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	STI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 	.set	at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	dsubu	t0, v0, __NR_N32_Linux	# check syscall number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	sltiu	t0, t0, __NR_N32_Linux_syscalls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #ifndef CONFIG_MIPS32_O32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	ld	t1, PT_EPC(sp)		# skip syscall on return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	daddiu	t1, 4			# skip to next instruction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	sd	t1, PT_EPC(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	beqz	t0, not_n32_scall
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	sd	a3, PT_R26(sp)		# save a3 for syscall restarting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	li	t1, _TIF_WORK_SYSCALL_ENTRY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	LONG_L	t0, TI_FLAGS($28)	# syscall tracing enabled?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	and	t0, t1, t0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	bnez	t0, n32_syscall_trace_entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) syscall_common:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	dsll	t0, v0, 3		# offset into table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	ld	t2, (sysn32_call_table - (__NR_N32_Linux * 8))(t0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	jalr	t2			# Do The Real Thing (TM)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	li	t0, -EMAXERRNO - 1	# error?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	sltu	t0, t0, v0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	sd	t0, PT_R7(sp)		# set error flag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	beqz	t0, 1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	ld	t1, PT_R2(sp)		# syscall number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	dnegu	v0			# error
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	sd	t1, PT_R0(sp)		# save it for syscall restarting
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 1:	sd	v0, PT_R2(sp)		# result
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	j	syscall_exit_partial
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) n32_syscall_trace_entry:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	SAVE_STATIC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	move	a0, sp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	move	a1, v0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	jal	syscall_trace_enter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	bltz	v0, 1f			# seccomp failed? Skip syscall
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	RESTORE_STATIC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	ld	v0, PT_R2(sp)		# Restore syscall (maybe modified)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	ld	a0, PT_R4(sp)		# Restore argument registers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	ld	a1, PT_R5(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	ld	a2, PT_R6(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	ld	a3, PT_R7(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	ld	a4, PT_R8(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	ld	a5, PT_R9(sp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	dsubu	t2, v0, __NR_N32_Linux	# check (new) syscall number
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	sltiu   t0, t2, __NR_N32_Linux_syscalls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	beqz	t0, not_n32_scall
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	j	syscall_common
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 1:	j	syscall_exit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) not_n32_scall:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	/* This is not an n32 compatibility syscall, pass it on to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	   the n64 syscall handlers.  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	j	handle_sys64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	END(handle_sysn32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) #define __SYSCALL(nr, entry)	PTR entry
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	.type	sysn32_call_table, @object
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) EXPORT(sysn32_call_table)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #include <asm/syscall_table_64_n32.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #undef __SYSCALL