scall32-o32.S (9f30a04d768f64280dc0c40b730746e82f298d88) scall32-o32.S (d218af78492a36a4ae607c08fedfb59258440314)
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995-99, 2000- 02, 06 Ralf Baechle <ralf@linux-mips.org>
7 * Copyright (C) 2001 MIPS Technologies, Inc.
8 * Copyright (C) 2004 Thiemo Seufer

--- 22 unchanged lines hidden (view full) ---

31 SAVE_SOME
32 TRACE_IRQS_ON_RELOAD
33 STI
34 .set at
35
36 lw t1, PT_EPC(sp) # skip syscall on return
37
38 subu v0, v0, __NR_O32_Linux # check syscall number
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1995-99, 2000- 02, 06 Ralf Baechle <ralf@linux-mips.org>
7 * Copyright (C) 2001 MIPS Technologies, Inc.
8 * Copyright (C) 2004 Thiemo Seufer

--- 22 unchanged lines hidden (view full) ---

31 SAVE_SOME
32 TRACE_IRQS_ON_RELOAD
33 STI
34 .set at
35
36 lw t1, PT_EPC(sp) # skip syscall on return
37
38 subu v0, v0, __NR_O32_Linux # check syscall number
39 sltiu t0, v0, __NR_O32_Linux_syscalls + 1
40 addiu t1, 4 # skip to next instruction
41 sw t1, PT_EPC(sp)
39 addiu t1, 4 # skip to next instruction
40 sw t1, PT_EPC(sp)
42 beqz t0, illegal_syscall
43
41
44 sll t0, v0, 2
45 la t1, sys_call_table
46 addu t1, t0
47 lw t2, (t1) # syscall routine
48 beqz t2, illegal_syscall
49
50 sw a3, PT_R26(sp) # save a3 for syscall restarting
51
52 /*
53 * More than four arguments. Try to deal with it by copying the
54 * stack arguments from the user stack to the kernel stack.
55 * This Sucks (TM).
56 */
57 lw t0, PT_R29(sp) # get old user stack pointer

--- 33 unchanged lines hidden (view full) ---

91 PTR load_a6, bad_stack_a6
92 PTR load_a7, bad_stack_a7
93 .previous
94
95 lw t0, TI_FLAGS($28) # syscall tracing enabled?
96 li t1, _TIF_WORK_SYSCALL_ENTRY
97 and t0, t1
98 bnez t0, syscall_trace_entry # -> yes
42 sw a3, PT_R26(sp) # save a3 for syscall restarting
43
44 /*
45 * More than four arguments. Try to deal with it by copying the
46 * stack arguments from the user stack to the kernel stack.
47 * This Sucks (TM).
48 */
49 lw t0, PT_R29(sp) # get old user stack pointer

--- 33 unchanged lines hidden (view full) ---

83 PTR load_a6, bad_stack_a6
84 PTR load_a7, bad_stack_a7
85 .previous
86
87 lw t0, TI_FLAGS($28) # syscall tracing enabled?
88 li t1, _TIF_WORK_SYSCALL_ENTRY
89 and t0, t1
90 bnez t0, syscall_trace_entry # -> yes
91syscall_common:
92 sltiu t0, v0, __NR_O32_Linux_syscalls + 1
93 beqz t0, illegal_syscall
99
94
95 sll t0, v0, 2
96 la t1, sys_call_table
97 addu t1, t0
98 lw t2, (t1) # syscall routine
99
100 beqz t2, illegal_syscall
101
100 jalr t2 # Do The Real Thing (TM)
101
102 li t0, -EMAXERRNO - 1 # error?
103 sltu t0, t0, v0
104 sw t0, PT_R7(sp) # set error flag
105 beqz t0, 1f
106
107 lw t1, PT_R2(sp) # syscall number
108 negu v0 # error
109 sw t1, PT_R0(sp) # save it for syscall restarting
1101: sw v0, PT_R2(sp) # result
111
112o32_syscall_exit:
113 j syscall_exit_partial
114
115/* ------------------------------------------------------------------------ */
116
117syscall_trace_entry:
118 SAVE_STATIC
102 jalr t2 # Do The Real Thing (TM)
103
104 li t0, -EMAXERRNO - 1 # error?
105 sltu t0, t0, v0
106 sw t0, PT_R7(sp) # set error flag
107 beqz t0, 1f
108
109 lw t1, PT_R2(sp) # syscall number
110 negu v0 # error
111 sw t1, PT_R0(sp) # save it for syscall restarting
1121: sw v0, PT_R2(sp) # result
113
114o32_syscall_exit:
115 j syscall_exit_partial
116
117/* ------------------------------------------------------------------------ */
118
119syscall_trace_entry:
120 SAVE_STATIC
119 move s0, t2
121 move s0, v0
120 move a0, sp
121
122 /*
123 * syscall number is in v0 unless we called syscall(__NR_###)
124 * where the real syscall number is in a0
125 */
126 addiu a1, v0, __NR_O32_Linux
127 bnez v0, 1f /* __NR_syscall at offset 0 */
128 lw a1, PT_R4(sp)
129
1301: jal syscall_trace_enter
131
122 move a0, sp
123
124 /*
125 * syscall number is in v0 unless we called syscall(__NR_###)
126 * where the real syscall number is in a0
127 */
128 addiu a1, v0, __NR_O32_Linux
129 bnez v0, 1f /* __NR_syscall at offset 0 */
130 lw a1, PT_R4(sp)
131
1321: jal syscall_trace_enter
133
132 bltz v0, 2f # seccomp failed? Skip syscall
134 bltz v0, 1f # seccomp failed? Skip syscall
133
135
134 move t0, s0
136 move v0, s0 # restore syscall
137
135 RESTORE_STATIC
136 lw a0, PT_R4(sp) # Restore argument registers
137 lw a1, PT_R5(sp)
138 lw a2, PT_R6(sp)
139 lw a3, PT_R7(sp)
138 RESTORE_STATIC
139 lw a0, PT_R4(sp) # Restore argument registers
140 lw a1, PT_R5(sp)
141 lw a2, PT_R6(sp)
142 lw a3, PT_R7(sp)
140 jalr t0
143 j syscall_common
141
144
142 li t0, -EMAXERRNO - 1 # error?
143 sltu t0, t0, v0
144 sw t0, PT_R7(sp) # set error flag
145 beqz t0, 1f
1451: j syscall_exit
146
146
147 lw t1, PT_R2(sp) # syscall number
148 negu v0 # error
149 sw t1, PT_R0(sp) # save it for syscall restarting
1501: sw v0, PT_R2(sp) # result
151
1522: j syscall_exit
153
154/* ------------------------------------------------------------------------ */
155
156 /*
157 * Our open-coded access area sanity test for the stack pointer
158 * failed. We probably should handle this case a bit more drastic.
159 */
160bad_stack:
161 li v0, EFAULT

--- 432 unchanged lines hidden (view full) ---

594 PTR sys_sched_setattr
595 PTR sys_sched_getattr /* 4350 */
596 PTR sys_renameat2
597 PTR sys_seccomp
598 PTR sys_getrandom
599 PTR sys_memfd_create
600 PTR sys_bpf /* 4355 */
601 PTR sys_execveat
147/* ------------------------------------------------------------------------ */
148
149 /*
150 * Our open-coded access area sanity test for the stack pointer
151 * failed. We probably should handle this case a bit more drastic.
152 */
153bad_stack:
154 li v0, EFAULT

--- 432 unchanged lines hidden (view full) ---

587 PTR sys_sched_setattr
588 PTR sys_sched_getattr /* 4350 */
589 PTR sys_renameat2
590 PTR sys_seccomp
591 PTR sys_getrandom
592 PTR sys_memfd_create
593 PTR sys_bpf /* 4355 */
594 PTR sys_execveat
595 PTR sys_userfaultfd
596 PTR sys_membarrier