added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / arch / xtensa / kernel / syscall.c
blobac15ecbdf9199871f3e31ef7e013fd62e1ce3b06
1 /*
2 * arch/xtensa/kernel/syscall.c
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
8 * Copyright (C) 2001 - 2005 Tensilica Inc.
9 * Copyright (C) 2000 Silicon Graphics, Inc.
10 * Copyright (C) 1995 - 2000 by Ralf Baechle
12 * Joe Taylor <joe@tensilica.com, joetylr@yahoo.com>
13 * Marc Gauthier <marc@tensilica.com, marc@alumni.uwaterloo.ca>
14 * Chris Zankel <chris@zankel.net>
15 * Kevin Chea
18 #include <asm/uaccess.h>
19 #include <asm/syscall.h>
20 #include <asm/unistd.h>
21 #include <linux/linkage.h>
22 #include <linux/stringify.h>
23 #include <linux/errno.h>
24 #include <linux/syscalls.h>
25 #include <linux/file.h>
26 #include <linux/fs.h>
27 #include <linux/mman.h>
28 #include <linux/shm.h>
30 typedef void (*syscall_t)(void);
32 syscall_t sys_call_table[__NR_syscall_count] /* FIXME __cacheline_aligned */= {
33 [0 ... __NR_syscall_count - 1] = (syscall_t)&sys_ni_syscall,
35 #undef __SYSCALL
36 #define __SYSCALL(nr,symbol,nargs) [ nr ] = (syscall_t)symbol,
37 #undef _XTENSA_UNISTD_H
38 #undef __KERNEL_SYSCALLS__
39 #include <asm/unistd.h>
43 * xtensa_pipe() is the normal C calling standard for creating a pipe. It's not
44 * the way unix traditional does this, though.
47 asmlinkage long xtensa_pipe(int __user *userfds)
49 int fd[2];
50 int error;
52 error = do_pipe_flags(fd, 0);
53 if (!error) {
54 if (copy_to_user(userfds, fd, 2 * sizeof(int)))
55 error = -EFAULT;
57 return error;
61 asmlinkage long xtensa_mmap2(unsigned long addr, unsigned long len,
62 unsigned long prot, unsigned long flags,
63 unsigned long fd, unsigned long pgoff)
65 int error = -EBADF;
66 struct file * file = NULL;
68 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
69 if (!(flags & MAP_ANONYMOUS)) {
70 file = fget(fd);
71 if (!file)
72 goto out;
75 down_write(&current->mm->mmap_sem);
76 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
77 up_write(&current->mm->mmap_sem);
79 if (file)
80 fput(file);
81 out:
82 return error;
85 asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg)
87 unsigned long ret;
88 long err;
90 err = do_shmat(shmid, shmaddr, shmflg, &ret);
91 if (err)
92 return err;
93 return (long)ret;
96 asmlinkage long xtensa_fadvise64_64(int fd, int advice, unsigned long long offset, unsigned long long len)
98 return sys_fadvise64_64(fd, offset, len, advice);