1 #ifndef _PPC_PTRACE_H
2 #define _PPC_PTRACE_H
3
4
5 /*
6 * This struct defines the way the registers are stored on the
7 * kernel stack during a system call or other kernel entry.
8 * Note: the "_overhead" and "_underhead" spaces are stack locations
9 * used by called routines. Because of the way the PowerPC ABI
10 * specifies the function prologue/epilogue, registers can be
11 * saved in stack locations which are below the current stack
12 * pointer (_underhead). If an interrupt occurs during this
13 * [albeit] small time interval, registers which were saved on
14 * the stack could be trashed by the interrupt save code. The
15 * "_underhead" leaves a hole just in case this happens. It also
16 * wastes 80 bytes of stack if it doesn't! Similarly, the called
17 * routine stores some information "above" the stack pointer before
18 * if gets adjusted. This is covered by the "_overhead" field
19 * and [thankfully] is not totally wasted.
20 *
21 */
22
23 struct pt_regs {
24 unsigned long _overhead[14]; /* Callee's SP,LR,params */
25 unsigned long gpr[32];
26 unsigned long nip;
27 unsigned long msr;
28 unsigned long ctr;
29 unsigned long link;
30 unsigned long ccr;
31 unsigned long xer;
32 unsigned long dar; /* Fault registers */
33 unsigned long dsisr;
34 unsigned long hash1, hash2;
35 unsigned long imiss, dmiss;
36 unsigned long icmp, dcmp;
37 unsigned long orig_gpr3; /* Used for restarting system calls */
38 unsigned long result; /* Result of a system call */
39 double fpr[4]; /* Caution! Only FP0-FP3 save on interrupts */
40 double fpcsr;
41 unsigned long trap; /* Reason for being here */
42 unsigned long marker; /* Should have DEADDEAD */
43 unsigned long _underhead[20]; /* Callee's register save area */
44 unsigned long edx; /* for binfmt_elf.c which wants edx */
45 };
46
47 #define instruction_pointer(regs) ((regs)->nip)
48 #define user_mode(regs) ((regs)->msr & 0x4000)
49 extern void show_regs(struct pt_regs *);
50
51 #endif
52