syscall.h 1.2 KB

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