syscall.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_M68K_SYSCALL_H
  3. #define _ASM_M68K_SYSCALL_H
  4. #include <uapi/linux/audit.h>
  5. #include <asm/unistd.h>
  6. extern const unsigned long sys_call_table[];
  7. static inline int syscall_get_nr(struct task_struct *task,
  8. struct pt_regs *regs)
  9. {
  10. return regs->orig_d0;
  11. }
  12. static inline void syscall_rollback(struct task_struct *task,
  13. struct pt_regs *regs)
  14. {
  15. regs->d0 = regs->orig_d0;
  16. }
  17. static inline long syscall_get_error(struct task_struct *task,
  18. struct pt_regs *regs)
  19. {
  20. unsigned long error = regs->d0;
  21. return IS_ERR_VALUE(error) ? error : 0;
  22. }
  23. static inline long syscall_get_return_value(struct task_struct *task,
  24. struct pt_regs *regs)
  25. {
  26. return regs->d0;
  27. }
  28. static inline void syscall_set_return_value(struct task_struct *task,
  29. struct pt_regs *regs,
  30. int error, long val)
  31. {
  32. regs->d0 = (long)error ?: val;
  33. }
  34. static inline void syscall_get_arguments(struct task_struct *task,
  35. struct pt_regs *regs,
  36. unsigned long *args)
  37. {
  38. args[0] = regs->orig_d0;
  39. args++;
  40. memcpy(args, &regs->d1, 5 * sizeof(args[0]));
  41. }
  42. static inline void syscall_set_arguments(struct task_struct *task,
  43. struct pt_regs *regs,
  44. unsigned long *args)
  45. {
  46. regs->orig_d0 = args[0];
  47. args++;
  48. memcpy(&regs->d1, args, 5 * sizeof(args[0]));
  49. }
  50. static inline int syscall_get_arch(struct task_struct *task)
  51. {
  52. return AUDIT_ARCH_M68K;
  53. }
  54. #endif /* _ASM_M68K_SYSCALL_H */