hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
kernel/arch/arm/kernel/entry-common.S
....@@ -3,6 +3,7 @@
33 * linux/arch/arm/kernel/entry-common.S
44 *
55 * Copyright (C) 2000 Russell King
6
+ * Copyright (C) 2005 Stelian Pop.
67 */
78
89 #include <asm/assembler.h>
....@@ -12,6 +13,7 @@
1213 #include <asm/memory.h>
1314 #ifdef CONFIG_AEABI
1415 #include <asm/unistd-oabi.h>
16
+#include <uapi/asm-generic/dovetail.h>
1517 #endif
1618
1719 .equ NR_syscalls, __NR_syscalls
....@@ -54,6 +56,8 @@
5456 blne addr_limit_check_failed
5557 ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing
5658 movs r1, r1, lsl #16
59
+ ldr r2, =#_TIF_SYSCALL_WORK | _TIF_WORK_MASK
60
+ ands r2, r1, r2
5761 bne fast_work_pending
5862
5963
....@@ -91,6 +95,8 @@
9195 blne addr_limit_check_failed
9296 ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing
9397 movs r1, r1, lsl #16
98
+ ldr r2, =#_TIF_SYSCALL_WORK | _TIF_WORK_MASK
99
+ ands r2, r1, r2
94100 beq no_work_pending
95101 UNWIND(.fnend )
96102 ENDPROC(ret_fast_syscall)
....@@ -132,6 +138,8 @@
132138 blne addr_limit_check_failed
133139 ldr r1, [tsk, #TI_FLAGS]
134140 movs r1, r1, lsl #16
141
+ ldr r2, =#_TIF_WORK_MASK
142
+ ands r2, r1, r2
135143 bne slow_work_pending
136144 no_work_pending:
137145 asm_trace_hardirqs_on save = 0
....@@ -143,6 +151,10 @@
143151 restore_user_regs fast = 0, offset = 0
144152 ENDPROC(ret_to_user_from_irq)
145153 ENDPROC(ret_to_user)
154
+ENTRY(fast_ret_to_user)
155
+ disable_irq_notrace @ disable interrupts
156
+ b no_work_pending
157
+ENDPROC(fast_ret_to_user)
146158
147159 /*
148160 * This is how we return from a fork.
....@@ -265,6 +277,9 @@
265277 eor scno, scno, #__NR_SYSCALL_BASE @ check OS number
266278 #endif
267279 get_thread_info tsk
280
+#ifdef CONFIG_DOVETAIL
281
+ str scno, [tsk, #TI_SYSCALL]
282
+#endif
268283 /*
269284 * Reload the registers that may have been corrupted on entry to
270285 * the syscall assembly (by tracing or context tracking.)
....@@ -272,6 +287,70 @@
272287 TRACE( ldmia sp, {r0 - r3} )
273288
274289 local_restart:
290
+#ifdef CONFIG_DOVETAIL
291
+ ldr r10, [tsk, #TI_LOCAL_FLAGS] @ tsk(r10) is callee-saved
292
+#ifdef CONFIG_IPIPE_COMPAT
293
+ ldr r0, =#0xf0042 @ old syscall signature
294
+ cmp scno, r0
295
+ bne 1f
296
+ add scno, scno, #__OOB_SYSCALL_BIT @ force in oob marker
297
+ b fastcall_try
298
+1:
299
+#endif
300
+#ifdef CONFIG_DOVETAIL_LEGACY_SYSCALL_RANGE
301
+ ldr r0, =#__OOB_SYSCALL_BIT
302
+ ands r0, scno, r0
303
+ bne fastcall_try
304
+#endif
305
+ cmp scno, #__NR_prctl
306
+ bne slow_path
307
+ ldr r0, [sp, #S_OLD_R0]
308
+ tst r0, #__OOB_SYSCALL_BIT
309
+ beq slow_path
310
+fastcall_try:
311
+ tst r10, #_TLF_OOB
312
+ beq slow_path
313
+ mov r0, sp @ regs
314
+ bl handle_oob_syscall
315
+ ldr r10, [tsk, #TI_LOCAL_FLAGS]
316
+ tst r0, r0
317
+ beq slow_path
318
+ tst r10, #_TLF_OOB
319
+ bne fastcall_exit_check @ check for MAYDAY
320
+ bl sync_inband_irqs
321
+ b ret_slow_syscall
322
+fastcall_exit_check:
323
+ ldr r10, [tsk, #TI_FLAGS]
324
+ tst r10, #_TIF_MAYDAY
325
+ beq fast_ret_to_user
326
+ mov r0, sp
327
+ bl dovetail_call_mayday
328
+ b fast_ret_to_user
329
+slow_path:
330
+ tst r10, #_TLF_DOVETAIL
331
+ bne pipeline_syscall
332
+#ifdef CONFIG_DOVETAIL_LEGACY_SYSCALL_RANGE
333
+ ldr r0, =#__OOB_SYSCALL_BIT
334
+ ands r0, scno, r0
335
+ bne pipeline_syscall
336
+#endif
337
+ cmp scno, #__NR_prctl
338
+ bne root_syscall
339
+ ldr r0, [sp, #S_OLD_R0]
340
+ tst r0, #__OOB_SYSCALL_BIT
341
+ beq root_syscall
342
+pipeline_syscall:
343
+ mov r0, sp @ regs
344
+ bl __pipeline_syscall
345
+ ldr r10, [tsk, #TI_LOCAL_FLAGS]
346
+ tst r10, #_TLF_OOB
347
+ bne fast_ret_to_user
348
+ cmp r0, #0
349
+ bgt ret_slow_syscall
350
+root_syscall:
351
+ ldmia sp, { r0 - r3 }
352
+#endif /* CONFIG_DOVETAIL */
353
+
275354 ldr r10, [tsk, #TI_FLAGS] @ check for syscall tracing
276355 stmdb sp!, {r4, r5} @ push fifth and sixth args
277356