1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
*
* Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Essential struct definitions for mcontext_t needed by ucontext.h
* These were formerly in regset.h, which now includes this file.
*/
#ifndef _SYS_MCONTEXT_H
#define _SYS_MCONTEXT_H
#include <sys/feature_tests.h>
#if !defined(_ASM)
#include <sys/types.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* A gregset_t is defined as an array type for compatibility with the reference
* source. This is important due to differences in the way the C language
* treats arrays and structures as parameters.
*/
#if defined(__amd64)
#define _NGREG 28
#else
#define _NGREG 19
#endif
#if !defined(_ASM)
#if defined(_LP64) || defined(_I32LPx)
typedef long greg_t;
#else
typedef int greg_t;
#endif
#if defined(_SYSCALL32)
typedef int32_t greg32_t;
typedef int64_t greg64_t;
#endif /* _SYSCALL32 */
typedef greg_t gregset_t[_NGREG];
#if defined(_SYSCALL32)
#define _NGREG32 19
#define _NGREG64 28
typedef greg32_t gregset32_t[_NGREG32];
typedef greg64_t gregset64_t[_NGREG64];
#endif /* _SYSCALL32 */
/*
* Floating point definitions.
*/
#if defined(__amd64)
typedef struct _fpu {
union {
struct _fpchip_state {
uint16_t cw;
uint16_t sw;
uint8_t fctw;
uint8_t __fx_rsvd;
uint16_t fop;
uint64_t rip;
uint64_t rdp;
uint32_t mxcsr;
uint32_t mxcsr_mask;
union {
uint16_t fpr_16[5];
upad128_t __fpr_pad;
} st[8];
upad128_t xmm[16];
upad128_t __fx_ign2[6];
uint32_t status; /* sw at exception */
uint32_t xstatus; /* mxcsr at exception */
} fpchip_state;
uint32_t f_fpregs[130];
} fp_reg_set;
} fpregset_t;
#else /* __i386 */
/*
* This definition of the floating point structure is binary
* compatible with the Intel386 psABI definition, and source
* compatible with that specification for x87-style floating point.
* It also allows SSE/SSE2 state to be accessed on machines that
* possess such hardware capabilities.
*/
typedef struct _fpu {
union {
struct _fpchip_state {
uint32_t state[27]; /* 287/387 saved state */
uint32_t status; /* saved at exception */
uint32_t mxcsr; /* SSE control and status */
uint32_t xstatus; /* SSE mxcsr at exception */
uint32_t __pad[2]; /* align to 128-bits */
upad128_t xmm[8]; /* %xmm0-%xmm7 */
} fpchip_state;
struct _fp_emul_space { /* for emulator(s) */
uint8_t fp_emul[246];
uint8_t fp_epad[2];
} fp_emul_space;
uint32_t f_fpregs[95]; /* union of the above */
} fp_reg_set;
} fpregset_t;
#endif /* __i386 */
#if defined(_SYSCALL32)
/* Kernel view of user i386 fpu structure */
typedef struct fpu32 {
union {
struct fpchip32_state {
uint32_t state[27]; /* 287/387 saved state */
uint32_t status; /* saved at exception */
uint32_t mxcsr; /* SSE control and status */
uint32_t xstatus; /* SSE mxcsr at exception */
uint32_t __pad[2]; /* align to 128-bits */
uint32_t xmm[8][4]; /* %xmm0-%xmm7 */
} fpchip_state;
uint32_t f_fpregs[95]; /* union of the above */
} fp_reg_set;
} fpregset32_t;
#endif /* _SYSCALL32 */
/*
* Structure mcontext defines the complete hardware machine state.
* (This structure is specified in the i386 ABI suppl.)
*/
typedef struct {
gregset_t gregs; /* general register set */
fpregset_t fpregs; /* floating point register set */
} mcontext_t;
#if defined(_SYSCALL32)
typedef struct {
gregset32_t gregs; /* general register set */
fpregset32_t fpregs; /* floating point register set */
} mcontext32_t;
#endif /* _SYSCALL32 */
#endif /* _ASM */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_MCONTEXT_H */
|