xref: /linux/arch/mips/include/uapi/asm/ptrace.h (revision e2be04c7)
1*e2be04c7SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
261730c53SDavid Howells /*
361730c53SDavid Howells  * This file is subject to the terms and conditions of the GNU General Public
461730c53SDavid Howells  * License.  See the file "COPYING" in the main directory of this archive
561730c53SDavid Howells  * for more details.
661730c53SDavid Howells  *
761730c53SDavid Howells  * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000 by Ralf Baechle
861730c53SDavid Howells  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
961730c53SDavid Howells  */
1061730c53SDavid Howells #ifndef _UAPI_ASM_PTRACE_H
1161730c53SDavid Howells #define _UAPI_ASM_PTRACE_H
1261730c53SDavid Howells 
13cdb685adSAaro Koskinen #include <linux/types.h>
14cdb685adSAaro Koskinen 
1561730c53SDavid Howells /* 0 - 31 are integer registers, 32 - 63 are fp registers.  */
1661730c53SDavid Howells #define FPR_BASE	32
1761730c53SDavid Howells #define PC		64
1861730c53SDavid Howells #define CAUSE		65
1961730c53SDavid Howells #define BADVADDR	66
2061730c53SDavid Howells #define MMHI		67
2161730c53SDavid Howells #define MMLO		68
2261730c53SDavid Howells #define FPC_CSR		69
2361730c53SDavid Howells #define FPC_EIR		70
2461730c53SDavid Howells #define DSP_BASE	71		/* 3 more hi / lo register pairs */
2561730c53SDavid Howells #define DSP_CONTROL	77
2661730c53SDavid Howells #define ACX		78
2761730c53SDavid Howells 
2861730c53SDavid Howells /*
29a79ebea6SAlex Smith  * This struct defines the registers as used by PTRACE_{GET,SET}REGS. The
30a79ebea6SAlex Smith  * format is the same for both 32- and 64-bit processes. Registers for 32-bit
31a79ebea6SAlex Smith  * processes are sign extended.
3261730c53SDavid Howells  */
33a79ebea6SAlex Smith #ifdef __KERNEL__
34a79ebea6SAlex Smith struct user_pt_regs {
35a79ebea6SAlex Smith #else
3661730c53SDavid Howells struct pt_regs {
37a79ebea6SAlex Smith #endif
3861730c53SDavid Howells 	/* Saved main processor registers. */
39a79ebea6SAlex Smith 	__u64 regs[32];
4061730c53SDavid Howells 
4161730c53SDavid Howells 	/* Saved special registers. */
42a79ebea6SAlex Smith 	__u64 lo;
43a79ebea6SAlex Smith 	__u64 hi;
44a79ebea6SAlex Smith 	__u64 cp0_epc;
45a79ebea6SAlex Smith 	__u64 cp0_badvaddr;
46a79ebea6SAlex Smith 	__u64 cp0_status;
47a79ebea6SAlex Smith 	__u64 cp0_cause;
4861730c53SDavid Howells } __attribute__ ((aligned (8)));
4961730c53SDavid Howells 
5061730c53SDavid Howells /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
5161730c53SDavid Howells #define PTRACE_GETREGS		12
5261730c53SDavid Howells #define PTRACE_SETREGS		13
5361730c53SDavid Howells #define PTRACE_GETFPREGS		14
5461730c53SDavid Howells #define PTRACE_SETFPREGS		15
5561730c53SDavid Howells /* #define PTRACE_GETFPXREGS		18 */
5661730c53SDavid Howells /* #define PTRACE_SETFPXREGS		19 */
5761730c53SDavid Howells 
5861730c53SDavid Howells #define PTRACE_OLDSETOPTIONS	21
5961730c53SDavid Howells 
6061730c53SDavid Howells #define PTRACE_GET_THREAD_AREA	25
6161730c53SDavid Howells #define PTRACE_SET_THREAD_AREA	26
6261730c53SDavid Howells 
6361730c53SDavid Howells /* Calls to trace a 64bit program from a 32bit program.	 */
6461730c53SDavid Howells #define PTRACE_PEEKTEXT_3264	0xc0
6561730c53SDavid Howells #define PTRACE_PEEKDATA_3264	0xc1
6661730c53SDavid Howells #define PTRACE_POKETEXT_3264	0xc2
6761730c53SDavid Howells #define PTRACE_POKEDATA_3264	0xc3
6861730c53SDavid Howells #define PTRACE_GET_THREAD_AREA_3264	0xc4
6961730c53SDavid Howells 
7061730c53SDavid Howells /* Read and write watchpoint registers.	 */
7161730c53SDavid Howells enum pt_watch_style {
7261730c53SDavid Howells 	pt_watch_style_mips32,
7361730c53SDavid Howells 	pt_watch_style_mips64
7461730c53SDavid Howells };
7561730c53SDavid Howells struct mips32_watch_regs {
7661730c53SDavid Howells 	unsigned int watchlo[8];
7761730c53SDavid Howells 	/* Lower 16 bits of watchhi. */
7861730c53SDavid Howells 	unsigned short watchhi[8];
7961730c53SDavid Howells 	/* Valid mask and I R W bits.
8061730c53SDavid Howells 	 * bit 0 -- 1 if W bit is usable.
8161730c53SDavid Howells 	 * bit 1 -- 1 if R bit is usable.
8261730c53SDavid Howells 	 * bit 2 -- 1 if I bit is usable.
8361730c53SDavid Howells 	 * bits 3 - 11 -- Valid watchhi mask bits.
8461730c53SDavid Howells 	 */
8561730c53SDavid Howells 	unsigned short watch_masks[8];
8661730c53SDavid Howells 	/* The number of valid watch register pairs.  */
8761730c53SDavid Howells 	unsigned int num_valid;
8861730c53SDavid Howells } __attribute__((aligned(8)));
8961730c53SDavid Howells 
9061730c53SDavid Howells struct mips64_watch_regs {
9161730c53SDavid Howells 	unsigned long long watchlo[8];
9261730c53SDavid Howells 	unsigned short watchhi[8];
9361730c53SDavid Howells 	unsigned short watch_masks[8];
9461730c53SDavid Howells 	unsigned int num_valid;
9561730c53SDavid Howells } __attribute__((aligned(8)));
9661730c53SDavid Howells 
9761730c53SDavid Howells struct pt_watch_regs {
9861730c53SDavid Howells 	enum pt_watch_style style;
9961730c53SDavid Howells 	union {
10061730c53SDavid Howells 		struct mips32_watch_regs mips32;
10161730c53SDavid Howells 		struct mips64_watch_regs mips64;
10261730c53SDavid Howells 	};
10361730c53SDavid Howells };
10461730c53SDavid Howells 
10561730c53SDavid Howells #define PTRACE_GET_WATCH_REGS	0xd0
10661730c53SDavid Howells #define PTRACE_SET_WATCH_REGS	0xd1
10761730c53SDavid Howells 
10861730c53SDavid Howells 
10961730c53SDavid Howells #endif /* _UAPI_ASM_PTRACE_H */
110