Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / powerpc / include / frame.h
blob2143c0815edf8012318771da8c7d7b4bb46008be
1 /* $NetBSD: frame.h,v 1.20 2008/10/16 04:02:32 wrstuden Exp $ */
3 /*
4 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5 * Copyright (C) 1995, 1996 TooLs GmbH.
6 * All rights reserved.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by TooLs GmbH.
19 * 4. The name of TooLs GmbH may not be used to endorse or promote products
20 * derived from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #ifndef _POWERPC_FRAME_H_
34 #define _POWERPC_FRAME_H_
36 #include <machine/types.h>
39 * We have to save all registers on every trap, because
40 * 1. user could attach this process every time
41 * 2. we must be able to restore all user registers in case of fork
42 * Actually, we do not save the fp registers on trap, since
43 * these are not used by the kernel. They are saved only when switching
44 * between processes using the FPU.
46 * Change ordering to cluster together these register_t's. XXX
48 struct utrapframe {
49 register_t fixreg[32];
50 register_t lr;
51 int cr;
52 int xer;
53 register_t ctr;
54 register_t srr0;
55 register_t srr1;
56 int vrsave;
57 int mq;
58 int spare;
61 struct trapframe {
62 register_t fixreg[32];
63 register_t lr;
64 int cr;
65 int xer;
66 register_t ctr;
67 register_t srr0;
68 register_t srr1;
70 * DAR is the OEA name. On IBM4xx is DAR is really DEAR.
72 register_t dar; /* dar & dsisr are only filled on a DSI trap */
73 int dsisr;
74 int exc;
75 int tf_xtra[2];
77 #define TF_VRSAVE 0
78 #define TF_MQ 1
79 #define TF_ESR 0
80 #define TF_PID 1
82 #if defined(_KERNEL) || defined(_LKM)
83 #ifdef _LP64
84 struct utrapframe32 {
85 register32_t fixreg[32];
86 register32_t lr;
87 int cr;
88 int xer;
89 register32_t ctr;
90 register32_t srr0;
91 register32_t srr1;
92 int vrsave;
93 int mq;
94 int spare;
96 #endif
97 #endif /* _KERNEL || _LKM */
100 * This is to ensure alignment of the stackpointer
102 #define FRAMELEN roundup(sizeof(struct trapframe) + 2*sizeof(register_t), CALLFRAMELEN)
103 #define trapframe(l) ((struct trapframe *)(uvm_lwp_getuarea(l) + USPACE - FRAMELEN + 2*sizeof(register_t)))
105 #define SFRAMELEN roundup(sizeof(struct switchframe), CALLFRAMELEN)
106 struct switchframe {
107 register_t sp;
108 register_t lr;
109 register_t user_sr; /* VSID on IBM4XX */
110 register_t cr; /* why? CR is volatile. */
111 register_t fixreg2;
112 register_t fixreg[19]; /* R13-R31 */
115 struct clockframe {
116 register_t srr1;
117 register_t srr0;
118 int pri;
119 int depth;
123 * Call frame for PowerPC used during fork.
125 #define CALLFRAMELEN sizeof(struct callframe)
126 struct callframe {
127 register_t sp;
128 register_t lr;
129 register_t r30;
130 register_t r31;
133 struct saframe {
134 register_t r1; /* stack pointer */
135 register_t lr; /* Callee lr save area */
136 register_t fill[2]; /* Pad to multiple of 16 bytes */
139 #define IFRAMELEN roundup(sizeof(struct intrframe), CALLFRAMELEN)
140 struct intrframe {
141 register_t r1; /* 0 */
142 register_t _pad4; /* 4 */
144 * The next 4 fields are "clockframe"
146 register_t srr1; /* 8 */
147 register_t srr0; /* 12 */
148 int pri; /* 16 */
149 int intrdepth; /* 20 */
150 register_t pid; /* 24 */
151 register_t ctr; /* 28 */
152 register_t xer; /* 32 */
153 register_t cr; /* 36 */
154 register_t lr; /* 40 */
155 register_t r12; /* 44 */
156 register_t r11; /* 48 */
157 register_t r10; /* 52 */
158 register_t r9; /* 56 */
159 register_t r8; /* 60 */
160 register_t r7; /* 64 */
161 register_t r6; /* 68 */
162 register_t r5; /* 72 */
163 register_t r4; /* 76 */
164 register_t r3; /* 80 */
165 register_t r0; /* 84 */
168 #endif /* _POWERPC_FRAME_H_ */