syscall.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __ASM_H8300_SYSCALLS_32_H
  3. #define __ASM_H8300_SYSCALLS_32_H
  4. #ifdef __KERNEL__
  5. #include <linux/compiler.h>
  6. #include <linux/linkage.h>
  7. #include <linux/types.h>
  8. #include <linux/ptrace.h>
  9. static inline int
  10. syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
  11. {
  12. return regs->orig_er0;
  13. }
  14. static inline void
  15. syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
  16. unsigned int i, unsigned int n, unsigned long *args)
  17. {
  18. BUG_ON(i + n > 6);
  19. while (n > 0) {
  20. switch (i) {
  21. case 0:
  22. *args++ = regs->er1;
  23. break;
  24. case 1:
  25. *args++ = regs->er2;
  26. break;
  27. case 2:
  28. *args++ = regs->er3;
  29. break;
  30. case 3:
  31. *args++ = regs->er4;
  32. break;
  33. case 4:
  34. *args++ = regs->er5;
  35. break;
  36. case 5:
  37. *args++ = regs->er6;
  38. break;
  39. }
  40. i++;
  41. n--;
  42. }
  43. }
  44. /* Misc syscall related bits */
  45. asmlinkage long do_syscall_trace_enter(struct pt_regs *regs);
  46. asmlinkage void do_syscall_trace_leave(struct pt_regs *regs);
  47. #endif /* __KERNEL__ */
  48. #endif /* __ASM_H8300_SYSCALLS_32_H */