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