forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/arch/arc/kernel/entry.S
....@@ -1,13 +1,10 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Common Low Level Interrupts/Traps/Exceptions(non-TLB) Handling for ARC
34 * (included from entry-<isa>.S
45 *
56 * Copyright (C) 2014-15 Synopsys, Inc. (www.synopsys.com)
67 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
118 */
129
1310 /*------------------------------------------------------------------
....@@ -37,6 +34,18 @@
3734
3835 b .Lret_from_system_call
3936 END(sys_clone_wrapper)
37
+
38
+ENTRY(sys_clone3_wrapper)
39
+ SAVE_CALLEE_SAVED_USER
40
+ bl @sys_clone3
41
+ DISCARD_CALLEE_SAVED_USER
42
+
43
+ GET_CURR_THR_INFO_FLAGS r10
44
+ btst r10, TIF_SYSCALL_TRACE
45
+ bnz tracesys_exit
46
+
47
+ b .Lret_from_system_call
48
+END(sys_clone3_wrapper)
4049
4150 ENTRY(ret_from_fork)
4251 ; when the forked child comes here from the __switch_to function
....@@ -156,7 +165,6 @@
156165 tracesys:
157166 ; save EFA in case tracer wants the PC of traced task
158167 ; using ERET won't work since next-PC has already committed
159
- lr r12, [efa]
160168 GET_CURR_TASK_FIELD_PTR TASK_THREAD, r11
161169 st r12, [r11, THREAD_FAULT_ADDR] ; thread.fault_address
162170
....@@ -191,6 +199,7 @@
191199 st r0, [sp, PT_r0] ; sys call return value in pt_regs
192200
193201 ;POST Sys Call Ptrace Hook
202
+ mov r0, sp ; pt_regs needed
194203 bl @syscall_trace_exit
195204 b ret_from_exception ; NOT ret_from_system_call at is saves r0 which
196205 ; we'd done before calling post hook above
....@@ -199,14 +208,8 @@
199208 ; Breakpoint TRAP
200209 ; ---------------------------------------------
201210 trap_with_param:
202
-
203
- ; stop_pc info by gdb needs this info
204
- lr r0, [efa]
211
+ mov r0, r12 ; EFA in case ptracer/gdb wants stop_pc
205212 mov r1, sp
206
-
207
- ; Now that we have read EFA, it is safe to do "fake" rtie
208
- ; and get out of CPU exception mode
209
- FAKE_RET_FROM_EXCPN
210213
211214 ; Save callee regs in case gdb wants to have a look
212215 ; SP will grow up by size of CALLEE Reg-File
....@@ -234,15 +237,16 @@
234237
235238 EXCEPTION_PROLOGUE
236239
240
+ lr r12, [efa]
241
+
242
+ FAKE_RET_FROM_EXCPN
243
+
237244 ;============ TRAP 1 :breakpoints
238
- ; Check ECR for trap with arg (PROLOGUE ensures r9 has ECR)
239
- bmsk.f 0, r9, 7
245
+ ; Check ECR for trap with arg (PROLOGUE ensures r10 has ECR)
246
+ bmsk.f 0, r10, 7
240247 bnz trap_with_param
241248
242249 ;============ TRAP (no param): syscall top level
243
-
244
- ; First return from Exception to pure K mode (Exception/IRQs renabled)
245
- FAKE_RET_FROM_EXCPN
246250
247251 ; If syscall tracing ongoing, invoke pre-post-hooks
248252 GET_CURR_THR_INFO_FLAGS r10
....@@ -304,7 +308,8 @@
304308 mov r0, sp ; pt_regs for arg to do_signal()/do_notify_resume()
305309
306310 GET_CURR_THR_INFO_FLAGS r9
307
- bbit0 r9, TIF_SIGPENDING, .Lchk_notify_resume
311
+ and.f 0, r9, _TIF_SIGPENDING|_TIF_NOTIFY_SIGNAL
312
+ bz .Lchk_notify_resume
308313
309314 ; Normal Trap/IRQ entry only saves Scratch (caller-saved) regs
310315 ; in pt_reg since the "C" ABI (kernel code) will automatically
....@@ -340,11 +345,11 @@
340345 resume_kernel_mode:
341346
342347 ; Disable Interrupts from this point on
343
- ; CONFIG_PREEMPT: This is a must for preempt_schedule_irq()
344
- ; !CONFIG_PREEMPT: To ensure restore_regs is intr safe
348
+ ; CONFIG_PREEMPTION: This is a must for preempt_schedule_irq()
349
+ ; !CONFIG_PREEMPTION: To ensure restore_regs is intr safe
345350 IRQ_DISABLE r9
346351
347
-#ifdef CONFIG_PREEMPT
352
+#ifdef CONFIG_PREEMPTION
348353
349354 ; Can't preempt if preemption disabled
350355 GET_CURR_THR_INFO_FROM_SP r10