sys.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * AArch64-specific system calls implementation
  3. *
  4. * Copyright (C) 2012 ARM Ltd.
  5. * Author: Catalin Marinas <catalin.marinas@arm.com>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #include <linux/compiler.h>
  20. #include <linux/errno.h>
  21. #include <linux/fs.h>
  22. #include <linux/mm.h>
  23. #include <linux/export.h>
  24. #include <linux/sched.h>
  25. #include <linux/slab.h>
  26. #include <linux/syscalls.h>
  27. #include <asm/cpufeature.h>
  28. #include <asm/syscall.h>
  29. SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
  30. unsigned long, prot, unsigned long, flags,
  31. unsigned long, fd, unsigned long, off)
  32. {
  33. if (offset_in_page(off) != 0)
  34. return -EINVAL;
  35. return ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
  36. }
  37. SYSCALL_DEFINE1(arm64_personality, unsigned int, personality)
  38. {
  39. if (personality(personality) == PER_LINUX32 &&
  40. !system_supports_32bit_el0())
  41. return -EINVAL;
  42. return ksys_personality(personality);
  43. }
  44. asmlinkage long sys_ni_syscall(void);
  45. asmlinkage long __arm64_sys_ni_syscall(const struct pt_regs *__unused)
  46. {
  47. return sys_ni_syscall();
  48. }
  49. /*
  50. * Wrappers to pass the pt_regs argument.
  51. */
  52. #define __arm64_sys_personality __arm64_sys_arm64_personality
  53. #undef __SYSCALL
  54. #define __SYSCALL(nr, sym) asmlinkage long __arm64_##sym(const struct pt_regs *);
  55. #include <asm/unistd.h>
  56. #undef __SYSCALL
  57. #define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
  58. const syscall_fn_t sys_call_table[__NR_syscalls] = {
  59. [0 ... __NR_syscalls - 1] = __arm64_sys_ni_syscall,
  60. #include <asm/unistd.h>
  61. };