No empty .Rs/.Re
[netbsd-mini2440.git] / sys / arch / sparc64 / include / reg.h
blob1fa1c6142b4df2413e4208a1f79433fba97e0396
1 /* $NetBSD: reg.h,v 1.10.8.3 2004/09/21 13:22:56 skrll Exp $ */
3 /*
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
7 * This software was developed by the Computer Systems Engineering group
8 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9 * contributed to Berkeley.
11 * All advertising materials mentioning features or use of this software
12 * must display the following acknowledgement:
13 * This product includes software developed by the University of
14 * California, Lawrence Berkeley Laboratory.
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 * 3. Neither the name of the University nor the names of its contributors
25 * may be used to endorse or promote products derived from this software
26 * without specific prior written permission.
28 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 * SUCH DAMAGE.
40 * @(#)reg.h 8.1 (Berkeley) 6/11/93
44 * Copyright (c) 1996-2002 Eduardo Horvath.
46 * Redistribution and use in source and binary forms, with or without
47 * modification, are permitted provided that the following conditions
48 * are met:
49 * 1. Redistributions of source code must retain the above copyright
50 * notice, this list of conditions and the following disclaimer.
51 * 2. Redistributions in binary form must reproduce the above copyright
52 * notice, this list of conditions and the following disclaimer in the
53 * documentation and/or other materials provided with the distribution.
54 * 3. Neither the name of the author nor the names of its contributors
55 * may be used to endorse or promote products derived from this software
56 * without specific prior written permission.
58 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
59 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
62 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
63 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
64 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 * SUCH DAMAGE.
70 * @(#)reg.h 8.1 (Berkeley) 6/11/93
73 #ifndef _MACHINE_REG_H_
74 #define _MACHINE_REG_H_
77 * Registers passed to trap/syscall/etc.
78 * This structure is known to occupy exactly 80 bytes (see locore.s).
79 * Note, tf_global[0] is not actually written (since g0 is always 0).
80 * (The slot tf_global[0] is used to send a copy of %wim to kernel gdb.
81 * This is known as `cheating'.)
83 struct trapframe32 {
84 int tf_psr; /* psr */
85 int tf_pc; /* return pc */
86 int tf_npc; /* return npc */
87 int tf_y; /* %y register */
88 int tf_global[8]; /* global registers in trap's caller */
89 int tf_out[8]; /* output registers in trap's caller */
93 * The v9 trapframe is a bit more complex. Since we don't get a free
94 * register window with each trap we need some way to keep track of
95 * pending traps.
96 * (The slot tf_global[0] is used to store the %fp when this is used
97 * as a clockframe. This is known as `cheating'.)
100 struct trapframe64 {
101 int64_t tf_tstate; /* tstate register */
102 int64_t tf_pc; /* return pc */
103 int64_t tf_npc; /* return npc */
104 int64_t tf_fault; /* faulting addr -- need somewhere to save it */
105 int64_t tf_kstack; /* kernel stack of prev tf */
106 int tf_y; /* %y register -- 32-bits */
107 short tf_tt; /* What type of trap this was */
108 char tf_pil; /* What IRQ we're handling */
109 char tf_oldpil; /* What our old SPL was */
110 int64_t tf_global[8]; /* global registers in trap's caller */
111 /* n.b. tf_global[0] is used for fp when this is a clockframe */
112 int64_t tf_out[8]; /* output registers in trap's caller */
113 int64_t tf_local[8]; /* local registers in trap's caller (for debug) */
114 int64_t tf_in[8]; /* in registers in trap's caller (for debug) */
119 * Register windows. Each stack pointer (%o6 aka %sp) in each window
120 * must ALWAYS point to some place at which it is safe to scribble on
121 * 64 bytes. (If not, your process gets mangled.) Furthermore, each
122 * stack pointer should be aligned on an 8-byte boundary for v8 stacks
123 * or a 16-byte boundary (plus the BIAS) for v9 stacks (the kernel
124 * as currently coded allows arbitrary alignment, but with a hefty
125 * performance penalty).
127 struct rwindow32 {
128 int rw_local[8]; /* %l0..%l7 */
129 int rw_in[8]; /* %i0..%i7 */
132 /* Don't forget the BIAS!! */
133 struct rwindow64 {
134 int64_t rw_local[8]; /* %l0..%l7 */
135 int64_t rw_in[8]; /* %i0..%i7 */
139 * Clone trapframe for now; this seems to be the more useful
140 * than the old struct reg above.
142 struct reg32 {
143 int r_psr; /* psr */
144 int r_pc; /* return pc */
145 int r_npc; /* return npc */
146 int r_y; /* %y register */
147 int r_global[8]; /* global registers in trap's caller */
148 int r_out[8]; /* output registers in trap's caller */
151 struct reg64 {
152 int64_t r_tstate; /* tstate register */
153 int64_t r_pc; /* return pc */
154 int64_t r_npc; /* return npc */
155 int r_y; /* %y register -- 32-bits */
156 int64_t r_global[8]; /* global registers in trap's caller */
157 int64_t r_out[8]; /* output registers in trap's caller */
160 #include <machine/fsr.h>
163 * FP coprocessor registers.
165 * FP_QSIZE is the maximum coprocessor instruction queue depth
166 * of any implementation on which the kernel will run. David Hough:
167 * ``I'd suggest allowing 16 ... allowing an indeterminate variable
168 * size would be even better''. Of course, we cannot do that; we
169 * need to malloc these.
171 * XXXX UltraSPARC processors don't implement a floating point queue.
173 #define FP_QSIZE 16
174 #define ALIGNFPSTATE(f) ((struct fpstate64 *)(((long)(f))&(~BLOCK_ALIGN)))
176 struct fp_qentry {
177 int *fq_addr; /* the instruction's address */
178 int fq_instr; /* the instruction itself */
181 struct fpstate64 {
182 u_int fs_regs[64]; /* our view is 64 32-bit registers */
183 int64_t fs_fsr; /* %fsr */
184 int fs_gsr; /* graphics state reg */
185 int fs_qsize; /* actual queue depth */
186 struct fp_qentry fs_queue[FP_QSIZE]; /* queue contents */
190 * For 32-bit emulations.
192 struct fpstate32 {
193 u_int fs_regs[32]; /* our view is 32 32-bit registers */
194 int fs_fsr; /* %fsr */
195 int fs_qsize; /* actual queue depth */
196 struct fp_qentry fs_queue[FP_QSIZE]; /* queue contents */
200 * The actual FP registers are made accessible (c.f. ptrace(2)) through
201 * a `struct fpreg'; <arch/sparc64/sparc64/process_machdep.c> relies on the
202 * fact that `fpreg' is a prefix of `fpstate'.
204 struct fpreg64 {
205 u_int fr_regs[64]; /* our view is 64 32-bit registers */
206 int64_t fr_fsr; /* %fsr */
207 int fr_gsr; /* graphics state reg */
211 * 32-bit fpreg used by 32-bit sparc CPUs
213 struct fpreg32 {
214 u_int fr_regs[32]; /* our view is 32 32-bit registers */
215 int fr_fsr; /* %fsr */
218 #if defined(__arch64__)
219 /* Here we gotta do naughty things to let gdb work on 32-bit binaries */
220 #define reg reg64
221 #define fpreg fpreg64
222 #define fpstate fpstate64
223 #define trapframe trapframe64
224 #define rwindow rwindow64
225 #else
226 #define reg reg32
227 #define fpreg fpreg32
228 #define fpstate fpstate32
229 #define trapframe trapframe32
230 #define rwindow rwindow32
231 #endif
233 #endif /* _MACHINE_REG_H_ */