]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/unicore32/kernel/sys.c
8b6e4cc5739395f58048361c60454ac3988f11d3
[karo-tx-linux.git] / arch / unicore32 / kernel / sys.c
1 /*
2  * linux/arch/unicore32/kernel/sys.c
3  *
4  * Code specific to PKUnity SoC and UniCore ISA
5  *
6  * Copyright (C) 2001-2010 GUAN Xue-tao
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  */
12 #include <linux/module.h>
13 #include <linux/errno.h>
14 #include <linux/sched.h>
15 #include <linux/slab.h>
16 #include <linux/mm.h>
17 #include <linux/sem.h>
18 #include <linux/msg.h>
19 #include <linux/shm.h>
20 #include <linux/stat.h>
21 #include <linux/syscalls.h>
22 #include <linux/mman.h>
23 #include <linux/fs.h>
24 #include <linux/file.h>
25 #include <linux/ipc.h>
26 #include <linux/uaccess.h>
27
28 #include <asm/syscalls.h>
29 #include <asm/cacheflush.h>
30
31 /* Clone a task - this clones the calling program thread.
32  * This is called indirectly via a small wrapper
33  */
34 asmlinkage long __sys_clone(unsigned long clone_flags, unsigned long newsp,
35                          void __user *parent_tid, void __user *child_tid,
36                          struct pt_regs *regs)
37 {
38         if (!newsp)
39                 newsp = regs->UCreg_sp;
40
41         return do_fork(clone_flags, newsp, regs, 0,
42                         parent_tid, child_tid);
43 }
44
45 /* sys_execve() executes a new program.
46  * This is called indirectly via a small wrapper
47  */
48 asmlinkage long __sys_execve(const char __user *filename,
49                           const char __user *const __user *argv,
50                           const char __user *const __user *envp,
51                           struct pt_regs *regs)
52 {
53         int error;
54         struct filename *fn;
55
56         fn = getname(filename);
57         error = PTR_ERR(fn);
58         if (IS_ERR(fn))
59                 goto out;
60         error = do_execve(fn->name, argv, envp, regs);
61         putname(fn);
62 out:
63         return error;
64 }
65
66 /* Note: used by the compat code even in 64-bit Linux. */
67 SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
68                 unsigned long, prot, unsigned long, flags,
69                 unsigned long, fd, unsigned long, off_4k)
70 {
71         return sys_mmap_pgoff(addr, len, prot, flags, fd,
72                               off_4k);
73 }
74
75 /* Provide the actual syscall number to call mapping. */
76 #undef __SYSCALL
77 #define __SYSCALL(nr, call)     [nr] = (call),
78
79 /* Note that we don't include <linux/unistd.h> but <asm/unistd.h> */
80 void *sys_call_table[__NR_syscalls] = {
81         [0 ... __NR_syscalls-1] = sys_ni_syscall,
82 #include <asm/unistd.h>
83 };