2020-02-28 08:14:41 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
|
2023-06-19 15:36:25 +08:00
|
|
|
#include <linux/regset.h>
|
|
|
|
|
2020-02-28 08:14:44 +08:00
|
|
|
/*
|
|
|
|
* Set of msr bits that gdb can change on behalf of a process.
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_PPC_ADV_DEBUG_REGS
|
|
|
|
#define MSR_DEBUGCHANGE 0
|
|
|
|
#else
|
|
|
|
#define MSR_DEBUGCHANGE (MSR_SE | MSR_BE)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Max register writeable via put_reg
|
|
|
|
*/
|
|
|
|
#ifdef CONFIG_PPC32
|
|
|
|
#define PT_MAX_PUT_REG PT_MQ
|
|
|
|
#else
|
|
|
|
#define PT_MAX_PUT_REG PT_CCR
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define TVSO(f) (offsetof(struct thread_vr_state, f))
|
|
|
|
#define TFSO(f) (offsetof(struct thread_fp_state, f))
|
|
|
|
#define TSO(f) (offsetof(struct thread_struct, f))
|
|
|
|
|
2020-02-28 08:14:45 +08:00
|
|
|
/*
|
|
|
|
* These are our native regset flavors.
|
|
|
|
*/
|
|
|
|
enum powerpc_regset {
|
|
|
|
REGSET_GPR,
|
|
|
|
REGSET_FPR,
|
|
|
|
#ifdef CONFIG_ALTIVEC
|
|
|
|
REGSET_VMX,
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_VSX
|
|
|
|
REGSET_VSX,
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_SPE
|
|
|
|
REGSET_SPE,
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
|
|
|
|
REGSET_TM_CGPR, /* TM checkpointed GPR registers */
|
|
|
|
REGSET_TM_CFPR, /* TM checkpointed FPR registers */
|
|
|
|
REGSET_TM_CVMX, /* TM checkpointed VMX registers */
|
|
|
|
REGSET_TM_CVSX, /* TM checkpointed VSX registers */
|
|
|
|
REGSET_TM_SPR, /* TM specific SPR registers */
|
|
|
|
REGSET_TM_CTAR, /* TM checkpointed TAR register */
|
|
|
|
REGSET_TM_CPPR, /* TM checkpointed PPR register */
|
|
|
|
REGSET_TM_CDSCR, /* TM checkpointed DSCR register */
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_PPC64
|
|
|
|
REGSET_PPR, /* PPR register */
|
|
|
|
REGSET_DSCR, /* DSCR register */
|
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_PPC_BOOK3S_64
|
|
|
|
REGSET_TAR, /* TAR register */
|
|
|
|
REGSET_EBB, /* EBB registers */
|
|
|
|
REGSET_PMR, /* Performance Monitor Registers */
|
2023-06-19 15:36:26 +08:00
|
|
|
REGSET_DEXCR, /* DEXCR registers */
|
2023-06-19 15:36:26 +08:00
|
|
|
#ifdef CONFIG_CHECKPOINT_RESTORE
|
|
|
|
REGSET_HASHKEYR, /* HASHKEYR register */
|
|
|
|
#endif
|
2020-02-28 08:14:45 +08:00
|
|
|
#endif
|
|
|
|
#ifdef CONFIG_PPC_MEM_KEYS
|
|
|
|
REGSET_PKEY, /* AMR register */
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2020-02-28 08:14:41 +08:00
|
|
|
/* ptrace-(no)vsx */
|
|
|
|
|
2020-02-23 00:01:44 +08:00
|
|
|
user_regset_get2_fn fpr_get;
|
2020-02-28 08:14:41 +08:00
|
|
|
int fpr_set(struct task_struct *target, const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf);
|
|
|
|
|
|
|
|
/* ptrace-vsx */
|
|
|
|
|
|
|
|
int vsr_active(struct task_struct *target, const struct user_regset *regset);
|
2020-02-23 00:01:44 +08:00
|
|
|
user_regset_get2_fn vsr_get;
|
2020-02-28 08:14:41 +08:00
|
|
|
int vsr_set(struct task_struct *target, const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf);
|
|
|
|
|
2020-02-28 08:14:42 +08:00
|
|
|
/* ptrace-altivec */
|
|
|
|
|
|
|
|
int vr_active(struct task_struct *target, const struct user_regset *regset);
|
2020-02-23 00:01:44 +08:00
|
|
|
user_regset_get2_fn vr_get;
|
2020-02-28 08:14:42 +08:00
|
|
|
int vr_set(struct task_struct *target, const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf);
|
|
|
|
|
2020-02-28 08:14:43 +08:00
|
|
|
/* ptrace-spe */
|
|
|
|
|
|
|
|
int evr_active(struct task_struct *target, const struct user_regset *regset);
|
2020-02-23 00:01:44 +08:00
|
|
|
user_regset_get2_fn evr_get;
|
2020-02-28 08:14:43 +08:00
|
|
|
int evr_set(struct task_struct *target, const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf);
|
|
|
|
|
2020-02-28 08:14:41 +08:00
|
|
|
/* ptrace */
|
|
|
|
|
2020-02-28 08:14:44 +08:00
|
|
|
int gpr32_get_common(struct task_struct *target,
|
|
|
|
const struct user_regset *regset,
|
2020-02-23 00:01:44 +08:00
|
|
|
struct membuf to,
|
|
|
|
unsigned long *regs);
|
2020-02-28 08:14:44 +08:00
|
|
|
int gpr32_set_common(struct task_struct *target,
|
|
|
|
const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf,
|
|
|
|
unsigned long *regs);
|
|
|
|
|
|
|
|
/* ptrace-tm */
|
|
|
|
|
2020-02-28 08:14:41 +08:00
|
|
|
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
|
|
|
|
void flush_tmregs_to_thread(struct task_struct *tsk);
|
|
|
|
#else
|
|
|
|
static inline void flush_tmregs_to_thread(struct task_struct *tsk) { }
|
|
|
|
#endif
|
2020-02-28 08:14:44 +08:00
|
|
|
|
|
|
|
int tm_cgpr_active(struct task_struct *target, const struct user_regset *regset);
|
2020-02-23 00:01:44 +08:00
|
|
|
user_regset_get2_fn tm_cgpr_get;
|
2020-02-28 08:14:44 +08:00
|
|
|
int tm_cgpr_set(struct task_struct *target, const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf);
|
|
|
|
int tm_cfpr_active(struct task_struct *target, const struct user_regset *regset);
|
2020-02-23 00:01:44 +08:00
|
|
|
user_regset_get2_fn tm_cfpr_get;
|
2020-02-28 08:14:44 +08:00
|
|
|
int tm_cfpr_set(struct task_struct *target, const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf);
|
|
|
|
int tm_cvmx_active(struct task_struct *target, const struct user_regset *regset);
|
2020-02-23 00:01:44 +08:00
|
|
|
user_regset_get2_fn tm_cvmx_get;
|
2020-02-28 08:14:44 +08:00
|
|
|
int tm_cvmx_set(struct task_struct *target, const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf);
|
|
|
|
int tm_cvsx_active(struct task_struct *target, const struct user_regset *regset);
|
2020-02-23 00:01:44 +08:00
|
|
|
user_regset_get2_fn tm_cvsx_get;
|
2020-02-28 08:14:44 +08:00
|
|
|
int tm_cvsx_set(struct task_struct *target, const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf);
|
|
|
|
int tm_spr_active(struct task_struct *target, const struct user_regset *regset);
|
2020-02-23 00:01:44 +08:00
|
|
|
user_regset_get2_fn tm_spr_get;
|
2020-02-28 08:14:44 +08:00
|
|
|
int tm_spr_set(struct task_struct *target, const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf);
|
|
|
|
int tm_tar_active(struct task_struct *target, const struct user_regset *regset);
|
2020-02-23 00:01:44 +08:00
|
|
|
user_regset_get2_fn tm_tar_get;
|
2020-02-28 08:14:44 +08:00
|
|
|
int tm_tar_set(struct task_struct *target, const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf);
|
|
|
|
int tm_ppr_active(struct task_struct *target, const struct user_regset *regset);
|
2020-02-23 00:01:44 +08:00
|
|
|
user_regset_get2_fn tm_ppr_get;
|
2020-02-28 08:14:44 +08:00
|
|
|
int tm_ppr_set(struct task_struct *target, const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf);
|
|
|
|
int tm_dscr_active(struct task_struct *target, const struct user_regset *regset);
|
2020-02-23 00:01:44 +08:00
|
|
|
user_regset_get2_fn tm_dscr_get;
|
2020-02-28 08:14:44 +08:00
|
|
|
int tm_dscr_set(struct task_struct *target, const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf);
|
2020-02-23 00:01:44 +08:00
|
|
|
user_regset_get2_fn tm_cgpr32_get;
|
2020-02-28 08:14:44 +08:00
|
|
|
int tm_cgpr32_set(struct task_struct *target, const struct user_regset *regset,
|
|
|
|
unsigned int pos, unsigned int count,
|
|
|
|
const void *kbuf, const void __user *ubuf);
|
2020-02-28 08:14:45 +08:00
|
|
|
|
|
|
|
/* ptrace-view */
|
|
|
|
|
2020-08-19 01:19:14 +08:00
|
|
|
int ptrace_get_reg(struct task_struct *task, int regno, unsigned long *data);
|
|
|
|
int ptrace_put_reg(struct task_struct *task, int regno, unsigned long data);
|
|
|
|
|
2020-02-28 08:14:45 +08:00
|
|
|
extern const struct user_regset_view user_ppc_native_view;
|
2020-02-28 08:14:46 +08:00
|
|
|
|
2020-08-19 01:19:16 +08:00
|
|
|
/* ptrace-fpu */
|
|
|
|
int ptrace_get_fpr(struct task_struct *child, int index, unsigned long *data);
|
|
|
|
int ptrace_put_fpr(struct task_struct *child, int index, unsigned long data);
|
|
|
|
|
2020-02-28 08:14:46 +08:00
|
|
|
/* ptrace-(no)adv */
|
2020-02-28 08:14:48 +08:00
|
|
|
void ppc_gethwdinfo(struct ppc_debug_info *dbginfo);
|
2020-02-28 08:14:47 +08:00
|
|
|
int ptrace_get_debugreg(struct task_struct *child, unsigned long addr,
|
|
|
|
unsigned long __user *datalp);
|
2020-02-28 08:14:46 +08:00
|
|
|
int ptrace_set_debugreg(struct task_struct *task, unsigned long addr, unsigned long data);
|
|
|
|
long ppc_set_hwdebug(struct task_struct *child, struct ppc_hw_breakpoint *bp_info);
|
|
|
|
long ppc_del_hwdebug(struct task_struct *child, long data);
|