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