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