sys.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * AArch64-specific system calls implementation
  4. *
  5. * Copyright (C) 2012 ARM Ltd.
  6. * Author: Catalin Marinas <[email protected]>
  7. */
  8. #include <linux/compiler.h>
  9. #include <linux/errno.h>
  10. #include <linux/fs.h>
  11. #include <linux/mm.h>
  12. #include <linux/export.h>
  13. #include <linux/sched.h>
  14. #include <linux/slab.h>
  15. #include <linux/syscalls.h>
  16. #include <asm/cpufeature.h>
  17. #include <asm/syscall.h>
  18. SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
  19. unsigned long, prot, unsigned long, flags,
  20. unsigned long, fd, unsigned long, off)
  21. {
  22. if (offset_in_page(off) != 0)
  23. return -EINVAL;
  24. return ksys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
  25. }
  26. SYSCALL_DEFINE1(arm64_personality, unsigned int, personality)
  27. {
  28. if (personality(personality) == PER_LINUX32 &&
  29. !system_supports_32bit_el0())
  30. return -EINVAL;
  31. return ksys_personality(personality);
  32. }
  33. asmlinkage long sys_ni_syscall(void);
  34. asmlinkage long __arm64_sys_ni_syscall(const struct pt_regs *__unused)
  35. {
  36. return sys_ni_syscall();
  37. }
  38. /*
  39. * Wrappers to pass the pt_regs argument.
  40. */
  41. #define __arm64_sys_personality __arm64_sys_arm64_personality
  42. #undef __SYSCALL
  43. #define __SYSCALL(nr, sym) asmlinkage long __arm64_##sym(const struct pt_regs *);
  44. #include <asm/unistd.h>
  45. #undef __SYSCALL
  46. #define __SYSCALL(nr, sym) [nr] = __arm64_##sym,
  47. const syscall_fn_t sys_call_table[__NR_syscalls] = {
  48. [0 ... __NR_syscalls - 1] = __arm64_sys_ni_syscall,
  49. #include <asm/unistd.h>
  50. };