added 2.6.29.6 aldebaran kernel
[nao-ulib.git] / kernel / 2.6.29.6-aldebaran-rt / arch / blackfin / kernel / sys_bfin.c
blobfce49d7cf0017f0014304f8e715477cb29fa8f6b
1 /*
2 * File: arch/blackfin/kernel/sys_bfin.c
3 * Based on:
4 * Author:
6 * Created:
7 * Description: This file contains various random system calls that
8 * have a non-standard calling sequence on the Linux/bfin
9 * platform.
11 * Modified:
12 * Copyright 2004-2006 Analog Devices Inc.
14 * Bugs: Enter bugs at http://blackfin.uclinux.org/
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
26 * You should have received a copy of the GNU General Public License
27 * along with this program; if not, see the file COPYING, or write
28 * to the Free Software Foundation, Inc.,
29 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32 #include <linux/smp_lock.h>
33 #include <linux/spinlock.h>
34 #include <linux/sem.h>
35 #include <linux/msg.h>
36 #include <linux/shm.h>
37 #include <linux/syscalls.h>
38 #include <linux/mman.h>
39 #include <linux/file.h>
40 #include <linux/fs.h>
41 #include <linux/uaccess.h>
42 #include <linux/ipc.h>
43 #include <linux/unistd.h>
45 #include <asm/cacheflush.h>
46 #include <asm/dma.h>
48 /* common code for old and new mmaps */
49 static inline long
50 do_mmap2(unsigned long addr, unsigned long len,
51 unsigned long prot, unsigned long flags,
52 unsigned long fd, unsigned long pgoff)
54 int error = -EBADF;
55 struct file *file = NULL;
57 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
58 if (!(flags & MAP_ANONYMOUS)) {
59 file = fget(fd);
60 if (!file)
61 goto out;
64 down_write(&current->mm->mmap_sem);
65 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
66 up_write(&current->mm->mmap_sem);
68 if (file)
69 fput(file);
70 out:
71 return error;
74 asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
75 unsigned long prot, unsigned long flags,
76 unsigned long fd, unsigned long pgoff)
78 return do_mmap2(addr, len, prot, flags, fd, pgoff);
81 asmlinkage int sys_getpagesize(void)
83 return PAGE_SIZE;
86 asmlinkage void *sys_sram_alloc(size_t size, unsigned long flags)
88 return sram_alloc_with_lsl(size, flags);
91 asmlinkage int sys_sram_free(const void *addr)
93 return sram_free_with_lsl(addr);
96 asmlinkage void *sys_dma_memcpy(void *dest, const void *src, size_t len)
98 return safe_dma_memcpy(dest, src, len);