syscall_64.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #ifndef __ASM_SH_SYSCALL_64_H
  2. #define __ASM_SH_SYSCALL_64_H
  3. #include <linux/kernel.h>
  4. #include <linux/sched.h>
  5. #include <asm/ptrace.h>
  6. /* The system call number is given by the user in R9 */
  7. static inline long syscall_get_nr(struct task_struct *task,
  8. struct pt_regs *regs)
  9. {
  10. return (regs->syscall_nr >= 0) ? regs->regs[9] : -1L;
  11. }
  12. static inline void syscall_rollback(struct task_struct *task,
  13. struct pt_regs *regs)
  14. {
  15. /*
  16. * XXX: This needs some thought. On SH we don't
  17. * save away the original R9 value anywhere.
  18. */
  19. }
  20. static inline long syscall_get_error(struct task_struct *task,
  21. struct pt_regs *regs)
  22. {
  23. return IS_ERR_VALUE(regs->regs[9]) ? regs->regs[9] : 0;
  24. }
  25. static inline long syscall_get_return_value(struct task_struct *task,
  26. struct pt_regs *regs)
  27. {
  28. return regs->regs[9];
  29. }
  30. static inline void syscall_set_return_value(struct task_struct *task,
  31. struct pt_regs *regs,
  32. int error, long val)
  33. {
  34. if (error)
  35. regs->regs[9] = -error;
  36. else
  37. regs->regs[9] = val;
  38. }
  39. static inline void syscall_get_arguments(struct task_struct *task,
  40. struct pt_regs *regs,
  41. unsigned int i, unsigned int n,
  42. unsigned long *args)
  43. {
  44. BUG_ON(i + n > 6);
  45. memcpy(args, &regs->regs[2 + i], n * sizeof(args[0]));
  46. }
  47. static inline void syscall_set_arguments(struct task_struct *task,
  48. struct pt_regs *regs,
  49. unsigned int i, unsigned int n,
  50. const unsigned long *args)
  51. {
  52. BUG_ON(i + n > 6);
  53. memcpy(&regs->regs[2 + i], args, n * sizeof(args[0]));
  54. }
  55. #endif /* __ASM_SH_SYSCALL_64_H */