ptrace-decl.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * Set of msr bits that gdb can change on behalf of a process.
  4. */
  5. #ifdef CONFIG_PPC_ADV_DEBUG_REGS
  6. #define MSR_DEBUGCHANGE 0
  7. #else
  8. #define MSR_DEBUGCHANGE (MSR_SE | MSR_BE)
  9. #endif
  10. /*
  11. * Max register writeable via put_reg
  12. */
  13. #ifdef CONFIG_PPC32
  14. #define PT_MAX_PUT_REG PT_MQ
  15. #else
  16. #define PT_MAX_PUT_REG PT_CCR
  17. #endif
  18. #define TVSO(f) (offsetof(struct thread_vr_state, f))
  19. #define TFSO(f) (offsetof(struct thread_fp_state, f))
  20. #define TSO(f) (offsetof(struct thread_struct, f))
  21. /*
  22. * These are our native regset flavors.
  23. */
  24. enum powerpc_regset {
  25. REGSET_GPR,
  26. REGSET_FPR,
  27. #ifdef CONFIG_ALTIVEC
  28. REGSET_VMX,
  29. #endif
  30. #ifdef CONFIG_VSX
  31. REGSET_VSX,
  32. #endif
  33. #ifdef CONFIG_SPE
  34. REGSET_SPE,
  35. #endif
  36. #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
  37. REGSET_TM_CGPR, /* TM checkpointed GPR registers */
  38. REGSET_TM_CFPR, /* TM checkpointed FPR registers */
  39. REGSET_TM_CVMX, /* TM checkpointed VMX registers */
  40. REGSET_TM_CVSX, /* TM checkpointed VSX registers */
  41. REGSET_TM_SPR, /* TM specific SPR registers */
  42. REGSET_TM_CTAR, /* TM checkpointed TAR register */
  43. REGSET_TM_CPPR, /* TM checkpointed PPR register */
  44. REGSET_TM_CDSCR, /* TM checkpointed DSCR register */
  45. #endif
  46. #ifdef CONFIG_PPC64
  47. REGSET_PPR, /* PPR register */
  48. REGSET_DSCR, /* DSCR register */
  49. #endif
  50. #ifdef CONFIG_PPC_BOOK3S_64
  51. REGSET_TAR, /* TAR register */
  52. REGSET_EBB, /* EBB registers */
  53. REGSET_PMR, /* Performance Monitor Registers */
  54. #endif
  55. #ifdef CONFIG_PPC_MEM_KEYS
  56. REGSET_PKEY, /* AMR register */
  57. #endif
  58. };
  59. /* ptrace-(no)vsx */
  60. user_regset_get2_fn fpr_get;
  61. int fpr_set(struct task_struct *target, const struct user_regset *regset,
  62. unsigned int pos, unsigned int count,
  63. const void *kbuf, const void __user *ubuf);
  64. /* ptrace-vsx */
  65. int vsr_active(struct task_struct *target, const struct user_regset *regset);
  66. user_regset_get2_fn vsr_get;
  67. int vsr_set(struct task_struct *target, const struct user_regset *regset,
  68. unsigned int pos, unsigned int count,
  69. const void *kbuf, const void __user *ubuf);
  70. /* ptrace-altivec */
  71. int vr_active(struct task_struct *target, const struct user_regset *regset);
  72. user_regset_get2_fn vr_get;
  73. int vr_set(struct task_struct *target, const struct user_regset *regset,
  74. unsigned int pos, unsigned int count,
  75. const void *kbuf, const void __user *ubuf);
  76. /* ptrace-spe */
  77. int evr_active(struct task_struct *target, const struct user_regset *regset);
  78. user_regset_get2_fn evr_get;
  79. int evr_set(struct task_struct *target, const struct user_regset *regset,
  80. unsigned int pos, unsigned int count,
  81. const void *kbuf, const void __user *ubuf);
  82. /* ptrace */
  83. int gpr32_get_common(struct task_struct *target,
  84. const struct user_regset *regset,
  85. struct membuf to,
  86. unsigned long *regs);
  87. int gpr32_set_common(struct task_struct *target,
  88. const struct user_regset *regset,
  89. unsigned int pos, unsigned int count,
  90. const void *kbuf, const void __user *ubuf,
  91. unsigned long *regs);
  92. /* ptrace-tm */
  93. #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
  94. void flush_tmregs_to_thread(struct task_struct *tsk);
  95. #else
  96. static inline void flush_tmregs_to_thread(struct task_struct *tsk) { }
  97. #endif
  98. int tm_cgpr_active(struct task_struct *target, const struct user_regset *regset);
  99. user_regset_get2_fn tm_cgpr_get;
  100. int tm_cgpr_set(struct task_struct *target, const struct user_regset *regset,
  101. unsigned int pos, unsigned int count,
  102. const void *kbuf, const void __user *ubuf);
  103. int tm_cfpr_active(struct task_struct *target, const struct user_regset *regset);
  104. user_regset_get2_fn tm_cfpr_get;
  105. int tm_cfpr_set(struct task_struct *target, const struct user_regset *regset,
  106. unsigned int pos, unsigned int count,
  107. const void *kbuf, const void __user *ubuf);
  108. int tm_cvmx_active(struct task_struct *target, const struct user_regset *regset);
  109. user_regset_get2_fn tm_cvmx_get;
  110. int tm_cvmx_set(struct task_struct *target, const struct user_regset *regset,
  111. unsigned int pos, unsigned int count,
  112. const void *kbuf, const void __user *ubuf);
  113. int tm_cvsx_active(struct task_struct *target, const struct user_regset *regset);
  114. user_regset_get2_fn tm_cvsx_get;
  115. int tm_cvsx_set(struct task_struct *target, const struct user_regset *regset,
  116. unsigned int pos, unsigned int count,
  117. const void *kbuf, const void __user *ubuf);
  118. int tm_spr_active(struct task_struct *target, const struct user_regset *regset);
  119. user_regset_get2_fn tm_spr_get;
  120. int tm_spr_set(struct task_struct *target, const struct user_regset *regset,
  121. unsigned int pos, unsigned int count,
  122. const void *kbuf, const void __user *ubuf);
  123. int tm_tar_active(struct task_struct *target, const struct user_regset *regset);
  124. user_regset_get2_fn tm_tar_get;
  125. int tm_tar_set(struct task_struct *target, const struct user_regset *regset,
  126. unsigned int pos, unsigned int count,
  127. const void *kbuf, const void __user *ubuf);
  128. int tm_ppr_active(struct task_struct *target, const struct user_regset *regset);
  129. user_regset_get2_fn tm_ppr_get;
  130. int tm_ppr_set(struct task_struct *target, const struct user_regset *regset,
  131. unsigned int pos, unsigned int count,
  132. const void *kbuf, const void __user *ubuf);
  133. int tm_dscr_active(struct task_struct *target, const struct user_regset *regset);
  134. user_regset_get2_fn tm_dscr_get;
  135. int tm_dscr_set(struct task_struct *target, const struct user_regset *regset,
  136. unsigned int pos, unsigned int count,
  137. const void *kbuf, const void __user *ubuf);
  138. user_regset_get2_fn tm_cgpr32_get;
  139. int tm_cgpr32_set(struct task_struct *target, const struct user_regset *regset,
  140. unsigned int pos, unsigned int count,
  141. const void *kbuf, const void __user *ubuf);
  142. /* ptrace-view */
  143. int ptrace_get_reg(struct task_struct *task, int regno, unsigned long *data);
  144. int ptrace_put_reg(struct task_struct *task, int regno, unsigned long data);
  145. extern const struct user_regset_view user_ppc_native_view;
  146. /* ptrace-fpu */
  147. int ptrace_get_fpr(struct task_struct *child, int index, unsigned long *data);
  148. int ptrace_put_fpr(struct task_struct *child, int index, unsigned long data);
  149. /* ptrace-(no)adv */
  150. void ppc_gethwdinfo(struct ppc_debug_info *dbginfo);
  151. int ptrace_get_debugreg(struct task_struct *child, unsigned long addr,
  152. unsigned long __user *datalp);
  153. int ptrace_set_debugreg(struct task_struct *task, unsigned long addr, unsigned long data);
  154. long ppc_set_hwdebug(struct task_struct *child, struct ppc_hw_breakpoint *bp_info);
  155. long ppc_del_hwdebug(struct task_struct *child, long data);