diff options
Diffstat (limited to 'arch/xtensa/kernel/syscalls.c')
-rw-r--r-- | arch/xtensa/kernel/syscalls.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/xtensa/kernel/syscalls.c b/arch/xtensa/kernel/syscalls.c index 37c90ca5b98d..d9285d4d5565 100644 --- a/arch/xtensa/kernel/syscalls.c +++ b/arch/xtensa/kernel/syscalls.c | |||
@@ -266,3 +266,23 @@ void system_call (struct pt_regs *regs) | |||
266 | regs->areg[2] = res; | 266 | regs->areg[2] = res; |
267 | do_syscall_trace(); | 267 | do_syscall_trace(); |
268 | } | 268 | } |
269 | |||
270 | /* | ||
271 | * Do a system call from kernel instead of calling sys_execve so we | ||
272 | * end up with proper pt_regs. | ||
273 | */ | ||
274 | int kernel_execve(const char *filename, char *const argv[], char *const envp[]) | ||
275 | { | ||
276 | long __res; | ||
277 | asm volatile ( | ||
278 | " mov a5, %2 \n" | ||
279 | " mov a4, %4 \n" | ||
280 | " mov a3, %3 \n" | ||
281 | " movi a2, %1 \n" | ||
282 | " syscall \n" | ||
283 | " mov %0, a2 \n" | ||
284 | : "=a" (__res) | ||
285 | : "i" (__NR_execve), "a" (filename), "a" (argv), "a" (envp) | ||
286 | : "a2", "a3", "a4", "a5"); | ||
287 | return __res; | ||
288 | } | ||