1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * This file is subject to the terms and conditions of the GNU General Public
4  * License.  See the file "COPYING" in the main directory of this archive
5  * for more details.
6  *
7  * Copyright (C) 1994, 95, 96, 97, 98, 99, 2000 by Ralf Baechle
8  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9  */
10 #ifndef _ASM_PTRACE_H
11 #define _ASM_PTRACE_H
12 
13 #include <linux/types.h>
14 
15 /* 0 - 31 are integer registers, 32 - 63 are fp registers.  */
16 #define FPR_BASE	32
17 #define PC		64
18 #define CAUSE		65
19 #define BADVADDR	66
20 #define MMHI		67
21 #define MMLO		68
22 #define FPC_CSR		69
23 #define FPC_EIR		70
24 #define DSP_BASE	71		/* 3 more hi / lo register pairs */
25 #define DSP_CONTROL	77
26 #define ACX		78
27 
28 /*
29  * This struct defines the registers as used by PTRACE_{GET,SET}REGS. The
30  * format is the same for both 32- and 64-bit processes. Registers for 32-bit
31  * processes are sign extended.
32  */
33 struct pt_regs {
34 	/* Saved main processor registers. */
35 	__u64 regs[32];
36 
37 	/* Saved special registers. */
38 	__u64 lo;
39 	__u64 hi;
40 	__u64 cp0_epc;
41 	__u64 cp0_badvaddr;
42 	__u64 cp0_status;
43 	__u64 cp0_cause;
44 } __attribute__ ((aligned (8)));
45 
46 /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
47 #define PTRACE_GETREGS		12
48 #define PTRACE_SETREGS		13
49 #define PTRACE_GETFPREGS		14
50 #define PTRACE_SETFPREGS		15
51 /* #define PTRACE_GETFPXREGS		18 */
52 /* #define PTRACE_SETFPXREGS		19 */
53 
54 #define PTRACE_OLDSETOPTIONS	21
55 
56 #define PTRACE_GET_THREAD_AREA	25
57 #define PTRACE_SET_THREAD_AREA	26
58 
59 /* Calls to trace a 64bit program from a 32bit program.	 */
60 #define PTRACE_PEEKTEXT_3264	0xc0
61 #define PTRACE_PEEKDATA_3264	0xc1
62 #define PTRACE_POKETEXT_3264	0xc2
63 #define PTRACE_POKEDATA_3264	0xc3
64 #define PTRACE_GET_THREAD_AREA_3264	0xc4
65 
66 /* Read and write watchpoint registers.	 */
67 enum pt_watch_style {
68 	pt_watch_style_mips32,
69 	pt_watch_style_mips64
70 };
71 struct mips32_watch_regs {
72 	unsigned int watchlo[8];
73 	/* Lower 16 bits of watchhi. */
74 	unsigned short watchhi[8];
75 	/* Valid mask and I R W bits.
76 	 * bit 0 -- 1 if W bit is usable.
77 	 * bit 1 -- 1 if R bit is usable.
78 	 * bit 2 -- 1 if I bit is usable.
79 	 * bits 3 - 11 -- Valid watchhi mask bits.
80 	 */
81 	unsigned short watch_masks[8];
82 	/* The number of valid watch register pairs.  */
83 	unsigned int num_valid;
84 } __attribute__((aligned(8)));
85 
86 struct mips64_watch_regs {
87 	unsigned long long watchlo[8];
88 	unsigned short watchhi[8];
89 	unsigned short watch_masks[8];
90 	unsigned int num_valid;
91 } __attribute__((aligned(8)));
92 
93 struct pt_watch_regs {
94 	enum pt_watch_style style;
95 	union {
96 		struct mips32_watch_regs mips32;
97 		struct mips64_watch_regs mips64;
98 	};
99 };
100 
101 #define PTRACE_GET_WATCH_REGS	0xd0
102 #define PTRACE_SET_WATCH_REGS	0xd1
103 
104 
105 #endif /* _ASM_PTRACE_H */