162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 1998-2004 Hewlett-Packard Co
462306a36Sopenharmony_ci *	David Mosberger-Tang <davidm@hpl.hp.com>
562306a36Sopenharmony_ci *	Stephane Eranian <eranian@hpl.hp.com>
662306a36Sopenharmony_ci * Copyright (C) 2003 Intel Co
762306a36Sopenharmony_ci *	Suresh Siddha <suresh.b.siddha@intel.com>
862306a36Sopenharmony_ci *	Fenghua Yu <fenghua.yu@intel.com>
962306a36Sopenharmony_ci *	Arun Sharma <arun.sharma@intel.com>
1062306a36Sopenharmony_ci *
1162306a36Sopenharmony_ci * 12/07/98	S. Eranian	added pt_regs & switch_stack
1262306a36Sopenharmony_ci * 12/21/98	D. Mosberger	updated to match latest code
1362306a36Sopenharmony_ci *  6/17/99	D. Mosberger	added second unat member to "struct switch_stack"
1462306a36Sopenharmony_ci *
1562306a36Sopenharmony_ci */
1662306a36Sopenharmony_ci#ifndef _UAPI_ASM_IA64_PTRACE_H
1762306a36Sopenharmony_ci#define _UAPI_ASM_IA64_PTRACE_H
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci/*
2062306a36Sopenharmony_ci * When a user process is blocked, its state looks as follows:
2162306a36Sopenharmony_ci *
2262306a36Sopenharmony_ci *            +----------------------+	-------	IA64_STK_OFFSET
2362306a36Sopenharmony_ci *     	      |			     |	 ^
2462306a36Sopenharmony_ci *            | struct pt_regs       |	 |
2562306a36Sopenharmony_ci *	      |			     |	 |
2662306a36Sopenharmony_ci *            +----------------------+	 |
2762306a36Sopenharmony_ci *	      |			     |	 |
2862306a36Sopenharmony_ci *     	      |	   memory stack	     |	 |
2962306a36Sopenharmony_ci *	      |	(growing downwards)  |	 |
3062306a36Sopenharmony_ci *	      //.....................//	 |
3162306a36Sopenharmony_ci *					 |
3262306a36Sopenharmony_ci *	      //.....................//	 |
3362306a36Sopenharmony_ci *	      |			     |	 |
3462306a36Sopenharmony_ci *            +----------------------+	 |
3562306a36Sopenharmony_ci *            | struct switch_stack  |	 |
3662306a36Sopenharmony_ci *	      |			     |	 |
3762306a36Sopenharmony_ci *	      +----------------------+	 |
3862306a36Sopenharmony_ci *	      |			     |	 |
3962306a36Sopenharmony_ci *	      //.....................//	 |
4062306a36Sopenharmony_ci *					 |
4162306a36Sopenharmony_ci *	      //.....................//	 |
4262306a36Sopenharmony_ci *	      |			     |	 |
4362306a36Sopenharmony_ci *	      |	 register stack	     |	 |
4462306a36Sopenharmony_ci *	      |	(growing upwards)    |	 |
4562306a36Sopenharmony_ci *            |			     |	 |
4662306a36Sopenharmony_ci *	      +----------------------+	 |  ---	IA64_RBS_OFFSET
4762306a36Sopenharmony_ci *            |  struct thread_info  |	 |  ^
4862306a36Sopenharmony_ci *	      +----------------------+	 |  |
4962306a36Sopenharmony_ci *	      |			     |	 |  |
5062306a36Sopenharmony_ci *            |  struct task_struct  |	 |  |
5162306a36Sopenharmony_ci * current -> |			     |   |  |
5262306a36Sopenharmony_ci *	      +----------------------+ -------
5362306a36Sopenharmony_ci *
5462306a36Sopenharmony_ci * Note that ar.ec is not saved explicitly in pt_reg or switch_stack.
5562306a36Sopenharmony_ci * This is because ar.ec is saved as part of ar.pfs.
5662306a36Sopenharmony_ci */
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci#include <asm/fpu.h>
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci#ifndef __ASSEMBLY__
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci/*
6562306a36Sopenharmony_ci * This struct defines the way the registers are saved on system
6662306a36Sopenharmony_ci * calls.
6762306a36Sopenharmony_ci *
6862306a36Sopenharmony_ci * We don't save all floating point register because the kernel
6962306a36Sopenharmony_ci * is compiled to use only a very small subset, so the other are
7062306a36Sopenharmony_ci * untouched.
7162306a36Sopenharmony_ci *
7262306a36Sopenharmony_ci * THIS STRUCTURE MUST BE A MULTIPLE 16-BYTE IN SIZE
7362306a36Sopenharmony_ci * (because the memory stack pointer MUST ALWAYS be aligned this way)
7462306a36Sopenharmony_ci *
7562306a36Sopenharmony_ci */
7662306a36Sopenharmony_cistruct pt_regs {
7762306a36Sopenharmony_ci	/* The following registers are saved by SAVE_MIN: */
7862306a36Sopenharmony_ci	unsigned long b6;		/* scratch */
7962306a36Sopenharmony_ci	unsigned long b7;		/* scratch */
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci	unsigned long ar_csd;           /* used by cmp8xchg16 (scratch) */
8262306a36Sopenharmony_ci	unsigned long ar_ssd;           /* reserved for future use (scratch) */
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci	unsigned long r8;		/* scratch (return value register 0) */
8562306a36Sopenharmony_ci	unsigned long r9;		/* scratch (return value register 1) */
8662306a36Sopenharmony_ci	unsigned long r10;		/* scratch (return value register 2) */
8762306a36Sopenharmony_ci	unsigned long r11;		/* scratch (return value register 3) */
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci	unsigned long cr_ipsr;		/* interrupted task's psr */
9062306a36Sopenharmony_ci	unsigned long cr_iip;		/* interrupted task's instruction pointer */
9162306a36Sopenharmony_ci	/*
9262306a36Sopenharmony_ci	 * interrupted task's function state; if bit 63 is cleared, it
9362306a36Sopenharmony_ci	 * contains syscall's ar.pfs.pfm:
9462306a36Sopenharmony_ci	 */
9562306a36Sopenharmony_ci	unsigned long cr_ifs;
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci	unsigned long ar_unat;		/* interrupted task's NaT register (preserved) */
9862306a36Sopenharmony_ci	unsigned long ar_pfs;		/* prev function state  */
9962306a36Sopenharmony_ci	unsigned long ar_rsc;		/* RSE configuration */
10062306a36Sopenharmony_ci	/* The following two are valid only if cr_ipsr.cpl > 0 || ti->flags & _TIF_MCA_INIT */
10162306a36Sopenharmony_ci	unsigned long ar_rnat;		/* RSE NaT */
10262306a36Sopenharmony_ci	unsigned long ar_bspstore;	/* RSE bspstore */
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci	unsigned long pr;		/* 64 predicate registers (1 bit each) */
10562306a36Sopenharmony_ci	unsigned long b0;		/* return pointer (bp) */
10662306a36Sopenharmony_ci	unsigned long loadrs;		/* size of dirty partition << 16 */
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci	unsigned long r1;		/* the gp pointer */
10962306a36Sopenharmony_ci	unsigned long r12;		/* interrupted task's memory stack pointer */
11062306a36Sopenharmony_ci	unsigned long r13;		/* thread pointer */
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci	unsigned long ar_fpsr;		/* floating point status (preserved) */
11362306a36Sopenharmony_ci	unsigned long r15;		/* scratch */
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci	/* The remaining registers are NOT saved for system calls.  */
11662306a36Sopenharmony_ci
11762306a36Sopenharmony_ci	unsigned long r14;		/* scratch */
11862306a36Sopenharmony_ci	unsigned long r2;		/* scratch */
11962306a36Sopenharmony_ci	unsigned long r3;		/* scratch */
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci	/* The following registers are saved by SAVE_REST: */
12262306a36Sopenharmony_ci	unsigned long r16;		/* scratch */
12362306a36Sopenharmony_ci	unsigned long r17;		/* scratch */
12462306a36Sopenharmony_ci	unsigned long r18;		/* scratch */
12562306a36Sopenharmony_ci	unsigned long r19;		/* scratch */
12662306a36Sopenharmony_ci	unsigned long r20;		/* scratch */
12762306a36Sopenharmony_ci	unsigned long r21;		/* scratch */
12862306a36Sopenharmony_ci	unsigned long r22;		/* scratch */
12962306a36Sopenharmony_ci	unsigned long r23;		/* scratch */
13062306a36Sopenharmony_ci	unsigned long r24;		/* scratch */
13162306a36Sopenharmony_ci	unsigned long r25;		/* scratch */
13262306a36Sopenharmony_ci	unsigned long r26;		/* scratch */
13362306a36Sopenharmony_ci	unsigned long r27;		/* scratch */
13462306a36Sopenharmony_ci	unsigned long r28;		/* scratch */
13562306a36Sopenharmony_ci	unsigned long r29;		/* scratch */
13662306a36Sopenharmony_ci	unsigned long r30;		/* scratch */
13762306a36Sopenharmony_ci	unsigned long r31;		/* scratch */
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci	unsigned long ar_ccv;		/* compare/exchange value (scratch) */
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci	/*
14262306a36Sopenharmony_ci	 * Floating point registers that the kernel considers scratch:
14362306a36Sopenharmony_ci	 */
14462306a36Sopenharmony_ci	struct ia64_fpreg f6;		/* scratch */
14562306a36Sopenharmony_ci	struct ia64_fpreg f7;		/* scratch */
14662306a36Sopenharmony_ci	struct ia64_fpreg f8;		/* scratch */
14762306a36Sopenharmony_ci	struct ia64_fpreg f9;		/* scratch */
14862306a36Sopenharmony_ci	struct ia64_fpreg f10;		/* scratch */
14962306a36Sopenharmony_ci	struct ia64_fpreg f11;		/* scratch */
15062306a36Sopenharmony_ci};
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci/*
15362306a36Sopenharmony_ci * This structure contains the addition registers that need to
15462306a36Sopenharmony_ci * preserved across a context switch.  This generally consists of
15562306a36Sopenharmony_ci * "preserved" registers.
15662306a36Sopenharmony_ci */
15762306a36Sopenharmony_cistruct switch_stack {
15862306a36Sopenharmony_ci	unsigned long caller_unat;	/* user NaT collection register (preserved) */
15962306a36Sopenharmony_ci	unsigned long ar_fpsr;		/* floating-point status register */
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci	struct ia64_fpreg f2;		/* preserved */
16262306a36Sopenharmony_ci	struct ia64_fpreg f3;		/* preserved */
16362306a36Sopenharmony_ci	struct ia64_fpreg f4;		/* preserved */
16462306a36Sopenharmony_ci	struct ia64_fpreg f5;		/* preserved */
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci	struct ia64_fpreg f12;		/* scratch, but untouched by kernel */
16762306a36Sopenharmony_ci	struct ia64_fpreg f13;		/* scratch, but untouched by kernel */
16862306a36Sopenharmony_ci	struct ia64_fpreg f14;		/* scratch, but untouched by kernel */
16962306a36Sopenharmony_ci	struct ia64_fpreg f15;		/* scratch, but untouched by kernel */
17062306a36Sopenharmony_ci	struct ia64_fpreg f16;		/* preserved */
17162306a36Sopenharmony_ci	struct ia64_fpreg f17;		/* preserved */
17262306a36Sopenharmony_ci	struct ia64_fpreg f18;		/* preserved */
17362306a36Sopenharmony_ci	struct ia64_fpreg f19;		/* preserved */
17462306a36Sopenharmony_ci	struct ia64_fpreg f20;		/* preserved */
17562306a36Sopenharmony_ci	struct ia64_fpreg f21;		/* preserved */
17662306a36Sopenharmony_ci	struct ia64_fpreg f22;		/* preserved */
17762306a36Sopenharmony_ci	struct ia64_fpreg f23;		/* preserved */
17862306a36Sopenharmony_ci	struct ia64_fpreg f24;		/* preserved */
17962306a36Sopenharmony_ci	struct ia64_fpreg f25;		/* preserved */
18062306a36Sopenharmony_ci	struct ia64_fpreg f26;		/* preserved */
18162306a36Sopenharmony_ci	struct ia64_fpreg f27;		/* preserved */
18262306a36Sopenharmony_ci	struct ia64_fpreg f28;		/* preserved */
18362306a36Sopenharmony_ci	struct ia64_fpreg f29;		/* preserved */
18462306a36Sopenharmony_ci	struct ia64_fpreg f30;		/* preserved */
18562306a36Sopenharmony_ci	struct ia64_fpreg f31;		/* preserved */
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci	unsigned long r4;		/* preserved */
18862306a36Sopenharmony_ci	unsigned long r5;		/* preserved */
18962306a36Sopenharmony_ci	unsigned long r6;		/* preserved */
19062306a36Sopenharmony_ci	unsigned long r7;		/* preserved */
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci	unsigned long b0;		/* so we can force a direct return in copy_thread */
19362306a36Sopenharmony_ci	unsigned long b1;
19462306a36Sopenharmony_ci	unsigned long b2;
19562306a36Sopenharmony_ci	unsigned long b3;
19662306a36Sopenharmony_ci	unsigned long b4;
19762306a36Sopenharmony_ci	unsigned long b5;
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci	unsigned long ar_pfs;		/* previous function state */
20062306a36Sopenharmony_ci	unsigned long ar_lc;		/* loop counter (preserved) */
20162306a36Sopenharmony_ci	unsigned long ar_unat;		/* NaT bits for r4-r7 */
20262306a36Sopenharmony_ci	unsigned long ar_rnat;		/* RSE NaT collection register */
20362306a36Sopenharmony_ci	unsigned long ar_bspstore;	/* RSE dirty base (preserved) */
20462306a36Sopenharmony_ci	unsigned long pr;		/* 64 predicate registers (1 bit each) */
20562306a36Sopenharmony_ci};
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci/* pt_all_user_regs is used for PTRACE_GETREGS PTRACE_SETREGS */
20962306a36Sopenharmony_cistruct pt_all_user_regs {
21062306a36Sopenharmony_ci	unsigned long nat;
21162306a36Sopenharmony_ci	unsigned long cr_iip;
21262306a36Sopenharmony_ci	unsigned long cfm;
21362306a36Sopenharmony_ci	unsigned long cr_ipsr;
21462306a36Sopenharmony_ci	unsigned long pr;
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci	unsigned long gr[32];
21762306a36Sopenharmony_ci	unsigned long br[8];
21862306a36Sopenharmony_ci	unsigned long ar[128];
21962306a36Sopenharmony_ci	struct ia64_fpreg fr[128];
22062306a36Sopenharmony_ci};
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci#endif /* !__ASSEMBLY__ */
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ci/* indices to application-registers array in pt_all_user_regs */
22562306a36Sopenharmony_ci#define PT_AUR_RSC	16
22662306a36Sopenharmony_ci#define PT_AUR_BSP	17
22762306a36Sopenharmony_ci#define PT_AUR_BSPSTORE	18
22862306a36Sopenharmony_ci#define PT_AUR_RNAT	19
22962306a36Sopenharmony_ci#define PT_AUR_CCV	32
23062306a36Sopenharmony_ci#define PT_AUR_UNAT	36
23162306a36Sopenharmony_ci#define PT_AUR_FPSR	40
23262306a36Sopenharmony_ci#define PT_AUR_PFS	64
23362306a36Sopenharmony_ci#define PT_AUR_LC	65
23462306a36Sopenharmony_ci#define PT_AUR_EC	66
23562306a36Sopenharmony_ci
23662306a36Sopenharmony_ci/*
23762306a36Sopenharmony_ci * The numbers chosen here are somewhat arbitrary but absolutely MUST
23862306a36Sopenharmony_ci * not overlap with any of the number assigned in <linux/ptrace.h>.
23962306a36Sopenharmony_ci */
24062306a36Sopenharmony_ci#define PTRACE_SINGLEBLOCK	12	/* resume execution until next branch */
24162306a36Sopenharmony_ci#define PTRACE_OLD_GETSIGINFO	13	/* (replaced by PTRACE_GETSIGINFO in <linux/ptrace.h>)  */
24262306a36Sopenharmony_ci#define PTRACE_OLD_SETSIGINFO	14	/* (replaced by PTRACE_SETSIGINFO in <linux/ptrace.h>)  */
24362306a36Sopenharmony_ci#define PTRACE_GETREGS		18	/* get all registers (pt_all_user_regs) in one shot */
24462306a36Sopenharmony_ci#define PTRACE_SETREGS		19	/* set all registers (pt_all_user_regs) in one shot */
24562306a36Sopenharmony_ci
24662306a36Sopenharmony_ci#define PTRACE_OLDSETOPTIONS	21
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ci#endif /* _UAPI_ASM_IA64_PTRACE_H */
249