ptrace.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. // SPDX-License-Identifier: GPL-2.0
  2. // Copyright (C) 2005-2017 Andes Technology Corporation
  3. #ifndef __ASM_NDS32_PTRACE_H
  4. #define __ASM_NDS32_PTRACE_H
  5. #include <uapi/asm/ptrace.h>
  6. /*
  7. * If pt_regs.syscallno == NO_SYSCALL, then the thread is not executing
  8. * a syscall -- i.e., its most recent entry into the kernel from
  9. * userspace was not via syscall, or otherwise a tracer cancelled the
  10. * syscall.
  11. *
  12. * This must have the value -1, for ABI compatibility with ptrace etc.
  13. */
  14. #define NO_SYSCALL (-1)
  15. #ifndef __ASSEMBLY__
  16. #include <linux/types.h>
  17. struct pt_regs {
  18. union {
  19. struct user_pt_regs user_regs;
  20. struct {
  21. long uregs[26];
  22. long fp;
  23. long gp;
  24. long lp;
  25. long sp;
  26. long ipc;
  27. #if defined(CONFIG_HWZOL)
  28. long lb;
  29. long le;
  30. long lc;
  31. #else
  32. long dummy[3];
  33. #endif
  34. long syscallno;
  35. };
  36. };
  37. long orig_r0;
  38. long ir0;
  39. long ipsw;
  40. long pipsw;
  41. long pipc;
  42. long pp0;
  43. long pp1;
  44. long fucop_ctl;
  45. long osp;
  46. };
  47. static inline bool in_syscall(struct pt_regs const *regs)
  48. {
  49. return regs->syscallno != NO_SYSCALL;
  50. }
  51. static inline void forget_syscall(struct pt_regs *regs)
  52. {
  53. regs->syscallno = NO_SYSCALL;
  54. }
  55. static inline unsigned long regs_return_value(struct pt_regs *regs)
  56. {
  57. return regs->uregs[0];
  58. }
  59. extern void show_regs(struct pt_regs *);
  60. /* Avoid circular header include via sched.h */
  61. struct task_struct;
  62. #define arch_has_single_step() (1)
  63. #define user_mode(regs) (((regs)->ipsw & PSW_mskPOM) == 0)
  64. #define interrupts_enabled(regs) (!!((regs)->ipsw & PSW_mskGIE))
  65. #define user_stack_pointer(regs) ((regs)->sp)
  66. #define instruction_pointer(regs) ((regs)->ipc)
  67. #define profile_pc(regs) instruction_pointer(regs)
  68. #endif /* __ASSEMBLY__ */
  69. #endif