syscall.h 1.4 KB

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