xref: /openbmc/linux/arch/powerpc/kernel/ptrace/ptrace-decl.h (revision 7c1f8db019f82e5f81bf1a84fd8b064d5d01652a)
17b99ed4eSChristophe Leroy /* SPDX-License-Identifier: GPL-2.0-or-later */
27b99ed4eSChristophe Leroy 
3*7c1f8db0SChristophe Leroy /*
4*7c1f8db0SChristophe Leroy  * Set of msr bits that gdb can change on behalf of a process.
5*7c1f8db0SChristophe Leroy  */
6*7c1f8db0SChristophe Leroy #ifdef CONFIG_PPC_ADV_DEBUG_REGS
7*7c1f8db0SChristophe Leroy #define MSR_DEBUGCHANGE	0
8*7c1f8db0SChristophe Leroy #else
9*7c1f8db0SChristophe Leroy #define MSR_DEBUGCHANGE	(MSR_SE | MSR_BE)
10*7c1f8db0SChristophe Leroy #endif
11*7c1f8db0SChristophe Leroy 
12*7c1f8db0SChristophe Leroy /*
13*7c1f8db0SChristophe Leroy  * Max register writeable via put_reg
14*7c1f8db0SChristophe Leroy  */
15*7c1f8db0SChristophe Leroy #ifdef CONFIG_PPC32
16*7c1f8db0SChristophe Leroy #define PT_MAX_PUT_REG	PT_MQ
17*7c1f8db0SChristophe Leroy #else
18*7c1f8db0SChristophe Leroy #define PT_MAX_PUT_REG	PT_CCR
19*7c1f8db0SChristophe Leroy #endif
20*7c1f8db0SChristophe Leroy 
21*7c1f8db0SChristophe Leroy #define TVSO(f)	(offsetof(struct thread_vr_state, f))
22*7c1f8db0SChristophe Leroy #define TFSO(f)	(offsetof(struct thread_fp_state, f))
23*7c1f8db0SChristophe Leroy #define TSO(f)	(offsetof(struct thread_struct, f))
24*7c1f8db0SChristophe Leroy 
257b99ed4eSChristophe Leroy /* ptrace-(no)vsx */
267b99ed4eSChristophe Leroy 
277b99ed4eSChristophe Leroy int fpr_get(struct task_struct *target, const struct user_regset *regset,
287b99ed4eSChristophe Leroy 	    unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
297b99ed4eSChristophe Leroy int fpr_set(struct task_struct *target, const struct user_regset *regset,
307b99ed4eSChristophe Leroy 	    unsigned int pos, unsigned int count,
317b99ed4eSChristophe Leroy 	    const void *kbuf, const void __user *ubuf);
327b99ed4eSChristophe Leroy 
337b99ed4eSChristophe Leroy /* ptrace-vsx */
347b99ed4eSChristophe Leroy 
357b99ed4eSChristophe Leroy int vsr_active(struct task_struct *target, const struct user_regset *regset);
367b99ed4eSChristophe Leroy int vsr_get(struct task_struct *target, const struct user_regset *regset,
377b99ed4eSChristophe Leroy 	    unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
387b99ed4eSChristophe Leroy int vsr_set(struct task_struct *target, const struct user_regset *regset,
397b99ed4eSChristophe Leroy 	    unsigned int pos, unsigned int count,
407b99ed4eSChristophe Leroy 	    const void *kbuf, const void __user *ubuf);
417b99ed4eSChristophe Leroy 
421b20773bSChristophe Leroy /* ptrace-altivec */
431b20773bSChristophe Leroy 
441b20773bSChristophe Leroy int vr_active(struct task_struct *target, const struct user_regset *regset);
451b20773bSChristophe Leroy int vr_get(struct task_struct *target, const struct user_regset *regset,
461b20773bSChristophe Leroy 	   unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
471b20773bSChristophe Leroy int vr_set(struct task_struct *target, const struct user_regset *regset,
481b20773bSChristophe Leroy 	   unsigned int pos, unsigned int count,
491b20773bSChristophe Leroy 	   const void *kbuf, const void __user *ubuf);
501b20773bSChristophe Leroy 
5160ef9dbdSChristophe Leroy /* ptrace-spe */
5260ef9dbdSChristophe Leroy 
5360ef9dbdSChristophe Leroy int evr_active(struct task_struct *target, const struct user_regset *regset);
5460ef9dbdSChristophe Leroy int evr_get(struct task_struct *target, const struct user_regset *regset,
5560ef9dbdSChristophe Leroy 	    unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
5660ef9dbdSChristophe Leroy int evr_set(struct task_struct *target, const struct user_regset *regset,
5760ef9dbdSChristophe Leroy 	    unsigned int pos, unsigned int count,
5860ef9dbdSChristophe Leroy 	    const void *kbuf, const void __user *ubuf);
5960ef9dbdSChristophe Leroy 
607b99ed4eSChristophe Leroy /* ptrace */
617b99ed4eSChristophe Leroy 
62*7c1f8db0SChristophe Leroy int gpr32_get_common(struct task_struct *target,
63*7c1f8db0SChristophe Leroy 		     const struct user_regset *regset,
64*7c1f8db0SChristophe Leroy 		     unsigned int pos, unsigned int count,
65*7c1f8db0SChristophe Leroy 			    void *kbuf, void __user *ubuf,
66*7c1f8db0SChristophe Leroy 			    unsigned long *regs);
67*7c1f8db0SChristophe Leroy int gpr32_set_common(struct task_struct *target,
68*7c1f8db0SChristophe Leroy 		     const struct user_regset *regset,
69*7c1f8db0SChristophe Leroy 		     unsigned int pos, unsigned int count,
70*7c1f8db0SChristophe Leroy 		     const void *kbuf, const void __user *ubuf,
71*7c1f8db0SChristophe Leroy 		     unsigned long *regs);
72*7c1f8db0SChristophe Leroy 
73*7c1f8db0SChristophe Leroy /* ptrace-tm */
74*7c1f8db0SChristophe Leroy 
757b99ed4eSChristophe Leroy #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
767b99ed4eSChristophe Leroy void flush_tmregs_to_thread(struct task_struct *tsk);
777b99ed4eSChristophe Leroy #else
787b99ed4eSChristophe Leroy static inline void flush_tmregs_to_thread(struct task_struct *tsk) { }
797b99ed4eSChristophe Leroy #endif
80*7c1f8db0SChristophe Leroy 
81*7c1f8db0SChristophe Leroy int tm_cgpr_active(struct task_struct *target, const struct user_regset *regset);
82*7c1f8db0SChristophe Leroy int tm_cgpr_get(struct task_struct *target, const struct user_regset *regset,
83*7c1f8db0SChristophe Leroy 		unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
84*7c1f8db0SChristophe Leroy int tm_cgpr_set(struct task_struct *target, const struct user_regset *regset,
85*7c1f8db0SChristophe Leroy 		unsigned int pos, unsigned int count,
86*7c1f8db0SChristophe Leroy 		const void *kbuf, const void __user *ubuf);
87*7c1f8db0SChristophe Leroy int tm_cfpr_active(struct task_struct *target, const struct user_regset *regset);
88*7c1f8db0SChristophe Leroy int tm_cfpr_get(struct task_struct *target, const struct user_regset *regset,
89*7c1f8db0SChristophe Leroy 		unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
90*7c1f8db0SChristophe Leroy int tm_cfpr_set(struct task_struct *target, const struct user_regset *regset,
91*7c1f8db0SChristophe Leroy 		unsigned int pos, unsigned int count,
92*7c1f8db0SChristophe Leroy 		const void *kbuf, const void __user *ubuf);
93*7c1f8db0SChristophe Leroy int tm_cvmx_active(struct task_struct *target, const struct user_regset *regset);
94*7c1f8db0SChristophe Leroy int tm_cvmx_get(struct task_struct *target, const struct user_regset *regset,
95*7c1f8db0SChristophe Leroy 		unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
96*7c1f8db0SChristophe Leroy int tm_cvmx_set(struct task_struct *target, const struct user_regset *regset,
97*7c1f8db0SChristophe Leroy 		unsigned int pos, unsigned int count,
98*7c1f8db0SChristophe Leroy 		const void *kbuf, const void __user *ubuf);
99*7c1f8db0SChristophe Leroy int tm_cvsx_active(struct task_struct *target, const struct user_regset *regset);
100*7c1f8db0SChristophe Leroy int tm_cvsx_get(struct task_struct *target, const struct user_regset *regset,
101*7c1f8db0SChristophe Leroy 		unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
102*7c1f8db0SChristophe Leroy int tm_cvsx_set(struct task_struct *target, const struct user_regset *regset,
103*7c1f8db0SChristophe Leroy 		unsigned int pos, unsigned int count,
104*7c1f8db0SChristophe Leroy 		const void *kbuf, const void __user *ubuf);
105*7c1f8db0SChristophe Leroy int tm_spr_active(struct task_struct *target, const struct user_regset *regset);
106*7c1f8db0SChristophe Leroy int tm_spr_get(struct task_struct *target, const struct user_regset *regset,
107*7c1f8db0SChristophe Leroy 	       unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
108*7c1f8db0SChristophe Leroy int tm_spr_set(struct task_struct *target, const struct user_regset *regset,
109*7c1f8db0SChristophe Leroy 	       unsigned int pos, unsigned int count,
110*7c1f8db0SChristophe Leroy 	       const void *kbuf, const void __user *ubuf);
111*7c1f8db0SChristophe Leroy int tm_tar_active(struct task_struct *target, const struct user_regset *regset);
112*7c1f8db0SChristophe Leroy int tm_tar_get(struct task_struct *target, const struct user_regset *regset,
113*7c1f8db0SChristophe Leroy 	       unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
114*7c1f8db0SChristophe Leroy int tm_tar_set(struct task_struct *target, const struct user_regset *regset,
115*7c1f8db0SChristophe Leroy 	       unsigned int pos, unsigned int count,
116*7c1f8db0SChristophe Leroy 	       const void *kbuf, const void __user *ubuf);
117*7c1f8db0SChristophe Leroy int tm_ppr_active(struct task_struct *target, const struct user_regset *regset);
118*7c1f8db0SChristophe Leroy int tm_ppr_get(struct task_struct *target, const struct user_regset *regset,
119*7c1f8db0SChristophe Leroy 	       unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
120*7c1f8db0SChristophe Leroy int tm_ppr_set(struct task_struct *target, const struct user_regset *regset,
121*7c1f8db0SChristophe Leroy 	       unsigned int pos, unsigned int count,
122*7c1f8db0SChristophe Leroy 	       const void *kbuf, const void __user *ubuf);
123*7c1f8db0SChristophe Leroy int tm_dscr_active(struct task_struct *target, const struct user_regset *regset);
124*7c1f8db0SChristophe Leroy int tm_dscr_get(struct task_struct *target, const struct user_regset *regset,
125*7c1f8db0SChristophe Leroy 		unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
126*7c1f8db0SChristophe Leroy int tm_dscr_set(struct task_struct *target, const struct user_regset *regset,
127*7c1f8db0SChristophe Leroy 		unsigned int pos, unsigned int count,
128*7c1f8db0SChristophe Leroy 		const void *kbuf, const void __user *ubuf);
129*7c1f8db0SChristophe Leroy int tm_cgpr32_get(struct task_struct *target, const struct user_regset *regset,
130*7c1f8db0SChristophe Leroy 		  unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf);
131*7c1f8db0SChristophe Leroy int tm_cgpr32_set(struct task_struct *target, const struct user_regset *regset,
132*7c1f8db0SChristophe Leroy 		  unsigned int pos, unsigned int count,
133*7c1f8db0SChristophe Leroy 		  const void *kbuf, const void __user *ubuf);
134