1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2005-2017 Andes Technology Corporation
4 #include <linux/linkage.h>
5 #include <asm/unistd.h>
6 #include <asm/assembler.h>
8 #include <asm/asm-offsets.h>
9 #include <asm/thread_info.h>
10 #include <asm/current.h>
13 * $r0 = previous task_struct,
14 * $r1 = next task_struct,
15 * previous and next are guaranteed not to be the same.
22 addi $p1, $r0, #THREAD_CPU_CONTEXT
23 smw.bi $r6, [$p1], $r14, #0xb ! push r6~r14, fp, lp, sp
25 #if defined(CONFIG_FPU)
28 addi $r1, $r25, #THREAD_CPU_CONTEXT
29 lmw.bi $r6, [$r1], $r14, #0xb ! pop r6~r14, fp, lp, sp
36 * $r7 will be writen as syscall nr
39 lwi $r7, [$sp + R15_OFFSET]
40 swi $r7, [$sp + SYSCALLNO_OFFSET]
44 addi $r17, $r13, #4 ! $r13 is $IPC
45 swi $r17, [$sp + IPC_OFFSET]
54 lwi $p0, [tsk+#TSK_TI_FLAGS] ! check for syscall tracing
56 andi $p1, $p0, #_TIF_WORK_SYSCALL_ENTRY ! are we tracing syscalls?
59 la $lp, ret_fast_syscall ! return address
61 addi $p1, $r7, #-__NR_syscalls ! syscall number of syscall instruction is guarded by addembler
62 bgez $p1, _SCNO_EXCEED ! call sys_* routine
63 la tbl, sys_call_table ! load syscall table pointer
75 * This is the really slow path. We're going to be doing
76 * context switches, and waiting for our parent to respond.
80 bal syscall_trace_enter
82 la $lp, __sys_trace_return ! return address
85 beqz $p1, ret_slow_syscall ! fatal signal is pending
87 addi $p1, $sp, #R0_OFFSET ! pointer to regs
88 lmw.bi $r0, [$p1], $r5 ! have to reload $r0 - $r5
92 swi $r0, [$sp+#R0_OFFSET] ! T: save returned $r0
93 move $r0, $sp ! set pt_regs for syscall_trace_leave
94 bal syscall_trace_leave
97 ENTRY(sys_rt_sigreturn_wrapper)
100 ENDPROC(sys_rt_sigreturn_wrapper)