mcontext.h revision 1.1.2.2 1 /* $NetBSD: mcontext.h,v 1.1.2.2 2001/11/21 08:56:25 wdk Exp $ */
2
3 /*-
4 * Copyright (c) 1999 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Klaus Klein.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #ifndef _MIPS_MCONTEXT_H_
40 #define _MIPS_MCONTEXT_H_
41
42 /*
43 * Layout of mcontext_t according to the System V Application Binary Interface,
44 * MIPS(tm) Processor Supplement, 3rd Edition, Feburary 1996 (p 6-79)
45 */
46
47 /*
48 * General register state
49 */
50 #if !defined(_MIPS_BSD_API) || _MIPS_BSD_API == _MIPS_BSD_API_LP32
51 #define _NGREG 36 /* R0-R31, MDLO, MDHI, CAUSE, PC */
52 #else
53 #define _NGREG 37 /* R0-R31, MDLO, MDHI, CAUSE, PC, SR */
54 #endif
55
56 #define _REG_R0 0
57 #define _REG_AT 1
58 #define _REG_V0 2
59 #define _REG_V1 3
60 #define _REG_A0 4
61 #define _REG_A1 5
62 #define _REG_A2 6
63 #define _REG_A3 7
64 #define _REG_T0 8
65 #define _REG_T1 9
66 #define _REG_T2 10
67 #define _REG_T3 11
68 #define _REG_T4 12
69 #define _REG_T5 13
70 #define _REG_T6 14
71 #define _REG_T7 15
72 #define _REG_S0 16
73 #define _REG_S1 17
74 #define _REG_S2 18
75 #define _REG_S3 19
76 #define _REG_S4 20
77 #define _REG_S5 21
78 #define _REG_S6 22
79 #define _REG_S7 23
80 #define _REG_T8 24
81 #define _REG_T9 25
82 #define _REG_K0 26
83 #define _REG_K1 27
84 #define _REG_GP 28
85 #define _REG_SP 29
86 #define _REG_S8 30
87 #define _REG_RA 31
88
89 /* XXX: The following conflict with <mips/regnum.h> */
90 #define _REG_MDLO 32
91 #define _REG_MDHI 33
92 #define _REG_CAUSE 34
93 #define _REG_EPC 35
94 #define _REG_SR 36
95
96 #ifndef __ASSEMBLER__
97
98 typedef mips_reg_t __greg_t;
99 typedef __greg_t __gregset_t[_NGREG];
100
101 /*
102 * Floating point register state
103 */
104 typedef struct {
105 union {
106 double __fp_dregs[16];
107 float __fp_fregs[32];
108 __greg_t __fp_regs[32];
109 } __fp_r;
110 u_int __fp_csr;
111 u_int __fp_pad;
112 } __fpregset_t;
113
114 typedef struct {
115 __gregset_t __gregs;
116 __fpregset_t __fpregs;
117 } mcontext_t;
118
119 #endif /* !__ASSEMBLER__ */
120
121 #define _UC_MACHINE_PAD 48 /* Padding appended to ucontext_t */
122
123 /*
124 * Offsets relative to ucontext_t; intended to be used by assembly stubs.
125 */
126 #if !defined(_MIPS_BSD_API) || _MIPS_BSD_API == _MIPS_BSD_API_LP32
127 #define _OFFSETOF_UC_GREGS 40
128 #else
129 #define _OFFSETOF_UC_GREGS 56
130 #endif
131
132 #endif /* _MIPS_MCONTEXT_H_ */
133