sys_bfin.c 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * contains various random system calls that have a non-standard
  3. * calling sequence on the Linux/Blackfin platform.
  4. *
  5. * Copyright 2004-2009 Analog Devices Inc.
  6. *
  7. * Licensed under the GPL-2 or later
  8. */
  9. #include <linux/spinlock.h>
  10. #include <linux/sem.h>
  11. #include <linux/msg.h>
  12. #include <linux/shm.h>
  13. #include <linux/syscalls.h>
  14. #include <linux/mman.h>
  15. #include <linux/file.h>
  16. #include <linux/fs.h>
  17. #include <linux/uaccess.h>
  18. #include <linux/ipc.h>
  19. #include <linux/unistd.h>
  20. #include <asm/cacheflush.h>
  21. #include <asm/dma.h>
  22. /* common code for old and new mmaps */
  23. static inline long
  24. do_mmap2(unsigned long addr, unsigned long len,
  25. unsigned long prot, unsigned long flags,
  26. unsigned long fd, unsigned long pgoff)
  27. {
  28. int error = -EBADF;
  29. struct file *file = NULL;
  30. flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
  31. if (!(flags & MAP_ANONYMOUS)) {
  32. file = fget(fd);
  33. if (!file)
  34. goto out;
  35. }
  36. down_write(&current->mm->mmap_sem);
  37. error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
  38. up_write(&current->mm->mmap_sem);
  39. if (file)
  40. fput(file);
  41. out:
  42. return error;
  43. }
  44. asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
  45. unsigned long prot, unsigned long flags,
  46. unsigned long fd, unsigned long pgoff)
  47. {
  48. return do_mmap2(addr, len, prot, flags, fd, pgoff);
  49. }
  50. asmlinkage void *sys_sram_alloc(size_t size, unsigned long flags)
  51. {
  52. return sram_alloc_with_lsl(size, flags);
  53. }
  54. asmlinkage int sys_sram_free(const void *addr)
  55. {
  56. return sram_free_with_lsl(addr);
  57. }
  58. asmlinkage void *sys_dma_memcpy(void *dest, const void *src, size_t len)
  59. {
  60. return safe_dma_memcpy(dest, src, len);
  61. }