syscall.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* syscall.h */
  3. #ifndef _ASM_PARISC_SYSCALL_H_
  4. #define _ASM_PARISC_SYSCALL_H_
  5. #include <uapi/linux/audit.h>
  6. #include <linux/compat.h>
  7. #include <linux/err.h>
  8. #include <asm/ptrace.h>
  9. #define NR_syscalls (__NR_Linux_syscalls)
  10. static inline long syscall_get_nr(struct task_struct *tsk,
  11. struct pt_regs *regs)
  12. {
  13. return regs->gr[20];
  14. }
  15. static inline void syscall_get_arguments(struct task_struct *tsk,
  16. struct pt_regs *regs,
  17. unsigned long *args)
  18. {
  19. args[5] = regs->gr[21];
  20. args[4] = regs->gr[22];
  21. args[3] = regs->gr[23];
  22. args[2] = regs->gr[24];
  23. args[1] = regs->gr[25];
  24. args[0] = regs->gr[26];
  25. }
  26. static inline long syscall_get_error(struct task_struct *task,
  27. struct pt_regs *regs)
  28. {
  29. unsigned long error = regs->gr[28];
  30. return IS_ERR_VALUE(error) ? error : 0;
  31. }
  32. static inline long syscall_get_return_value(struct task_struct *task,
  33. struct pt_regs *regs)
  34. {
  35. return regs->gr[28];
  36. }
  37. static inline void syscall_set_return_value(struct task_struct *task,
  38. struct pt_regs *regs,
  39. int error, long val)
  40. {
  41. regs->gr[28] = error ? error : val;
  42. }
  43. static inline void syscall_rollback(struct task_struct *task,
  44. struct pt_regs *regs)
  45. {
  46. /* do nothing */
  47. }
  48. static inline int syscall_get_arch(struct task_struct *task)
  49. {
  50. int arch = AUDIT_ARCH_PARISC;
  51. #ifdef CONFIG_64BIT
  52. if (!__is_compat_task(task))
  53. arch = AUDIT_ARCH_PARISC64;
  54. #endif
  55. return arch;
  56. }
  57. #endif /*_ASM_PARISC_SYSCALL_H_*/