regnum.h revision 249790
1/*	$OpenBSD: regnum.h,v 1.3 1999/01/27 04:46:06 imp Exp $	*/
2
3/*-
4 * Copyright (c) 1988 University of Utah.
5 * Copyright (c) 1992, 1993
6 *	The Regents of the University of California.  All rights reserved.
7 *
8 * This code is derived from software contributed to Berkeley by
9 * the Systems Programming Group of the University of Utah Computer
10 * Science Department and Ralph Campbell.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 *    notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 *    notice, this list of conditions and the following disclaimer in the
19 *    documentation and/or other materials provided with the distribution.
20 * 4. Neither the name of the University nor the names of its contributors
21 *    may be used to endorse or promote products derived from this software
22 *    without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 *	from: Utah Hdr: reg.h 1.1 90/07/09
37 *	@(#)reg.h	8.2 (Berkeley) 1/11/94
38 *	JNPR: regnum.h,v 1.6 2007/08/09 11:23:32 katta
39 * $FreeBSD: head/sys/mips/include/regnum.h 249790 2013-04-23 09:38:18Z imp $
40 */
41
42#ifndef _MACHINE_REGNUM_H_
43#define	_MACHINE_REGNUM_H_
44
45/*
46 * This must match the numbers in pcb.h and is used by swtch.S
47 */
48#define PREG_S0	0
49#define PREG_S1	1
50#define PREG_S2	2
51#define PREG_S3	3
52#define PREG_S4	4
53#define PREG_S5	5
54#define PREG_S6	6
55#define PREG_S7	7
56#define PREG_SP	8
57#define PREG_S8	9
58#define PREG_RA	10
59#define PREG_SR	11
60#define PREG_GP	12
61#define PREG_PC	13
62
63/*
64 * Location of the saved registers relative to ZERO.
65 * This must match struct trapframe defined in frame.h exactly.
66 * This must also match regdef.h.
67 */
68#define	ZERO	0
69#define	AST	1
70#define	V0	2
71#define	V1	3
72#define	A0	4
73#define	A1	5
74#define	A2	6
75#define	A3	7
76#if defined(__mips_n32) || defined(__mips_n64)
77#define	A4	8
78#define	A5	9
79#define	A6	10
80#define	A7	11
81#define	T0	12
82#define	T1	13
83#define	T2	14
84#define	T3	15
85#else
86#define	T0	8
87#define	T1	9
88#define	T2	10
89#define	T3	11
90#define	T4	12
91#define	T5	13
92#define	T6	14
93#define	T7	15
94#endif
95#define	S0	16
96#define	S1	17
97#define	S2	18
98#define	S3	19
99#define	S4	20
100#define	S5	21
101#define	S6	22
102#define	S7	23
103#define	T8	24
104#define	T9	25
105#define	K0	26
106#define	K1	27
107#define	GP	28
108#define	SP	29
109#define	S8	30
110#define	RA	31
111#define	SR	32
112#define	PS	SR	/* alias for SR */
113#define	MULLO	33
114#define	MULHI	34
115#define	BADVADDR 35
116#define	CAUSE	36
117#define	PC	37
118/*
119 * IC is valid only on RM7K and RM9K processors. Access to this is
120 * controlled by IC_INT_REG which defined in kernel config
121 */
122#define	IC	38
123#define	DUMMY	39	/* for 8 byte alignment */
124#define	NUMSAVEREGS 40
125
126/*
127 * Pseudo registers so we save a complete set of registers regardless of
128 * the ABI. See regdef.h for a more complete explanation.
129 */
130#if defined(__mips_n32) || defined(__mips_n64)
131#define	TA0	8
132#define	TA1	9
133#define	TA2	10
134#define	TA3	11
135#else
136#define	TA0	12
137#define	TA1	13
138#define	TA2	14
139#define	TA3	15
140#endif
141
142
143/*
144 * Index of FP registers in 'struct frame', counting from the beginning
145 * of the frame (i.e., including the general registers).
146 */
147#define	FPBASE	NUMSAVEREGS
148#define	F0	(FPBASE+0)
149#define	F1	(FPBASE+1)
150#define	F2	(FPBASE+2)
151#define	F3	(FPBASE+3)
152#define	F4	(FPBASE+4)
153#define	F5	(FPBASE+5)
154#define	F6	(FPBASE+6)
155#define	F7	(FPBASE+7)
156#define	F8	(FPBASE+8)
157#define	F9	(FPBASE+9)
158#define	F10	(FPBASE+10)
159#define	F11	(FPBASE+11)
160#define	F12	(FPBASE+12)
161#define	F13	(FPBASE+13)
162#define	F14	(FPBASE+14)
163#define	F15	(FPBASE+15)
164#define	F16	(FPBASE+16)
165#define	F17	(FPBASE+17)
166#define	F18	(FPBASE+18)
167#define	F19	(FPBASE+19)
168#define	F20	(FPBASE+20)
169#define	F21	(FPBASE+21)
170#define	F22	(FPBASE+22)
171#define	F23	(FPBASE+23)
172#define	F24	(FPBASE+24)
173#define	F25	(FPBASE+25)
174#define	F26	(FPBASE+26)
175#define	F27	(FPBASE+27)
176#define	F28	(FPBASE+28)
177#define	F29	(FPBASE+29)
178#define	F30	(FPBASE+30)
179#define	F31	(FPBASE+31)
180#define	FSR	(FPBASE+32)
181#define FSR_DUMMY (FPBASE+33) /* For 8 byte alignment */
182
183#define	NUMFPREGS	34
184
185#define	NREGS	(NUMSAVEREGS + NUMFPREGS)
186
187/*
188 * Index of FP registers in 'struct frame', relative to the base
189 * of the FP registers in frame (i.e., *not* including the general
190 * registers).
191 */
192#define	F0_NUM	(0)
193#define	F1_NUM	(1)
194#define	F2_NUM	(2)
195#define	F3_NUM	(3)
196#define	F4_NUM	(4)
197#define	F5_NUM	(5)
198#define	F6_NUM	(6)
199#define	F7_NUM	(7)
200#define	F8_NUM	(8)
201#define	F9_NUM	(9)
202#define	F10_NUM	(10)
203#define	F11_NUM	(11)
204#define	F12_NUM	(12)
205#define	F13_NUM	(13)
206#define	F14_NUM	(14)
207#define	F15_NUM	(15)
208#define	F16_NUM	(16)
209#define	F17_NUM	(17)
210#define	F18_NUM	(18)
211#define	F19_NUM	(19)
212#define	F20_NUM	(20)
213#define	F21_NUM	(21)
214#define	F22_NUM	(22)
215#define	F23_NUM	(23)
216#define	F24_NUM	(24)
217#define	F25_NUM	(25)
218#define	F26_NUM	(26)
219#define	F27_NUM	(27)
220#define	F28_NUM	(28)
221#define	F29_NUM	(29)
222#define	F30_NUM	(30)
223#define	F31_NUM	(31)
224#define	FSR_NUM	(32)
225
226#endif /* !_MACHINE_REGNUM_H_ */
227