xref: /OK3568_Linux_fs/kernel/arch/ia64/include/uapi/asm/ptrace.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright (C) 1998-2004 Hewlett-Packard Co
4*4882a593Smuzhiyun  *	David Mosberger-Tang <davidm@hpl.hp.com>
5*4882a593Smuzhiyun  *	Stephane Eranian <eranian@hpl.hp.com>
6*4882a593Smuzhiyun  * Copyright (C) 2003 Intel Co
7*4882a593Smuzhiyun  *	Suresh Siddha <suresh.b.siddha@intel.com>
8*4882a593Smuzhiyun  *	Fenghua Yu <fenghua.yu@intel.com>
9*4882a593Smuzhiyun  *	Arun Sharma <arun.sharma@intel.com>
10*4882a593Smuzhiyun  *
11*4882a593Smuzhiyun  * 12/07/98	S. Eranian	added pt_regs & switch_stack
12*4882a593Smuzhiyun  * 12/21/98	D. Mosberger	updated to match latest code
13*4882a593Smuzhiyun  *  6/17/99	D. Mosberger	added second unat member to "struct switch_stack"
14*4882a593Smuzhiyun  *
15*4882a593Smuzhiyun  */
16*4882a593Smuzhiyun #ifndef _UAPI_ASM_IA64_PTRACE_H
17*4882a593Smuzhiyun #define _UAPI_ASM_IA64_PTRACE_H
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun /*
20*4882a593Smuzhiyun  * When a user process is blocked, its state looks as follows:
21*4882a593Smuzhiyun  *
22*4882a593Smuzhiyun  *            +----------------------+	-------	IA64_STK_OFFSET
23*4882a593Smuzhiyun  *     	      |			     |	 ^
24*4882a593Smuzhiyun  *            | struct pt_regs       |	 |
25*4882a593Smuzhiyun  *	      |			     |	 |
26*4882a593Smuzhiyun  *            +----------------------+	 |
27*4882a593Smuzhiyun  *	      |			     |	 |
28*4882a593Smuzhiyun  *     	      |	   memory stack	     |	 |
29*4882a593Smuzhiyun  *	      |	(growing downwards)  |	 |
30*4882a593Smuzhiyun  *	      //.....................//	 |
31*4882a593Smuzhiyun  *					 |
32*4882a593Smuzhiyun  *	      //.....................//	 |
33*4882a593Smuzhiyun  *	      |			     |	 |
34*4882a593Smuzhiyun  *            +----------------------+	 |
35*4882a593Smuzhiyun  *            | struct switch_stack  |	 |
36*4882a593Smuzhiyun  *	      |			     |	 |
37*4882a593Smuzhiyun  *	      +----------------------+	 |
38*4882a593Smuzhiyun  *	      |			     |	 |
39*4882a593Smuzhiyun  *	      //.....................//	 |
40*4882a593Smuzhiyun  *					 |
41*4882a593Smuzhiyun  *	      //.....................//	 |
42*4882a593Smuzhiyun  *	      |			     |	 |
43*4882a593Smuzhiyun  *	      |	 register stack	     |	 |
44*4882a593Smuzhiyun  *	      |	(growing upwards)    |	 |
45*4882a593Smuzhiyun  *            |			     |	 |
46*4882a593Smuzhiyun  *	      +----------------------+	 |  ---	IA64_RBS_OFFSET
47*4882a593Smuzhiyun  *            |  struct thread_info  |	 |  ^
48*4882a593Smuzhiyun  *	      +----------------------+	 |  |
49*4882a593Smuzhiyun  *	      |			     |	 |  |
50*4882a593Smuzhiyun  *            |  struct task_struct  |	 |  |
51*4882a593Smuzhiyun  * current -> |			     |   |  |
52*4882a593Smuzhiyun  *	      +----------------------+ -------
53*4882a593Smuzhiyun  *
54*4882a593Smuzhiyun  * Note that ar.ec is not saved explicitly in pt_reg or switch_stack.
55*4882a593Smuzhiyun  * This is because ar.ec is saved as part of ar.pfs.
56*4882a593Smuzhiyun  */
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun 
59*4882a593Smuzhiyun #include <asm/fpu.h>
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun #ifndef __ASSEMBLY__
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun /*
65*4882a593Smuzhiyun  * This struct defines the way the registers are saved on system
66*4882a593Smuzhiyun  * calls.
67*4882a593Smuzhiyun  *
68*4882a593Smuzhiyun  * We don't save all floating point register because the kernel
69*4882a593Smuzhiyun  * is compiled to use only a very small subset, so the other are
70*4882a593Smuzhiyun  * untouched.
71*4882a593Smuzhiyun  *
72*4882a593Smuzhiyun  * THIS STRUCTURE MUST BE A MULTIPLE 16-BYTE IN SIZE
73*4882a593Smuzhiyun  * (because the memory stack pointer MUST ALWAYS be aligned this way)
74*4882a593Smuzhiyun  *
75*4882a593Smuzhiyun  */
76*4882a593Smuzhiyun struct pt_regs {
77*4882a593Smuzhiyun 	/* The following registers are saved by SAVE_MIN: */
78*4882a593Smuzhiyun 	unsigned long b6;		/* scratch */
79*4882a593Smuzhiyun 	unsigned long b7;		/* scratch */
80*4882a593Smuzhiyun 
81*4882a593Smuzhiyun 	unsigned long ar_csd;           /* used by cmp8xchg16 (scratch) */
82*4882a593Smuzhiyun 	unsigned long ar_ssd;           /* reserved for future use (scratch) */
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun 	unsigned long r8;		/* scratch (return value register 0) */
85*4882a593Smuzhiyun 	unsigned long r9;		/* scratch (return value register 1) */
86*4882a593Smuzhiyun 	unsigned long r10;		/* scratch (return value register 2) */
87*4882a593Smuzhiyun 	unsigned long r11;		/* scratch (return value register 3) */
88*4882a593Smuzhiyun 
89*4882a593Smuzhiyun 	unsigned long cr_ipsr;		/* interrupted task's psr */
90*4882a593Smuzhiyun 	unsigned long cr_iip;		/* interrupted task's instruction pointer */
91*4882a593Smuzhiyun 	/*
92*4882a593Smuzhiyun 	 * interrupted task's function state; if bit 63 is cleared, it
93*4882a593Smuzhiyun 	 * contains syscall's ar.pfs.pfm:
94*4882a593Smuzhiyun 	 */
95*4882a593Smuzhiyun 	unsigned long cr_ifs;
96*4882a593Smuzhiyun 
97*4882a593Smuzhiyun 	unsigned long ar_unat;		/* interrupted task's NaT register (preserved) */
98*4882a593Smuzhiyun 	unsigned long ar_pfs;		/* prev function state  */
99*4882a593Smuzhiyun 	unsigned long ar_rsc;		/* RSE configuration */
100*4882a593Smuzhiyun 	/* The following two are valid only if cr_ipsr.cpl > 0 || ti->flags & _TIF_MCA_INIT */
101*4882a593Smuzhiyun 	unsigned long ar_rnat;		/* RSE NaT */
102*4882a593Smuzhiyun 	unsigned long ar_bspstore;	/* RSE bspstore */
103*4882a593Smuzhiyun 
104*4882a593Smuzhiyun 	unsigned long pr;		/* 64 predicate registers (1 bit each) */
105*4882a593Smuzhiyun 	unsigned long b0;		/* return pointer (bp) */
106*4882a593Smuzhiyun 	unsigned long loadrs;		/* size of dirty partition << 16 */
107*4882a593Smuzhiyun 
108*4882a593Smuzhiyun 	unsigned long r1;		/* the gp pointer */
109*4882a593Smuzhiyun 	unsigned long r12;		/* interrupted task's memory stack pointer */
110*4882a593Smuzhiyun 	unsigned long r13;		/* thread pointer */
111*4882a593Smuzhiyun 
112*4882a593Smuzhiyun 	unsigned long ar_fpsr;		/* floating point status (preserved) */
113*4882a593Smuzhiyun 	unsigned long r15;		/* scratch */
114*4882a593Smuzhiyun 
115*4882a593Smuzhiyun 	/* The remaining registers are NOT saved for system calls.  */
116*4882a593Smuzhiyun 
117*4882a593Smuzhiyun 	unsigned long r14;		/* scratch */
118*4882a593Smuzhiyun 	unsigned long r2;		/* scratch */
119*4882a593Smuzhiyun 	unsigned long r3;		/* scratch */
120*4882a593Smuzhiyun 
121*4882a593Smuzhiyun 	/* The following registers are saved by SAVE_REST: */
122*4882a593Smuzhiyun 	unsigned long r16;		/* scratch */
123*4882a593Smuzhiyun 	unsigned long r17;		/* scratch */
124*4882a593Smuzhiyun 	unsigned long r18;		/* scratch */
125*4882a593Smuzhiyun 	unsigned long r19;		/* scratch */
126*4882a593Smuzhiyun 	unsigned long r20;		/* scratch */
127*4882a593Smuzhiyun 	unsigned long r21;		/* scratch */
128*4882a593Smuzhiyun 	unsigned long r22;		/* scratch */
129*4882a593Smuzhiyun 	unsigned long r23;		/* scratch */
130*4882a593Smuzhiyun 	unsigned long r24;		/* scratch */
131*4882a593Smuzhiyun 	unsigned long r25;		/* scratch */
132*4882a593Smuzhiyun 	unsigned long r26;		/* scratch */
133*4882a593Smuzhiyun 	unsigned long r27;		/* scratch */
134*4882a593Smuzhiyun 	unsigned long r28;		/* scratch */
135*4882a593Smuzhiyun 	unsigned long r29;		/* scratch */
136*4882a593Smuzhiyun 	unsigned long r30;		/* scratch */
137*4882a593Smuzhiyun 	unsigned long r31;		/* scratch */
138*4882a593Smuzhiyun 
139*4882a593Smuzhiyun 	unsigned long ar_ccv;		/* compare/exchange value (scratch) */
140*4882a593Smuzhiyun 
141*4882a593Smuzhiyun 	/*
142*4882a593Smuzhiyun 	 * Floating point registers that the kernel considers scratch:
143*4882a593Smuzhiyun 	 */
144*4882a593Smuzhiyun 	struct ia64_fpreg f6;		/* scratch */
145*4882a593Smuzhiyun 	struct ia64_fpreg f7;		/* scratch */
146*4882a593Smuzhiyun 	struct ia64_fpreg f8;		/* scratch */
147*4882a593Smuzhiyun 	struct ia64_fpreg f9;		/* scratch */
148*4882a593Smuzhiyun 	struct ia64_fpreg f10;		/* scratch */
149*4882a593Smuzhiyun 	struct ia64_fpreg f11;		/* scratch */
150*4882a593Smuzhiyun };
151*4882a593Smuzhiyun 
152*4882a593Smuzhiyun /*
153*4882a593Smuzhiyun  * This structure contains the addition registers that need to
154*4882a593Smuzhiyun  * preserved across a context switch.  This generally consists of
155*4882a593Smuzhiyun  * "preserved" registers.
156*4882a593Smuzhiyun  */
157*4882a593Smuzhiyun struct switch_stack {
158*4882a593Smuzhiyun 	unsigned long caller_unat;	/* user NaT collection register (preserved) */
159*4882a593Smuzhiyun 	unsigned long ar_fpsr;		/* floating-point status register */
160*4882a593Smuzhiyun 
161*4882a593Smuzhiyun 	struct ia64_fpreg f2;		/* preserved */
162*4882a593Smuzhiyun 	struct ia64_fpreg f3;		/* preserved */
163*4882a593Smuzhiyun 	struct ia64_fpreg f4;		/* preserved */
164*4882a593Smuzhiyun 	struct ia64_fpreg f5;		/* preserved */
165*4882a593Smuzhiyun 
166*4882a593Smuzhiyun 	struct ia64_fpreg f12;		/* scratch, but untouched by kernel */
167*4882a593Smuzhiyun 	struct ia64_fpreg f13;		/* scratch, but untouched by kernel */
168*4882a593Smuzhiyun 	struct ia64_fpreg f14;		/* scratch, but untouched by kernel */
169*4882a593Smuzhiyun 	struct ia64_fpreg f15;		/* scratch, but untouched by kernel */
170*4882a593Smuzhiyun 	struct ia64_fpreg f16;		/* preserved */
171*4882a593Smuzhiyun 	struct ia64_fpreg f17;		/* preserved */
172*4882a593Smuzhiyun 	struct ia64_fpreg f18;		/* preserved */
173*4882a593Smuzhiyun 	struct ia64_fpreg f19;		/* preserved */
174*4882a593Smuzhiyun 	struct ia64_fpreg f20;		/* preserved */
175*4882a593Smuzhiyun 	struct ia64_fpreg f21;		/* preserved */
176*4882a593Smuzhiyun 	struct ia64_fpreg f22;		/* preserved */
177*4882a593Smuzhiyun 	struct ia64_fpreg f23;		/* preserved */
178*4882a593Smuzhiyun 	struct ia64_fpreg f24;		/* preserved */
179*4882a593Smuzhiyun 	struct ia64_fpreg f25;		/* preserved */
180*4882a593Smuzhiyun 	struct ia64_fpreg f26;		/* preserved */
181*4882a593Smuzhiyun 	struct ia64_fpreg f27;		/* preserved */
182*4882a593Smuzhiyun 	struct ia64_fpreg f28;		/* preserved */
183*4882a593Smuzhiyun 	struct ia64_fpreg f29;		/* preserved */
184*4882a593Smuzhiyun 	struct ia64_fpreg f30;		/* preserved */
185*4882a593Smuzhiyun 	struct ia64_fpreg f31;		/* preserved */
186*4882a593Smuzhiyun 
187*4882a593Smuzhiyun 	unsigned long r4;		/* preserved */
188*4882a593Smuzhiyun 	unsigned long r5;		/* preserved */
189*4882a593Smuzhiyun 	unsigned long r6;		/* preserved */
190*4882a593Smuzhiyun 	unsigned long r7;		/* preserved */
191*4882a593Smuzhiyun 
192*4882a593Smuzhiyun 	unsigned long b0;		/* so we can force a direct return in copy_thread */
193*4882a593Smuzhiyun 	unsigned long b1;
194*4882a593Smuzhiyun 	unsigned long b2;
195*4882a593Smuzhiyun 	unsigned long b3;
196*4882a593Smuzhiyun 	unsigned long b4;
197*4882a593Smuzhiyun 	unsigned long b5;
198*4882a593Smuzhiyun 
199*4882a593Smuzhiyun 	unsigned long ar_pfs;		/* previous function state */
200*4882a593Smuzhiyun 	unsigned long ar_lc;		/* loop counter (preserved) */
201*4882a593Smuzhiyun 	unsigned long ar_unat;		/* NaT bits for r4-r7 */
202*4882a593Smuzhiyun 	unsigned long ar_rnat;		/* RSE NaT collection register */
203*4882a593Smuzhiyun 	unsigned long ar_bspstore;	/* RSE dirty base (preserved) */
204*4882a593Smuzhiyun 	unsigned long pr;		/* 64 predicate registers (1 bit each) */
205*4882a593Smuzhiyun };
206*4882a593Smuzhiyun 
207*4882a593Smuzhiyun 
208*4882a593Smuzhiyun /* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */
209*4882a593Smuzhiyun struct pt_all_user_regs {
210*4882a593Smuzhiyun 	unsigned long nat;
211*4882a593Smuzhiyun 	unsigned long cr_iip;
212*4882a593Smuzhiyun 	unsigned long cfm;
213*4882a593Smuzhiyun 	unsigned long cr_ipsr;
214*4882a593Smuzhiyun 	unsigned long pr;
215*4882a593Smuzhiyun 
216*4882a593Smuzhiyun 	unsigned long gr[32];
217*4882a593Smuzhiyun 	unsigned long br[8];
218*4882a593Smuzhiyun 	unsigned long ar[128];
219*4882a593Smuzhiyun 	struct ia64_fpreg fr[128];
220*4882a593Smuzhiyun };
221*4882a593Smuzhiyun 
222*4882a593Smuzhiyun #endif /* !__ASSEMBLY__ */
223*4882a593Smuzhiyun 
224*4882a593Smuzhiyun /* indices to application-registers array in pt_all_user_regs */
225*4882a593Smuzhiyun #define PT_AUR_RSC	16
226*4882a593Smuzhiyun #define PT_AUR_BSP	17
227*4882a593Smuzhiyun #define PT_AUR_BSPSTORE	18
228*4882a593Smuzhiyun #define PT_AUR_RNAT	19
229*4882a593Smuzhiyun #define PT_AUR_CCV	32
230*4882a593Smuzhiyun #define PT_AUR_UNAT	36
231*4882a593Smuzhiyun #define PT_AUR_FPSR	40
232*4882a593Smuzhiyun #define PT_AUR_PFS	64
233*4882a593Smuzhiyun #define PT_AUR_LC	65
234*4882a593Smuzhiyun #define PT_AUR_EC	66
235*4882a593Smuzhiyun 
236*4882a593Smuzhiyun /*
237*4882a593Smuzhiyun  * The numbers chosen here are somewhat arbitrary but absolutely MUST
238*4882a593Smuzhiyun  * not overlap with any of the number assigned in <linux/ptrace.h>.
239*4882a593Smuzhiyun  */
240*4882a593Smuzhiyun #define PTRACE_SINGLEBLOCK	12	/* resume execution until next branch */
241*4882a593Smuzhiyun #define PTRACE_OLD_GETSIGINFO	13	/* (replaced by PTRACE_GETSIGINFO in <linux/ptrace.h>)  */
242*4882a593Smuzhiyun #define PTRACE_OLD_SETSIGINFO	14	/* (replaced by PTRACE_SETSIGINFO in <linux/ptrace.h>)  */
243*4882a593Smuzhiyun #define PTRACE_GETREGS		18	/* get all registers (pt_all_user_regs) in one shot */
244*4882a593Smuzhiyun #define PTRACE_SETREGS		19	/* set all registers (pt_all_user_regs) in one shot */
245*4882a593Smuzhiyun 
246*4882a593Smuzhiyun #define PTRACE_OLDSETOPTIONS	21
247*4882a593Smuzhiyun 
248*4882a593Smuzhiyun #endif /* _UAPI_ASM_IA64_PTRACE_H */
249