diff options
-rw-r--r-- | arch/avr32/kernel/sys_avr32.c | 14 | ||||
-rw-r--r-- | include/asm-avr32/unistd.h | 80 |
2 files changed, 17 insertions, 77 deletions
diff --git a/arch/avr32/kernel/sys_avr32.c b/arch/avr32/kernel/sys_avr32.c index 6ec5693da448..8deb6003ee62 100644 --- a/arch/avr32/kernel/sys_avr32.c +++ b/arch/avr32/kernel/sys_avr32.c | |||
@@ -49,3 +49,17 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, | |||
49 | fput(file); | 49 | fput(file); |
50 | return error; | 50 | return error; |
51 | } | 51 | } |
52 | |||
53 | int kernel_execve(const char *file, char **argv, char **envp) | ||
54 | { | ||
55 | register long scno asm("r8") = __NR_execve; | ||
56 | register long sc1 asm("r12") = (long)file; | ||
57 | register long sc2 asm("r11") = (long)argv; | ||
58 | register long sc3 asm("r10") = (long)envp; | ||
59 | |||
60 | asm volatile("scall" | ||
61 | : "=r"(sc1) | ||
62 | : "r"(scno), "0"(sc1), "r"(sc2), "r"(sc3) | ||
63 | : "cc", "memory"); | ||
64 | return sc1; | ||
65 | } | ||
diff --git a/include/asm-avr32/unistd.h b/include/asm-avr32/unistd.h index 1f528f92690d..a50e5004550c 100644 --- a/include/asm-avr32/unistd.h +++ b/include/asm-avr32/unistd.h | |||
@@ -281,30 +281,10 @@ | |||
281 | #define __NR_tee 263 | 281 | #define __NR_tee 263 |
282 | #define __NR_vmsplice 264 | 282 | #define __NR_vmsplice 264 |
283 | 283 | ||
284 | #ifdef __KERNEL__ | ||
284 | #define NR_syscalls 265 | 285 | #define NR_syscalls 265 |
285 | 286 | ||
286 | 287 | ||
287 | /* | ||
288 | * AVR32 calling convention for system calls: | ||
289 | * - System call number in r8 | ||
290 | * - Parameters in r12 and downwards to r9 as well as r6 and r5. | ||
291 | * - Return value in r12 | ||
292 | */ | ||
293 | |||
294 | /* | ||
295 | * user-visible error numbers are in the range -1 - -124: see | ||
296 | * <asm-generic/errno.h> | ||
297 | */ | ||
298 | |||
299 | #define __syscall_return(type, res) do { \ | ||
300 | if ((unsigned long)(res) >= (unsigned long)(-125)) { \ | ||
301 | errno = -(res); \ | ||
302 | res = -1; \ | ||
303 | } \ | ||
304 | return (type) (res); \ | ||
305 | } while (0) | ||
306 | |||
307 | #ifdef __KERNEL__ | ||
308 | #define __ARCH_WANT_IPC_PARSE_VERSION | 288 | #define __ARCH_WANT_IPC_PARSE_VERSION |
309 | #define __ARCH_WANT_STAT64 | 289 | #define __ARCH_WANT_STAT64 |
310 | #define __ARCH_WANT_SYS_ALARM | 290 | #define __ARCH_WANT_SYS_ALARM |
@@ -319,62 +299,6 @@ | |||
319 | #define __ARCH_WANT_SYS_GETPGRP | 299 | #define __ARCH_WANT_SYS_GETPGRP |
320 | #define __ARCH_WANT_SYS_RT_SIGACTION | 300 | #define __ARCH_WANT_SYS_RT_SIGACTION |
321 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | 301 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
322 | #endif | ||
323 | |||
324 | #if defined(__KERNEL_SYSCALLS__) || defined(__CHECKER__) | ||
325 | |||
326 | #include <linux/types.h> | ||
327 | #include <linux/linkage.h> | ||
328 | #include <asm/signal.h> | ||
329 | |||
330 | struct pt_regs; | ||
331 | |||
332 | /* | ||
333 | * we need this inline - forking from kernel space will result | ||
334 | * in NO COPY ON WRITE (!!!), until an execve is executed. This | ||
335 | * is no problem, but for the stack. This is handled by not letting | ||
336 | * main() use the stack at all after fork(). Thus, no function | ||
337 | * calls - which means inline code for fork too, as otherwise we | ||
338 | * would use the stack upon exit from 'fork()'. | ||
339 | * | ||
340 | * Actually only pause and fork are needed inline, so that there | ||
341 | * won't be any messing with the stack from main(), but we define | ||
342 | * some others too. | ||
343 | */ | ||
344 | static inline int execve(const char *file, char **argv, char **envp) | ||
345 | { | ||
346 | register long scno asm("r8") = __NR_execve; | ||
347 | register long sc1 asm("r12") = (long)file; | ||
348 | register long sc2 asm("r11") = (long)argv; | ||
349 | register long sc3 asm("r10") = (long)envp; | ||
350 | int res; | ||
351 | |||
352 | asm volatile("scall" | ||
353 | : "=r"(sc1) | ||
354 | : "r"(scno), "0"(sc1), "r"(sc2), "r"(sc3) | ||
355 | : "lr", "memory"); | ||
356 | res = sc1; | ||
357 | __syscall_return(int, res); | ||
358 | } | ||
359 | |||
360 | asmlinkage long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize); | ||
361 | asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | ||
362 | struct pt_regs *regs); | ||
363 | asmlinkage int sys_rt_sigreturn(struct pt_regs *regs); | ||
364 | asmlinkage int sys_pipe(unsigned long __user *filedes); | ||
365 | asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, | ||
366 | unsigned long prot, unsigned long flags, | ||
367 | unsigned long fd, off_t offset); | ||
368 | asmlinkage int sys_cacheflush(int operation, void __user *addr, size_t len); | ||
369 | asmlinkage int sys_fork(struct pt_regs *regs); | ||
370 | asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, | ||
371 | unsigned long parent_tidptr, | ||
372 | unsigned long child_tidptr, struct pt_regs *regs); | ||
373 | asmlinkage int sys_vfork(struct pt_regs *regs); | ||
374 | asmlinkage int sys_execve(char __user *ufilename, char __user *__user *uargv, | ||
375 | char __user *__user *uenvp, struct pt_regs *regs); | ||
376 | |||
377 | #endif | ||
378 | 302 | ||
379 | /* | 303 | /* |
380 | * "Conditional" syscalls | 304 | * "Conditional" syscalls |
@@ -384,4 +308,6 @@ asmlinkage int sys_execve(char __user *ufilename, char __user *__user *uargv, | |||
384 | */ | 308 | */ |
385 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); | 309 | #define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall"); |
386 | 310 | ||
311 | #endif /* __KERNEL__ */ | ||
312 | |||
387 | #endif /* __ASM_AVR32_UNISTD_H */ | 313 | #endif /* __ASM_AVR32_UNISTD_H */ |