diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2012-10-25 03:10:50 -0400 |
---|---|---|
committer | Chris Zankel <chris@zankel.net> | 2012-10-25 18:00:03 -0400 |
commit | 3306a72669a2af23b324540b08e68e82ac5b7dab (patch) | |
tree | 0363c3f7120560ccf1750281a5ab366640734181 /arch/xtensa/kernel/entry.S | |
parent | 6ebe7da25b7879194fdb5c43ea67b383dd9014d6 (diff) |
xtensa: switch to generic kernel_thread()
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>
Diffstat (limited to 'arch/xtensa/kernel/entry.S')
-rw-r--r-- | arch/xtensa/kernel/entry.S | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S index 18453067c258..d4ec1381aebc 100644 --- a/arch/xtensa/kernel/entry.S +++ b/arch/xtensa/kernel/entry.S | |||
@@ -1833,34 +1833,6 @@ ENTRY(system_call) | |||
1833 | 1833 | ||
1834 | 1834 | ||
1835 | /* | 1835 | /* |
1836 | * Create a kernel thread | ||
1837 | * | ||
1838 | * int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) | ||
1839 | * a2 a2 a3 a4 | ||
1840 | */ | ||
1841 | |||
1842 | ENTRY(kernel_thread) | ||
1843 | entry a1, 16 | ||
1844 | |||
1845 | mov a5, a2 # preserve fn over syscall | ||
1846 | mov a7, a3 # preserve args over syscall | ||
1847 | |||
1848 | movi a3, _CLONE_VM | _CLONE_UNTRACED | ||
1849 | movi a2, __NR_clone | ||
1850 | or a6, a4, a3 # arg0: flags | ||
1851 | mov a3, a1 # arg1: sp | ||
1852 | syscall | ||
1853 | |||
1854 | beq a3, a1, 1f # branch if parent | ||
1855 | mov a6, a7 # args | ||
1856 | callx4 a5 # fn(args) | ||
1857 | |||
1858 | movi a2, __NR_exit | ||
1859 | syscall # return value of fn(args) still in a6 | ||
1860 | |||
1861 | 1: retw | ||
1862 | |||
1863 | /* | ||
1864 | * Do a system call from kernel instead of calling sys_execve, so we end up | 1836 | * Do a system call from kernel instead of calling sys_execve, so we end up |
1865 | * with proper pt_regs. | 1837 | * with proper pt_regs. |
1866 | * | 1838 | * |
@@ -1958,3 +1930,16 @@ ENTRY(ret_from_fork) | |||
1958 | 1930 | ||
1959 | j common_exception_return | 1931 | j common_exception_return |
1960 | 1932 | ||
1933 | /* | ||
1934 | * Kernel thread creation helper | ||
1935 | * On entry, set up by copy_thread: a2 = thread_fn, a3 = thread_fn arg | ||
1936 | * left from _switch_to: a6 = prev | ||
1937 | */ | ||
1938 | ENTRY(ret_from_kernel_thread) | ||
1939 | |||
1940 | call4 schedule_tail | ||
1941 | mov a6, a3 | ||
1942 | callx4 a2 | ||
1943 | call4 do_exit | ||
1944 | |||
1945 | ENDPROC(ret_from_kernel_thread) | ||