Commit a3f9c6d4 authored by Philippe Gerum's avatar Philippe Gerum

ARM: ipipe: route syscalls to co-kernel

parent 9ae6d5bf
......@@ -38,4 +38,10 @@
#define __ARM_NR_set_tls (__ARM_NR_BASE+5)
#define __ARM_NR_get_tls (__ARM_NR_BASE+6)
/*
* This SWI is IPIPE private, for dispatching syscalls to the head
* domain.
*/
#define __ARM_NR_ipipe (__ARM_NR_BASE+66)
#endif /* _UAPI__ASM_ARM_UNISTD_H */
......@@ -38,6 +38,35 @@ saved_pc .req lr
#define TRACE(x...)
#endif
#ifdef CONFIG_IPIPE
.macro ipipe_oabi_save_sysnr, tmp
#ifdef CONFIG_OABI_COMPAT
ldr \tmp, [sp, #S_R7 + S_OFF]
stmdb sp!, {\tmp}
ldr \tmp, =sys_oabi_call_table
cmp \tmp, tbl
moveq \tmp, scno
addeq \tmp, #__NR_SYSCALL_BASE
streq \tmp, [sp, #S_R7 + S_OFF + 4] @ head domain expects sycall number in r7
#elif !defined(CONFIG_AEABI)
ldr \tmp, [sp, #S_R7 + S_OFF]
stmdb sp!, {\tmp}
mov \tmp, scno
add \tmp, #__NR_SYSCALL_BASE
str \tmp, [sp, #S_R7 + S_OFF + 4]
#endif
.endm
.macro ipipe_oabi_restore_sysnr, tmp
#if defined(CONFIG_OABI_COMPAT) || !defined(CONFIG_AEABI)
ldmia sp!, {\tmp}
str \tmp, [sp, #S_R7 + S_OFF]
#endif
.endm
#endif /* CONFIG_IPIPE */
.section .entry.text,"ax",%progbits
.align 5
#if !(IS_ENABLED(CONFIG_TRACE_IRQFLAGS) || IS_ENABLED(CONFIG_CONTEXT_TRACKING) || \
......@@ -159,6 +188,8 @@ ENTRY(ret_from_fork)
ENDPROC(ret_from_fork)
#ifdef CONFIG_IPIPE
__ipipe_ret_to_user:
disable_irq @ disable interrupts
ENTRY(__ipipe_ret_to_user_irqs_disabled)
slow_restore_user_regs
ENDPROC(__ipipe_ret_to_user_irqs_disabled)
......@@ -265,6 +296,55 @@ ENTRY(vector_swi)
TRACE( ldmia sp, {r0 - r3} )
local_restart:
#ifdef CONFIG_IPIPE
ldr r10, [tsk, #TI_IPIPE]
ldr r0, =(__ARM_NR_ipipe - __NR_SYSCALL_BASE)
cmp scno, r0
bne slow_path
tst r10, #_TIP_HEAD
beq slow_path
mov r0, sp
ipipe_oabi_save_sysnr r10 @ caution: affects sp
bl ipipe_fastcall_hook @ __IPIPE_SYSCALL_E is assumed
ipipe_oabi_restore_sysnr r10
cmp r0, #0
blt no_fastcall
get_thread_info tsk
ldr r10, [tsk, #TI_IPIPE]
tst r10, #_TIP_HEAD
bne fastcall_exit_check @ check for MAYDAY
bl __ipipe_root_sync
b ret_slow_syscall
fastcall_exit_check:
tst r10, #_TIP_MAYDAY
beq __ipipe_ret_to_user
mov r0, sp
bl __ipipe_call_mayday
b __ipipe_ret_to_user
no_fastcall:
get_thread_info tsk
ldr r0, =(__ARM_NR_ipipe - __NR_SYSCALL_BASE)
ldr r10, [tsk, #TI_IPIPE]
slow_path:
tst r10, #_TIP_NOTIFY
bne pipeline_syscall
cmp scno, r0
bne root_syscall
pipeline_syscall:
mov r0, sp
ipipe_oabi_save_sysnr r10 @ caution: affects sp
bl __ipipe_notify_syscall
ipipe_oabi_restore_sysnr r10
get_thread_info tsk
ldr r10, [tsk, #TI_IPIPE]
tst r10, #_TIP_HEAD
bne __ipipe_ret_to_user
cmp r0, #0
bgt ret_slow_syscall
root_syscall:
ldmia sp, { r0 - r3 }
#endif /* CONFIG_IPIPE */
ldr r10, [tsk, #TI_FLAGS] @ check for syscall tracing
stmdb sp!, {r4, r5} @ push fifth and sixth args
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment