syscall.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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, unsigned int i,
  17. unsigned int n, unsigned long *args)
  18. {
  19. BUG_ON(i);
  20. switch (n) {
  21. case 6:
  22. args[5] = regs->gr[21];
  23. case 5:
  24. args[4] = regs->gr[22];
  25. case 4:
  26. args[3] = regs->gr[23];
  27. case 3:
  28. args[2] = regs->gr[24];
  29. case 2:
  30. args[1] = regs->gr[25];
  31. case 1:
  32. args[0] = regs->gr[26];
  33. case 0:
  34. break;
  35. default:
  36. BUG();
  37. }
  38. }
  39. static inline long syscall_get_return_value(struct task_struct *task,
  40. struct pt_regs *regs)
  41. {
  42. return regs->gr[28];
  43. }
  44. static inline void syscall_set_return_value(struct task_struct *task,
  45. struct pt_regs *regs,
  46. int error, long val)
  47. {
  48. regs->gr[28] = error ? error : val;
  49. }
  50. static inline void syscall_rollback(struct task_struct *task,
  51. struct pt_regs *regs)
  52. {
  53. /* do nothing */
  54. }
  55. static inline int syscall_get_arch(void)
  56. {
  57. int arch = AUDIT_ARCH_PARISC;
  58. #ifdef CONFIG_64BIT
  59. if (!is_compat_task())
  60. arch = AUDIT_ARCH_PARISC64;
  61. #endif
  62. return arch;
  63. }
  64. #endif /*_ASM_PARISC_SYSCALL_H_*/