ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-ppc / ptrace.h
1 #ifndef _PPC_PTRACE_H
2 #define _PPC_PTRACE_H
3
4 /*
5  * This struct defines the way the registers are stored on the
6  * kernel stack during a system call or other kernel entry.
7  *
8  * this should only contain volatile regs
9  * since we can keep non-volatile in the thread_struct
10  * should set this up when only volatiles are saved
11  * by intr code.
12  *
13  * Since this is going on the stack, *CARE MUST BE TAKEN* to insure
14  * that the overall structure is a multiple of 16 bytes in length.
15  *
16  * Note that the offsets of the fields in this struct correspond with
17  * the PT_* values below.  This simplifies arch/ppc/kernel/ptrace.c.
18  */
19
20 #ifndef __ASSEMBLY__
21 struct pt_regs {
22         unsigned long gpr[32];
23         unsigned long nip;
24         unsigned long msr;
25         unsigned long orig_gpr3;        /* Used for restarting system calls */
26         unsigned long ctr;
27         unsigned long link;
28         unsigned long xer;
29         unsigned long ccr;
30         unsigned long mq;               /* 601 only (not used at present) */
31                                         /* Used on APUS to hold IPL value. */
32         unsigned long trap;             /* Reason for being here */
33         /* N.B. for critical exceptions on 4xx, the dar and dsisr
34            fields are overloaded to hold srr0 and srr1. */
35         unsigned long dar;              /* Fault registers */
36         unsigned long dsisr;            /* on 4xx/Book-E used for ESR */
37         unsigned long result;           /* Result of a system call */
38 };
39
40 #endif /* __ASSEMBLY__ */
41
42 #ifdef __KERNEL__
43 #define STACK_FRAME_OVERHEAD    16      /* size of minimum stack frame */
44
45 /* Size of stack frame allocated when calling signal handler. */
46 #define __SIGNAL_FRAMESIZE      64
47
48 #ifndef __ASSEMBLY__
49 #define instruction_pointer(regs) ((regs)->nip)
50 #define user_mode(regs) (((regs)->msr & MSR_PR) != 0)
51
52 #define force_successful_syscall_return()   \
53         do { \
54                 current_thread_info()->local_flags |= _TIFL_FORCE_NOERROR; \
55         } while(0)
56
57 /*
58  * We use the least-significant bit of the trap field to indicate
59  * whether we have saved the full set of registers, or only a
60  * partial set.  A 1 there means the partial set.
61  * On 4xx we use the next bit to indicate whether the exception
62  * is a critical exception (1 means it is).
63  */
64 #define FULL_REGS(regs)         (((regs)->trap & 1) == 0)
65 #define IS_CRITICAL_EXC(regs)   (((regs)->trap & 2) == 0)
66 #define TRAP(regs)              ((regs)->trap & ~0xF)
67
68 #define CHECK_FULL_REGS(regs)                                                 \
69 do {                                                                          \
70         if ((regs)->trap & 1)                                                 \
71                 printk(KERN_CRIT "%s: partial register set\n", __FUNCTION__); \
72 } while (0)
73 #endif /* __ASSEMBLY__ */
74
75 #endif /* __KERNEL__ */
76
77 /*
78  * Offsets used by 'ptrace' system call interface.
79  * These can't be changed without breaking binary compatibility
80  * with MkLinux, etc.
81  */
82 #define PT_R0   0
83 #define PT_R1   1
84 #define PT_R2   2
85 #define PT_R3   3
86 #define PT_R4   4
87 #define PT_R5   5
88 #define PT_R6   6
89 #define PT_R7   7
90 #define PT_R8   8
91 #define PT_R9   9
92 #define PT_R10  10
93 #define PT_R11  11
94 #define PT_R12  12
95 #define PT_R13  13
96 #define PT_R14  14
97 #define PT_R15  15
98 #define PT_R16  16
99 #define PT_R17  17
100 #define PT_R18  18
101 #define PT_R19  19
102 #define PT_R20  20
103 #define PT_R21  21
104 #define PT_R22  22
105 #define PT_R23  23
106 #define PT_R24  24
107 #define PT_R25  25
108 #define PT_R26  26
109 #define PT_R27  27
110 #define PT_R28  28
111 #define PT_R29  29
112 #define PT_R30  30
113 #define PT_R31  31
114
115 #define PT_NIP  32
116 #define PT_MSR  33
117 #ifdef __KERNEL__
118 #define PT_ORIG_R3 34
119 #endif
120 #define PT_CTR  35
121 #define PT_LNK  36
122 #define PT_XER  37
123 #define PT_CCR  38
124 #define PT_MQ   39
125
126 #define PT_FPR0 48      /* each FP reg occupies 2 slots in this space */
127 #define PT_FPR31 (PT_FPR0 + 2*31)
128 #define PT_FPSCR (PT_FPR0 + 2*32 + 1)
129
130 /* Get/set all the altivec registers vr0..vr31, vscr, vrsave, in one go */
131 #define PTRACE_GETVRREGS        18
132 #define PTRACE_SETVRREGS        19
133
134 #endif