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