| .. | .. |
|---|
| 3 | 3 | * linux/arch/arm/kernel/entry-common.S |
|---|
| 4 | 4 | * |
|---|
| 5 | 5 | * Copyright (C) 2000 Russell King |
|---|
| 6 | + * Copyright (C) 2005 Stelian Pop. |
|---|
| 6 | 7 | */ |
|---|
| 7 | 8 | |
|---|
| 8 | 9 | #include <asm/assembler.h> |
|---|
| .. | .. |
|---|
| 12 | 13 | #include <asm/memory.h> |
|---|
| 13 | 14 | #ifdef CONFIG_AEABI |
|---|
| 14 | 15 | #include <asm/unistd-oabi.h> |
|---|
| 16 | +#include <uapi/asm-generic/dovetail.h> |
|---|
| 15 | 17 | #endif |
|---|
| 16 | 18 | |
|---|
| 17 | 19 | .equ NR_syscalls, __NR_syscalls |
|---|
| .. | .. |
|---|
| 54 | 56 | blne addr_limit_check_failed |
|---|
| 55 | 57 | ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing |
|---|
| 56 | 58 | movs r1, r1, lsl #16 |
|---|
| 59 | + ldr r2, =#_TIF_SYSCALL_WORK | _TIF_WORK_MASK |
|---|
| 60 | + ands r2, r1, r2 |
|---|
| 57 | 61 | bne fast_work_pending |
|---|
| 58 | 62 | |
|---|
| 59 | 63 | |
|---|
| .. | .. |
|---|
| 91 | 95 | blne addr_limit_check_failed |
|---|
| 92 | 96 | ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing |
|---|
| 93 | 97 | movs r1, r1, lsl #16 |
|---|
| 98 | + ldr r2, =#_TIF_SYSCALL_WORK | _TIF_WORK_MASK |
|---|
| 99 | + ands r2, r1, r2 |
|---|
| 94 | 100 | beq no_work_pending |
|---|
| 95 | 101 | UNWIND(.fnend ) |
|---|
| 96 | 102 | ENDPROC(ret_fast_syscall) |
|---|
| .. | .. |
|---|
| 132 | 138 | blne addr_limit_check_failed |
|---|
| 133 | 139 | ldr r1, [tsk, #TI_FLAGS] |
|---|
| 134 | 140 | movs r1, r1, lsl #16 |
|---|
| 141 | + ldr r2, =#_TIF_WORK_MASK |
|---|
| 142 | + ands r2, r1, r2 |
|---|
| 135 | 143 | bne slow_work_pending |
|---|
| 136 | 144 | no_work_pending: |
|---|
| 137 | 145 | asm_trace_hardirqs_on save = 0 |
|---|
| .. | .. |
|---|
| 143 | 151 | restore_user_regs fast = 0, offset = 0 |
|---|
| 144 | 152 | ENDPROC(ret_to_user_from_irq) |
|---|
| 145 | 153 | 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) |
|---|
| 146 | 158 | |
|---|
| 147 | 159 | /* |
|---|
| 148 | 160 | * This is how we return from a fork. |
|---|
| .. | .. |
|---|
| 265 | 277 | eor scno, scno, #__NR_SYSCALL_BASE @ check OS number |
|---|
| 266 | 278 | #endif |
|---|
| 267 | 279 | get_thread_info tsk |
|---|
| 280 | +#ifdef CONFIG_DOVETAIL |
|---|
| 281 | + str scno, [tsk, #TI_SYSCALL] |
|---|
| 282 | +#endif |
|---|
| 268 | 283 | /* |
|---|
| 269 | 284 | * Reload the registers that may have been corrupted on entry to |
|---|
| 270 | 285 | * the syscall assembly (by tracing or context tracking.) |
|---|
| .. | .. |
|---|
| 272 | 287 | TRACE( ldmia sp, {r0 - r3} ) |
|---|
| 273 | 288 | |
|---|
| 274 | 289 | 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 | + |
|---|
| 275 | 354 | ldr r10, [tsk, #TI_FLAGS] @ check for syscall tracing |
|---|
| 276 | 355 | stmdb sp!, {r4, r5} @ push fifth and sixth args |
|---|
| 277 | 356 | |
|---|