syscall_64.c 995 B

123456789101112131415161718192021222324252627282930313233343536
  1. // SPDX-License-Identifier: GPL-2.0
  2. /* System call table for x86-64. */
  3. #include <linux/linkage.h>
  4. #include <linux/sys.h>
  5. #include <linux/cache.h>
  6. #include <linux/syscalls.h>
  7. #include <asm/syscall.h>
  8. #define __SYSCALL(nr, sym) extern long __x64_##sym(const struct pt_regs *);
  9. #define __SYSCALL_NORETURN(nr, sym) extern long __noreturn __x64_##sym(const struct pt_regs *);
  10. #include <asm/syscalls_64.h>
  11. #undef __SYSCALL
  12. #undef __SYSCALL_NORETURN
  13. #define __SYSCALL_NORETURN __SYSCALL
  14. /*
  15. * The sys_call_table[] is no longer used for system calls, but
  16. * kernel/trace/trace_syscalls.c still wants to know the system
  17. * call address.
  18. */
  19. #define __SYSCALL(nr, sym) __x64_##sym,
  20. const sys_call_ptr_t sys_call_table[] = {
  21. #include <asm/syscalls_64.h>
  22. };
  23. #undef __SYSCALL
  24. #define __SYSCALL(nr, sym) case nr: return __x64_##sym(regs);
  25. long x64_sys_call(const struct pt_regs *regs, unsigned int nr)
  26. {
  27. switch (nr) {
  28. #include <asm/syscalls_64.h>
  29. default: return __x64_sys_ni_syscall(regs);
  30. }
  31. };