sys_bfin.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * File: arch/blackfin/kernel/sys_bfin.c
  3. * Based on:
  4. * Author:
  5. *
  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.
  10. *
  11. * Modified:
  12. * Copyright 2004-2006 Analog Devices Inc.
  13. *
  14. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  15. *
  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.
  20. *
  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.
  25. *
  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
  30. */
  31. #include <linux/spinlock.h>
  32. #include <linux/sem.h>
  33. #include <linux/msg.h>
  34. #include <linux/shm.h>
  35. #include <linux/syscalls.h>
  36. #include <linux/mman.h>
  37. #include <linux/file.h>
  38. #include <linux/fs.h>
  39. #include <linux/uaccess.h>
  40. #include <linux/ipc.h>
  41. #include <linux/unistd.h>
  42. #include <asm/cacheflush.h>
  43. #include <asm/dma.h>
  44. /* common code for old and new mmaps */
  45. static inline long
  46. do_mmap2(unsigned long addr, unsigned long len,
  47. unsigned long prot, unsigned long flags,
  48. unsigned long fd, unsigned long pgoff)
  49. {
  50. int error = -EBADF;
  51. struct file *file = NULL;
  52. flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
  53. if (!(flags & MAP_ANONYMOUS)) {
  54. file = fget(fd);
  55. if (!file)
  56. goto out;
  57. }
  58. down_write(&current->mm->mmap_sem);
  59. error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
  60. up_write(&current->mm->mmap_sem);
  61. if (file)
  62. fput(file);
  63. out:
  64. return error;
  65. }
  66. asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
  67. unsigned long prot, unsigned long flags,
  68. unsigned long fd, unsigned long pgoff)
  69. {
  70. return do_mmap2(addr, len, prot, flags, fd, pgoff);
  71. }
  72. asmlinkage void *sys_sram_alloc(size_t size, unsigned long flags)
  73. {
  74. return sram_alloc_with_lsl(size, flags);
  75. }
  76. asmlinkage int sys_sram_free(const void *addr)
  77. {
  78. return sram_free_with_lsl(addr);
  79. }
  80. asmlinkage void *sys_dma_memcpy(void *dest, const void *src, size_t len)
  81. {
  82. return safe_dma_memcpy(dest, src, len);
  83. }