blob: 33cfbacb0c65f8404095fb9bfc50f57c5594ba21 [file] [log] [blame]
Daniel Hellstromc2f02da2008-03-28 09:47:00 +01001/* Contain the Stack frame layout on interrupt. pt_regs.
2 * taken from the SPARC port of Linux (ptrace.h).
3 *
4 * (C) Copyright 2007
5 * Daniel Hellstrom, Gaisler Research, daniel@gaisler.com.
6 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02007 * SPDX-License-Identifier: GPL-2.0+
Daniel Hellstromc2f02da2008-03-28 09:47:00 +01008 */
9
10#ifndef __SPARC_PTRACE_H__
11#define __SPARC_PTRACE_H__
12
13#include <asm/psr.h>
14
15/* This struct defines the way the registers are stored on the
16 * stack during a system call and basically all traps.
17 */
18
19#ifndef __ASSEMBLY__
20
21struct pt_regs {
22 unsigned long psr;
23 unsigned long pc;
24 unsigned long npc;
25 unsigned long y;
26 unsigned long u_regs[16]; /* globals and ins */
27};
28
29#define UREG_G0 0
30#define UREG_G1 1
31#define UREG_G2 2
32#define UREG_G3 3
33#define UREG_G4 4
34#define UREG_G5 5
35#define UREG_G6 6
36#define UREG_G7 7
37#define UREG_I0 8
38#define UREG_I1 9
39#define UREG_I2 10
40#define UREG_I3 11
41#define UREG_I4 12
42#define UREG_I5 13
43#define UREG_I6 14
44#define UREG_I7 15
45#define UREG_WIM UREG_G0
46#define UREG_FADDR UREG_G0
47#define UREG_FP UREG_I6
48#define UREG_RETPC UREG_I7
49
50/* A register window */
51struct reg_window {
52 unsigned long locals[8];
53 unsigned long ins[8];
54};
55
56/* A Sparc stack frame */
57struct sparc_stackf {
58 unsigned long locals[8];
59 unsigned long ins[6];
60 struct sparc_stackf *fp;
61 unsigned long callers_pc;
62 char *structptr;
63 unsigned long xargs[6];
64 unsigned long xxargs[1];
65};
66
67#define TRACEREG_SZ sizeof(struct pt_regs)
68#define STACKFRAME_SZ sizeof(struct sparc_stackf)
69
70#else /* __ASSEMBLY__ */
71/* For assembly code. */
72#define TRACEREG_SZ 0x50
73#define STACKFRAME_SZ 0x60
74#endif
75
76/*
77 * The asm_offsets.h is a generated file, so we cannot include it.
78 * It may be OK for glibc headers, but it's utterly pointless for C code.
79 * The assembly code using those offsets has to include it explicitly.
80 */
81/* #include <asm/asm_offsets.h> */
82
83/* These are for pt_regs. */
84#define PT_PSR 0x0
85#define PT_PC 0x4
86#define PT_NPC 0x8
87#define PT_Y 0xc
88#define PT_G0 0x10
89#define PT_WIM PT_G0
90#define PT_G1 0x14
91#define PT_G2 0x18
92#define PT_G3 0x1c
93#define PT_G4 0x20
94#define PT_G5 0x24
95#define PT_G6 0x28
96#define PT_G7 0x2c
97#define PT_I0 0x30
98#define PT_I1 0x34
99#define PT_I2 0x38
100#define PT_I3 0x3c
101#define PT_I4 0x40
102#define PT_I5 0x44
103#define PT_I6 0x48
104#define PT_FP PT_I6
105#define PT_I7 0x4c
106
107/* Reg_window offsets */
108#define RW_L0 0x00
109#define RW_L1 0x04
110#define RW_L2 0x08
111#define RW_L3 0x0c
112#define RW_L4 0x10
113#define RW_L5 0x14
114#define RW_L6 0x18
115#define RW_L7 0x1c
116#define RW_I0 0x20
117#define RW_I1 0x24
118#define RW_I2 0x28
119#define RW_I3 0x2c
120#define RW_I4 0x30
121#define RW_I5 0x34
122#define RW_I6 0x38
123#define RW_I7 0x3c
124
125/* Stack_frame offsets */
126#define SF_L0 0x00
127#define SF_L1 0x04
128#define SF_L2 0x08
129#define SF_L3 0x0c
130#define SF_L4 0x10
131#define SF_L5 0x14
132#define SF_L6 0x18
133#define SF_L7 0x1c
134#define SF_I0 0x20
135#define SF_I1 0x24
136#define SF_I2 0x28
137#define SF_I3 0x2c
138#define SF_I4 0x30
139#define SF_I5 0x34
140#define SF_FP 0x38
141#define SF_PC 0x3c
142#define SF_RETP 0x40
143#define SF_XARG0 0x44
144#define SF_XARG1 0x48
145#define SF_XARG2 0x4c
146#define SF_XARG3 0x50
147#define SF_XARG4 0x54
148#define SF_XARG5 0x58
149#define SF_XXARG 0x5c
150
151/* Stuff for the ptrace system call */
152#define PTRACE_SUNATTACH 10
153#define PTRACE_SUNDETACH 11
154#define PTRACE_GETREGS 12
155#define PTRACE_SETREGS 13
156#define PTRACE_GETFPREGS 14
157#define PTRACE_SETFPREGS 15
158#define PTRACE_READDATA 16
159#define PTRACE_WRITEDATA 17
160#define PTRACE_READTEXT 18
161#define PTRACE_WRITETEXT 19
162#define PTRACE_GETFPAREGS 20
163#define PTRACE_SETFPAREGS 21
164
165#define PTRACE_GETUCODE 29 /* stupid bsd-ism */
166
167#endif /* !(_SPARC_PTRACE_H) */