blob: 8b294a1c806961dbb9c099257621598d51b59f36 [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
Robin Getz96f10502009-09-24 14:11:24 +00002 * contains various random system calls that have a non-standard
3 * calling sequence on the Linux/Blackfin platform.
Bryan Wu1394f032007-05-06 14:50:22 -07004 *
Robin Getz96f10502009-09-24 14:11:24 +00005 * Copyright 2004-2009 Analog Devices Inc.
Bryan Wu1394f032007-05-06 14:50:22 -07006 *
Robin Getz96f10502009-09-24 14:11:24 +00007 * Licensed under the GPL-2 or later
Bryan Wu1394f032007-05-06 14:50:22 -07008 */
9
Bryan Wu1394f032007-05-06 14:50:22 -070010#include <linux/spinlock.h>
11#include <linux/sem.h>
12#include <linux/msg.h>
13#include <linux/shm.h>
14#include <linux/syscalls.h>
15#include <linux/mman.h>
16#include <linux/file.h>
Bryan Wud31c5ab2007-08-10 13:00:42 -070017#include <linux/fs.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080018#include <linux/uaccess.h>
19#include <linux/ipc.h>
20#include <linux/unistd.h>
Bryan Wu1394f032007-05-06 14:50:22 -070021
22#include <asm/cacheflush.h>
Bryan Wu1394f032007-05-06 14:50:22 -070023#include <asm/dma.h>
Bryan Wu1394f032007-05-06 14:50:22 -070024
Bryan Wu1394f032007-05-06 14:50:22 -070025/* common code for old and new mmaps */
26static inline long
27do_mmap2(unsigned long addr, unsigned long len,
28 unsigned long prot, unsigned long flags,
29 unsigned long fd, unsigned long pgoff)
30{
31 int error = -EBADF;
32 struct file *file = NULL;
33
34 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
35 if (!(flags & MAP_ANONYMOUS)) {
36 file = fget(fd);
37 if (!file)
38 goto out;
39 }
40
41 down_write(&current->mm->mmap_sem);
42 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
43 up_write(&current->mm->mmap_sem);
44
45 if (file)
46 fput(file);
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080047 out:
Bryan Wu1394f032007-05-06 14:50:22 -070048 return error;
49}
50
51asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
52 unsigned long prot, unsigned long flags,
53 unsigned long fd, unsigned long pgoff)
54{
55 return do_mmap2(addr, len, prot, flags, fd, pgoff);
56}
57
Bryan Wu1394f032007-05-06 14:50:22 -070058asmlinkage void *sys_sram_alloc(size_t size, unsigned long flags)
59{
60 return sram_alloc_with_lsl(size, flags);
61}
62
63asmlinkage int sys_sram_free(const void *addr)
64{
65 return sram_free_with_lsl(addr);
66}
67
68asmlinkage void *sys_dma_memcpy(void *dest, const void *src, size_t len)
69{
70 return safe_dma_memcpy(dest, src, len);
71}