xref: /netbsd/sys/arch/alpha/include/mcontext.h (revision 23bc2503)
1*23bc2503Sthorpej /*	$NetBSD: mcontext.h,v 1.2 2003/01/17 22:11:16 thorpej Exp $	*/
2*23bc2503Sthorpej 
3*23bc2503Sthorpej /*-
4*23bc2503Sthorpej  * Copyright (c) 2001 The NetBSD Foundation, Inc.
5*23bc2503Sthorpej  * All rights reserved.
6*23bc2503Sthorpej  *
7*23bc2503Sthorpej  * This code is derived from software contributed to The NetBSD Foundation
8*23bc2503Sthorpej  * by Klaus Klein.
9*23bc2503Sthorpej  *
10*23bc2503Sthorpej  * Redistribution and use in source and binary forms, with or without
11*23bc2503Sthorpej  * modification, are permitted provided that the following conditions
12*23bc2503Sthorpej  * are met:
13*23bc2503Sthorpej  * 1. Redistributions of source code must retain the above copyright
14*23bc2503Sthorpej  *    notice, this list of conditions and the following disclaimer.
15*23bc2503Sthorpej  * 2. Redistributions in binary form must reproduce the above copyright
16*23bc2503Sthorpej  *    notice, this list of conditions and the following disclaimer in the
17*23bc2503Sthorpej  *    documentation and/or other materials provided with the distribution.
18*23bc2503Sthorpej  * 3. All advertising materials mentioning features or use of this software
19*23bc2503Sthorpej  *    must display the following acknowledgement:
20*23bc2503Sthorpej  *        This product includes software developed by the NetBSD
21*23bc2503Sthorpej  *        Foundation, Inc. and its contributors.
22*23bc2503Sthorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
23*23bc2503Sthorpej  *    contributors may be used to endorse or promote products derived
24*23bc2503Sthorpej  *    from this software without specific prior written permission.
25*23bc2503Sthorpej  *
26*23bc2503Sthorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27*23bc2503Sthorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28*23bc2503Sthorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29*23bc2503Sthorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30*23bc2503Sthorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31*23bc2503Sthorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32*23bc2503Sthorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33*23bc2503Sthorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34*23bc2503Sthorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35*23bc2503Sthorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36*23bc2503Sthorpej  * POSSIBILITY OF SUCH DAMAGE.
37*23bc2503Sthorpej  */
38*23bc2503Sthorpej 
39*23bc2503Sthorpej #ifndef _ALPHA_MCONTEXT_H_
40*23bc2503Sthorpej #define _ALPHA_MCONTEXT_H_
41*23bc2503Sthorpej 
42*23bc2503Sthorpej /*
43*23bc2503Sthorpej  * General register state (important: 0-31 maps to `struct reg')
44*23bc2503Sthorpej  */
45*23bc2503Sthorpej #define _NGREG		34	/* 0-31, PC, PS */
46*23bc2503Sthorpej typedef	unsigned long	__greg_t;
47*23bc2503Sthorpej typedef	__greg_t	__gregset_t[_NGREG];
48*23bc2503Sthorpej 
49*23bc2503Sthorpej /* Convenience synonyms */
50*23bc2503Sthorpej #define	_REG_V0		0
51*23bc2503Sthorpej #define	_REG_T0		1
52*23bc2503Sthorpej #define	_REG_T1		2
53*23bc2503Sthorpej #define	_REG_T2		3
54*23bc2503Sthorpej #define	_REG_T3		4
55*23bc2503Sthorpej #define	_REG_T4		5
56*23bc2503Sthorpej #define	_REG_T5		6
57*23bc2503Sthorpej #define	_REG_T6		7
58*23bc2503Sthorpej #define	_REG_T7		8
59*23bc2503Sthorpej #define	_REG_S0		9
60*23bc2503Sthorpej #define	_REG_S1		10
61*23bc2503Sthorpej #define	_REG_S2		11
62*23bc2503Sthorpej #define	_REG_S3		12
63*23bc2503Sthorpej #define	_REG_S4		13
64*23bc2503Sthorpej #define	_REG_S5		14
65*23bc2503Sthorpej #define	_REG_S6		15
66*23bc2503Sthorpej #define	_REG_A0		16
67*23bc2503Sthorpej #define	_REG_A1		17
68*23bc2503Sthorpej #define	_REG_A2		18
69*23bc2503Sthorpej #define	_REG_A3		19
70*23bc2503Sthorpej #define	_REG_A4		20
71*23bc2503Sthorpej #define	_REG_A5		21
72*23bc2503Sthorpej #define	_REG_T8		22
73*23bc2503Sthorpej #define	_REG_T9		23
74*23bc2503Sthorpej #define	_REG_T10	24
75*23bc2503Sthorpej #define	_REG_T11	25
76*23bc2503Sthorpej #define	_REG_RA		26
77*23bc2503Sthorpej #define	_REG_T12	27
78*23bc2503Sthorpej #define	_REG_PV		27
79*23bc2503Sthorpej #define	_REG_AT		28
80*23bc2503Sthorpej #define	_REG_GP		29
81*23bc2503Sthorpej #define	_REG_SP		30
82*23bc2503Sthorpej #define	_REG_UNIQUE	31
83*23bc2503Sthorpej #define	_REG_PC		32
84*23bc2503Sthorpej #define	_REG_PS		33
85*23bc2503Sthorpej 
86*23bc2503Sthorpej /*
87*23bc2503Sthorpej  * Floating point register state (important: maps to `struct fpreg')
88*23bc2503Sthorpej  */
89*23bc2503Sthorpej typedef struct {
90*23bc2503Sthorpej 	union {
91*23bc2503Sthorpej 		unsigned long	__fp_regs[32];
92*23bc2503Sthorpej 		double		__fp_dregs[32];
93*23bc2503Sthorpej 	}		__fp_fr;
94*23bc2503Sthorpej 	unsigned long	__fp_fpcr;
95*23bc2503Sthorpej } __fpregset_t;
96*23bc2503Sthorpej 
97*23bc2503Sthorpej typedef struct {
98*23bc2503Sthorpej 	__gregset_t	__gregs;
99*23bc2503Sthorpej 	__fpregset_t	__fpregs;
100*23bc2503Sthorpej } mcontext_t;
101*23bc2503Sthorpej 
102*23bc2503Sthorpej /* Machine-dependent uc_flags */
103*23bc2503Sthorpej #define _UC_UNIQUE	0x20	/* valid process-unique value in _REG_UNIQUE */
104*23bc2503Sthorpej 
105*23bc2503Sthorpej #define _UC_MACHINE_SP(uc)	((uc)->uc_mcontext.__gregs[_REG_SP])
106*23bc2503Sthorpej 
107*23bc2503Sthorpej #endif	/* !_ALPHA_MCONTEXT_H_ */
108