1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 30*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 31*7c478bd9Sstevel@tonic-gate 32*7c478bd9Sstevel@tonic-gate #ifndef _SYS_REGSET_H 33*7c478bd9Sstevel@tonic-gate #define _SYS_REGSET_H 34*7c478bd9Sstevel@tonic-gate 35*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate #if !defined(_ASM) 40*7c478bd9Sstevel@tonic-gate #include <sys/types.h> 41*7c478bd9Sstevel@tonic-gate #endif 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 44*7c478bd9Sstevel@tonic-gate extern "C" { 45*7c478bd9Sstevel@tonic-gate #endif 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate /* 50*7c478bd9Sstevel@tonic-gate * The names and offsets defined here should be specified by the 51*7c478bd9Sstevel@tonic-gate * AMD64 ABI suppl. 52*7c478bd9Sstevel@tonic-gate * 53*7c478bd9Sstevel@tonic-gate * We make fsbase and gsbase part of the lwp context (since they're 54*7c478bd9Sstevel@tonic-gate * the only way to access the full 64-bit address range via the segment 55*7c478bd9Sstevel@tonic-gate * registers) and thus belong here too. However we treat them as 56*7c478bd9Sstevel@tonic-gate * read-only; if %fs or %gs are updated, the results of the descriptor 57*7c478bd9Sstevel@tonic-gate * table lookup that those updates implicitly cause will be reflected 58*7c478bd9Sstevel@tonic-gate * in the corresponding fsbase and/or gsbase values the next time the 59*7c478bd9Sstevel@tonic-gate * context can be inspected. However it is NOT possible to override 60*7c478bd9Sstevel@tonic-gate * the fsbase/gsbase settings via this interface. 61*7c478bd9Sstevel@tonic-gate * 62*7c478bd9Sstevel@tonic-gate * Direct modification of the base registers (thus overriding the 63*7c478bd9Sstevel@tonic-gate * descriptor table base address) can be achieved with _lwp_setprivate. 64*7c478bd9Sstevel@tonic-gate */ 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gate #define REG_GSBASE 27 67*7c478bd9Sstevel@tonic-gate #define REG_FSBASE 26 68*7c478bd9Sstevel@tonic-gate #define REG_DS 25 69*7c478bd9Sstevel@tonic-gate #define REG_ES 24 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate #define REG_GS 23 72*7c478bd9Sstevel@tonic-gate #define REG_FS 22 73*7c478bd9Sstevel@tonic-gate #define REG_SS 21 74*7c478bd9Sstevel@tonic-gate #define REG_RSP 20 75*7c478bd9Sstevel@tonic-gate #define REG_RFL 19 76*7c478bd9Sstevel@tonic-gate #define REG_CS 18 77*7c478bd9Sstevel@tonic-gate #define REG_RIP 17 78*7c478bd9Sstevel@tonic-gate #define REG_ERR 16 79*7c478bd9Sstevel@tonic-gate #define REG_TRAPNO 15 80*7c478bd9Sstevel@tonic-gate #define REG_RAX 14 81*7c478bd9Sstevel@tonic-gate #define REG_RCX 13 82*7c478bd9Sstevel@tonic-gate #define REG_RDX 12 83*7c478bd9Sstevel@tonic-gate #define REG_RBX 11 84*7c478bd9Sstevel@tonic-gate #define REG_RBP 10 85*7c478bd9Sstevel@tonic-gate #define REG_RSI 9 86*7c478bd9Sstevel@tonic-gate #define REG_RDI 8 87*7c478bd9Sstevel@tonic-gate #define REG_R8 7 88*7c478bd9Sstevel@tonic-gate #define REG_R9 6 89*7c478bd9Sstevel@tonic-gate #define REG_R10 5 90*7c478bd9Sstevel@tonic-gate #define REG_R11 4 91*7c478bd9Sstevel@tonic-gate #define REG_R12 3 92*7c478bd9Sstevel@tonic-gate #define REG_R13 2 93*7c478bd9Sstevel@tonic-gate #define REG_R14 1 94*7c478bd9Sstevel@tonic-gate #define REG_R15 0 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate /* 97*7c478bd9Sstevel@tonic-gate * The names and offsets defined here are specified by i386 ABI suppl. 98*7c478bd9Sstevel@tonic-gate */ 99*7c478bd9Sstevel@tonic-gate 100*7c478bd9Sstevel@tonic-gate #define SS 18 /* only stored on a privilege transition */ 101*7c478bd9Sstevel@tonic-gate #define UESP 17 /* only stored on a privilege transition */ 102*7c478bd9Sstevel@tonic-gate #define EFL 16 103*7c478bd9Sstevel@tonic-gate #define CS 15 104*7c478bd9Sstevel@tonic-gate #define EIP 14 105*7c478bd9Sstevel@tonic-gate #define ERR 13 106*7c478bd9Sstevel@tonic-gate #define TRAPNO 12 107*7c478bd9Sstevel@tonic-gate #define EAX 11 108*7c478bd9Sstevel@tonic-gate #define ECX 10 109*7c478bd9Sstevel@tonic-gate #define EDX 9 110*7c478bd9Sstevel@tonic-gate #define EBX 8 111*7c478bd9Sstevel@tonic-gate #define ESP 7 112*7c478bd9Sstevel@tonic-gate #define EBP 6 113*7c478bd9Sstevel@tonic-gate #define ESI 5 114*7c478bd9Sstevel@tonic-gate #define EDI 4 115*7c478bd9Sstevel@tonic-gate #define DS 3 116*7c478bd9Sstevel@tonic-gate #define ES 2 117*7c478bd9Sstevel@tonic-gate #define FS 1 118*7c478bd9Sstevel@tonic-gate #define GS 0 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gate /* aliases for portability */ 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gate #if defined(__amd64) 123*7c478bd9Sstevel@tonic-gate 124*7c478bd9Sstevel@tonic-gate #define REG_PC REG_RIP 125*7c478bd9Sstevel@tonic-gate #define REG_FP REG_RBP 126*7c478bd9Sstevel@tonic-gate #define REG_SP REG_RSP 127*7c478bd9Sstevel@tonic-gate #define REG_PS REG_RFL 128*7c478bd9Sstevel@tonic-gate #define REG_R0 REG_RAX 129*7c478bd9Sstevel@tonic-gate #define REG_R1 REG_RDX 130*7c478bd9Sstevel@tonic-gate 131*7c478bd9Sstevel@tonic-gate #else /* __i386 */ 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate #define REG_PC EIP 134*7c478bd9Sstevel@tonic-gate #define REG_FP EBP 135*7c478bd9Sstevel@tonic-gate #define REG_SP UESP 136*7c478bd9Sstevel@tonic-gate #define REG_PS EFL 137*7c478bd9Sstevel@tonic-gate #define REG_R0 EAX 138*7c478bd9Sstevel@tonic-gate #define REG_R1 EDX 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate #endif /* __i386 */ 141*7c478bd9Sstevel@tonic-gate 142*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 143*7c478bd9Sstevel@tonic-gate 144*7c478bd9Sstevel@tonic-gate /* 145*7c478bd9Sstevel@tonic-gate * A gregset_t is defined as an array type for compatibility with the reference 146*7c478bd9Sstevel@tonic-gate * source. This is important due to differences in the way the C language 147*7c478bd9Sstevel@tonic-gate * treats arrays and structures as parameters. 148*7c478bd9Sstevel@tonic-gate */ 149*7c478bd9Sstevel@tonic-gate #if defined(__amd64) 150*7c478bd9Sstevel@tonic-gate #define _NGREG 28 151*7c478bd9Sstevel@tonic-gate #else 152*7c478bd9Sstevel@tonic-gate #define _NGREG 19 153*7c478bd9Sstevel@tonic-gate #endif 154*7c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 155*7c478bd9Sstevel@tonic-gate #define NGREG _NGREG 156*7c478bd9Sstevel@tonic-gate #endif 157*7c478bd9Sstevel@tonic-gate 158*7c478bd9Sstevel@tonic-gate #if !defined(_ASM) 159*7c478bd9Sstevel@tonic-gate 160*7c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx) 161*7c478bd9Sstevel@tonic-gate typedef long greg_t; 162*7c478bd9Sstevel@tonic-gate #else 163*7c478bd9Sstevel@tonic-gate typedef int greg_t; 164*7c478bd9Sstevel@tonic-gate #endif 165*7c478bd9Sstevel@tonic-gate 166*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate typedef int32_t greg32_t; 169*7c478bd9Sstevel@tonic-gate typedef int64_t greg64_t; 170*7c478bd9Sstevel@tonic-gate 171*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 172*7c478bd9Sstevel@tonic-gate 173*7c478bd9Sstevel@tonic-gate typedef greg_t gregset_t[_NGREG]; 174*7c478bd9Sstevel@tonic-gate 175*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 176*7c478bd9Sstevel@tonic-gate 177*7c478bd9Sstevel@tonic-gate #define _NGREG32 19 178*7c478bd9Sstevel@tonic-gate #define _NGREG64 28 179*7c478bd9Sstevel@tonic-gate 180*7c478bd9Sstevel@tonic-gate typedef greg32_t gregset32_t[_NGREG32]; 181*7c478bd9Sstevel@tonic-gate typedef greg64_t gregset64_t[_NGREG64]; 182*7c478bd9Sstevel@tonic-gate 183*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 184*7c478bd9Sstevel@tonic-gate 185*7c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gate /* 188*7c478bd9Sstevel@tonic-gate * Floating point definitions. 189*7c478bd9Sstevel@tonic-gate */ 190*7c478bd9Sstevel@tonic-gate 191*7c478bd9Sstevel@tonic-gate /* 192*7c478bd9Sstevel@tonic-gate * This structure is written to memory by an 'fnsave' instruction 193*7c478bd9Sstevel@tonic-gate */ 194*7c478bd9Sstevel@tonic-gate struct fnsave_state { 195*7c478bd9Sstevel@tonic-gate uint16_t f_fcw; 196*7c478bd9Sstevel@tonic-gate uint16_t __f_ign0; 197*7c478bd9Sstevel@tonic-gate uint16_t f_fsw; 198*7c478bd9Sstevel@tonic-gate uint16_t __f_ign1; 199*7c478bd9Sstevel@tonic-gate uint16_t f_ftw; 200*7c478bd9Sstevel@tonic-gate uint16_t __f_ign2; 201*7c478bd9Sstevel@tonic-gate uint32_t f_eip; 202*7c478bd9Sstevel@tonic-gate uint16_t f_cs; 203*7c478bd9Sstevel@tonic-gate uint16_t f_fop; 204*7c478bd9Sstevel@tonic-gate uint32_t f_dp; 205*7c478bd9Sstevel@tonic-gate uint16_t f_ds; 206*7c478bd9Sstevel@tonic-gate uint16_t __f_ign3; 207*7c478bd9Sstevel@tonic-gate union { 208*7c478bd9Sstevel@tonic-gate uint16_t fpr_16[5]; /* 80-bits of x87 state */ 209*7c478bd9Sstevel@tonic-gate } f_st[8]; 210*7c478bd9Sstevel@tonic-gate }; /* 108 bytes */ 211*7c478bd9Sstevel@tonic-gate 212*7c478bd9Sstevel@tonic-gate /* 213*7c478bd9Sstevel@tonic-gate * This structure is written to memory by an 'fxsave' instruction 214*7c478bd9Sstevel@tonic-gate * Note the variant behaviour of this instruction between long mode 215*7c478bd9Sstevel@tonic-gate * and legacy environments! 216*7c478bd9Sstevel@tonic-gate */ 217*7c478bd9Sstevel@tonic-gate struct fxsave_state { 218*7c478bd9Sstevel@tonic-gate uint16_t fx_fcw; 219*7c478bd9Sstevel@tonic-gate uint16_t fx_fsw; 220*7c478bd9Sstevel@tonic-gate uint16_t fx_fctw; /* compressed tag word */ 221*7c478bd9Sstevel@tonic-gate uint16_t fx_fop; 222*7c478bd9Sstevel@tonic-gate #if defined(__amd64) 223*7c478bd9Sstevel@tonic-gate uint64_t fx_rip; 224*7c478bd9Sstevel@tonic-gate uint64_t fx_rdp; 225*7c478bd9Sstevel@tonic-gate #else 226*7c478bd9Sstevel@tonic-gate uint32_t fx_eip; 227*7c478bd9Sstevel@tonic-gate uint16_t fx_cs; 228*7c478bd9Sstevel@tonic-gate uint16_t __fx_ign0; 229*7c478bd9Sstevel@tonic-gate uint32_t fx_dp; 230*7c478bd9Sstevel@tonic-gate uint16_t fx_ds; 231*7c478bd9Sstevel@tonic-gate uint16_t __fx_ign1; 232*7c478bd9Sstevel@tonic-gate #endif 233*7c478bd9Sstevel@tonic-gate uint32_t fx_mxcsr; 234*7c478bd9Sstevel@tonic-gate uint32_t fx_mxcsr_mask; 235*7c478bd9Sstevel@tonic-gate union { 236*7c478bd9Sstevel@tonic-gate uint16_t fpr_16[5]; /* 80-bits of x87 state */ 237*7c478bd9Sstevel@tonic-gate u_longlong_t fpr_mmx; /* 64-bit mmx register */ 238*7c478bd9Sstevel@tonic-gate uint32_t __fpr_pad[4]; /* (pad out to 128-bits) */ 239*7c478bd9Sstevel@tonic-gate } fx_st[8]; 240*7c478bd9Sstevel@tonic-gate #if defined(__amd64) 241*7c478bd9Sstevel@tonic-gate upad128_t fx_xmm[16]; /* 128-bit registers */ 242*7c478bd9Sstevel@tonic-gate upad128_t __fx_ign2[6]; 243*7c478bd9Sstevel@tonic-gate #else 244*7c478bd9Sstevel@tonic-gate upad128_t fx_xmm[8]; /* 128-bit registers */ 245*7c478bd9Sstevel@tonic-gate upad128_t __fx_ign2[14]; 246*7c478bd9Sstevel@tonic-gate #endif 247*7c478bd9Sstevel@tonic-gate }; /* 512 bytes */ 248*7c478bd9Sstevel@tonic-gate 249*7c478bd9Sstevel@tonic-gate #if defined(__amd64) 250*7c478bd9Sstevel@tonic-gate 251*7c478bd9Sstevel@tonic-gate typedef struct fpu { 252*7c478bd9Sstevel@tonic-gate union { 253*7c478bd9Sstevel@tonic-gate struct fpchip_state { 254*7c478bd9Sstevel@tonic-gate uint16_t cw; 255*7c478bd9Sstevel@tonic-gate uint16_t sw; 256*7c478bd9Sstevel@tonic-gate uint8_t fctw; 257*7c478bd9Sstevel@tonic-gate uint8_t __fx_rsvd; 258*7c478bd9Sstevel@tonic-gate uint16_t fop; 259*7c478bd9Sstevel@tonic-gate uint64_t rip; 260*7c478bd9Sstevel@tonic-gate uint64_t rdp; 261*7c478bd9Sstevel@tonic-gate uint32_t mxcsr; 262*7c478bd9Sstevel@tonic-gate uint32_t mxcsr_mask; 263*7c478bd9Sstevel@tonic-gate union { 264*7c478bd9Sstevel@tonic-gate uint16_t fpr_16[5]; 265*7c478bd9Sstevel@tonic-gate upad128_t __fpr_pad; 266*7c478bd9Sstevel@tonic-gate } st[8]; 267*7c478bd9Sstevel@tonic-gate upad128_t xmm[16]; 268*7c478bd9Sstevel@tonic-gate upad128_t __fx_ign2[6]; 269*7c478bd9Sstevel@tonic-gate uint32_t status; /* sw at exception */ 270*7c478bd9Sstevel@tonic-gate uint32_t xstatus; /* mxcsr at exception */ 271*7c478bd9Sstevel@tonic-gate } fpchip_state; 272*7c478bd9Sstevel@tonic-gate uint32_t f_fpregs[130]; 273*7c478bd9Sstevel@tonic-gate } fp_reg_set; 274*7c478bd9Sstevel@tonic-gate } fpregset_t; 275*7c478bd9Sstevel@tonic-gate 276*7c478bd9Sstevel@tonic-gate #else /* __i386 */ 277*7c478bd9Sstevel@tonic-gate 278*7c478bd9Sstevel@tonic-gate /* 279*7c478bd9Sstevel@tonic-gate * This definition of the floating point structure is binary 280*7c478bd9Sstevel@tonic-gate * compatible with the Intel386 psABI definition, and source 281*7c478bd9Sstevel@tonic-gate * compatible with that specification for x87-style floating point. 282*7c478bd9Sstevel@tonic-gate * It also allows SSE/SSE2 state to be accessed on machines that 283*7c478bd9Sstevel@tonic-gate * possess such hardware capabilities. 284*7c478bd9Sstevel@tonic-gate */ 285*7c478bd9Sstevel@tonic-gate typedef struct fpu { 286*7c478bd9Sstevel@tonic-gate union { 287*7c478bd9Sstevel@tonic-gate struct fpchip_state { 288*7c478bd9Sstevel@tonic-gate uint32_t state[27]; /* 287/387 saved state */ 289*7c478bd9Sstevel@tonic-gate uint32_t status; /* saved at exception */ 290*7c478bd9Sstevel@tonic-gate uint32_t mxcsr; /* SSE control and status */ 291*7c478bd9Sstevel@tonic-gate uint32_t xstatus; /* SSE mxcsr at exception */ 292*7c478bd9Sstevel@tonic-gate uint32_t __pad[2]; /* align to 128-bits */ 293*7c478bd9Sstevel@tonic-gate upad128_t xmm[8]; /* %xmm0-%xmm7 */ 294*7c478bd9Sstevel@tonic-gate } fpchip_state; 295*7c478bd9Sstevel@tonic-gate struct fp_emul_space { /* for emulator(s) */ 296*7c478bd9Sstevel@tonic-gate uint8_t fp_emul[246]; 297*7c478bd9Sstevel@tonic-gate uint8_t fp_epad[2]; 298*7c478bd9Sstevel@tonic-gate } fp_emul_space; 299*7c478bd9Sstevel@tonic-gate uint32_t f_fpregs[95]; /* union of the above */ 300*7c478bd9Sstevel@tonic-gate } fp_reg_set; 301*7c478bd9Sstevel@tonic-gate } fpregset_t; 302*7c478bd9Sstevel@tonic-gate 303*7c478bd9Sstevel@tonic-gate /* 304*7c478bd9Sstevel@tonic-gate * (This structure definition is specified in the i386 ABI supplement) 305*7c478bd9Sstevel@tonic-gate */ 306*7c478bd9Sstevel@tonic-gate typedef struct __old_fpu { 307*7c478bd9Sstevel@tonic-gate union { 308*7c478bd9Sstevel@tonic-gate struct __old_fpchip_state /* fp extension state */ 309*7c478bd9Sstevel@tonic-gate { 310*7c478bd9Sstevel@tonic-gate int state[27]; /* 287/387 saved state */ 311*7c478bd9Sstevel@tonic-gate int status; /* status word saved at */ 312*7c478bd9Sstevel@tonic-gate /* exception */ 313*7c478bd9Sstevel@tonic-gate } fpchip_state; 314*7c478bd9Sstevel@tonic-gate struct __old_fp_emul_space /* for emulator(s) */ 315*7c478bd9Sstevel@tonic-gate { 316*7c478bd9Sstevel@tonic-gate char fp_emul[246]; 317*7c478bd9Sstevel@tonic-gate char fp_epad[2]; 318*7c478bd9Sstevel@tonic-gate } fp_emul_space; 319*7c478bd9Sstevel@tonic-gate int f_fpregs[62]; /* union of the above */ 320*7c478bd9Sstevel@tonic-gate } fp_reg_set; 321*7c478bd9Sstevel@tonic-gate long f_wregs[33]; /* saved weitek state */ 322*7c478bd9Sstevel@tonic-gate } __old_fpregset_t; 323*7c478bd9Sstevel@tonic-gate 324*7c478bd9Sstevel@tonic-gate #endif /* __i386 */ 325*7c478bd9Sstevel@tonic-gate 326*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 327*7c478bd9Sstevel@tonic-gate 328*7c478bd9Sstevel@tonic-gate /* Kernel view of user i386 fpu structure */ 329*7c478bd9Sstevel@tonic-gate 330*7c478bd9Sstevel@tonic-gate typedef struct fpu32 { 331*7c478bd9Sstevel@tonic-gate union { 332*7c478bd9Sstevel@tonic-gate struct fpchip32_state { 333*7c478bd9Sstevel@tonic-gate uint32_t state[27]; /* 287/387 saved state */ 334*7c478bd9Sstevel@tonic-gate uint32_t status; /* saved at exception */ 335*7c478bd9Sstevel@tonic-gate uint32_t mxcsr; /* SSE control and status */ 336*7c478bd9Sstevel@tonic-gate uint32_t xstatus; /* SSE mxcsr at exception */ 337*7c478bd9Sstevel@tonic-gate uint32_t __pad[2]; /* align to 128-bits */ 338*7c478bd9Sstevel@tonic-gate uint32_t xmm[8][4]; /* %xmm0-%xmm7 */ 339*7c478bd9Sstevel@tonic-gate } fpchip_state; 340*7c478bd9Sstevel@tonic-gate uint32_t f_fpregs[95]; /* union of the above */ 341*7c478bd9Sstevel@tonic-gate } fp_reg_set; 342*7c478bd9Sstevel@tonic-gate } fpregset32_t; 343*7c478bd9Sstevel@tonic-gate 344*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 345*7c478bd9Sstevel@tonic-gate 346*7c478bd9Sstevel@tonic-gate /* 347*7c478bd9Sstevel@tonic-gate * Kernel's FPU save area 348*7c478bd9Sstevel@tonic-gate */ 349*7c478bd9Sstevel@tonic-gate typedef struct { 350*7c478bd9Sstevel@tonic-gate union _kfpu_u { 351*7c478bd9Sstevel@tonic-gate struct fxsave_state kfpu_fx; 352*7c478bd9Sstevel@tonic-gate #if defined(__i386) 353*7c478bd9Sstevel@tonic-gate struct fnsave_state kfpu_fn; 354*7c478bd9Sstevel@tonic-gate #endif 355*7c478bd9Sstevel@tonic-gate } kfpu_u; 356*7c478bd9Sstevel@tonic-gate uint32_t kfpu_status; /* saved at #mf exception */ 357*7c478bd9Sstevel@tonic-gate uint32_t kfpu_xstatus; /* saved at #xm exception */ 358*7c478bd9Sstevel@tonic-gate } kfpu_t; 359*7c478bd9Sstevel@tonic-gate 360*7c478bd9Sstevel@tonic-gate #if defined(__amd64) 361*7c478bd9Sstevel@tonic-gate #define NDEBUGREG 16 362*7c478bd9Sstevel@tonic-gate #else 363*7c478bd9Sstevel@tonic-gate #define NDEBUGREG 8 364*7c478bd9Sstevel@tonic-gate #endif 365*7c478bd9Sstevel@tonic-gate 366*7c478bd9Sstevel@tonic-gate typedef struct dbregset { 367*7c478bd9Sstevel@tonic-gate unsigned long debugreg[NDEBUGREG]; 368*7c478bd9Sstevel@tonic-gate } dbregset_t; 369*7c478bd9Sstevel@tonic-gate 370*7c478bd9Sstevel@tonic-gate /* 371*7c478bd9Sstevel@tonic-gate * Structure mcontext defines the complete hardware machine state. 372*7c478bd9Sstevel@tonic-gate * (This structure is specified in the i386 ABI suppl.) 373*7c478bd9Sstevel@tonic-gate */ 374*7c478bd9Sstevel@tonic-gate typedef struct { 375*7c478bd9Sstevel@tonic-gate gregset_t gregs; /* general register set */ 376*7c478bd9Sstevel@tonic-gate fpregset_t fpregs; /* floating point register set */ 377*7c478bd9Sstevel@tonic-gate } mcontext_t; 378*7c478bd9Sstevel@tonic-gate 379*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 380*7c478bd9Sstevel@tonic-gate 381*7c478bd9Sstevel@tonic-gate typedef struct { 382*7c478bd9Sstevel@tonic-gate gregset32_t gregs; /* general register set */ 383*7c478bd9Sstevel@tonic-gate fpregset32_t fpregs; /* floating point register set */ 384*7c478bd9Sstevel@tonic-gate } mcontext32_t; 385*7c478bd9Sstevel@tonic-gate 386*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 387*7c478bd9Sstevel@tonic-gate 388*7c478bd9Sstevel@tonic-gate #endif /* _ASM */ 389*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 390*7c478bd9Sstevel@tonic-gate 391*7c478bd9Sstevel@tonic-gate /* 392*7c478bd9Sstevel@tonic-gate * The version of privregs.h that is used on implementations that run on 393*7c478bd9Sstevel@tonic-gate * processors that support the AMD64 instruction set is deliberately not 394*7c478bd9Sstevel@tonic-gate * imported here. 395*7c478bd9Sstevel@tonic-gate * 396*7c478bd9Sstevel@tonic-gate * The amd64 'struct regs' definition may -not- compatible with either 397*7c478bd9Sstevel@tonic-gate * 32-bit or 64-bit core file contents, nor with the ucontext. As a result, 398*7c478bd9Sstevel@tonic-gate * the 'regs' structure cannot be used portably by applications, and should 399*7c478bd9Sstevel@tonic-gate * only be used by the kernel implementation. 400*7c478bd9Sstevel@tonic-gate * 401*7c478bd9Sstevel@tonic-gate * The inclusion of the i386 version of privregs.h allows for some limited 402*7c478bd9Sstevel@tonic-gate * source compatibility with 32-bit applications who expect to use 403*7c478bd9Sstevel@tonic-gate * 'struct regs' to match the context of a 32-bit core file, or a ucontext_t. 404*7c478bd9Sstevel@tonic-gate * 405*7c478bd9Sstevel@tonic-gate * Note that the ucontext_t actually describes the general register in terms 406*7c478bd9Sstevel@tonic-gate * of the gregset_t data type, as described in this file. Note also 407*7c478bd9Sstevel@tonic-gate * that the core file content is defined by core(4) in terms of data types 408*7c478bd9Sstevel@tonic-gate * defined by procfs -- see proc(4). 409*7c478bd9Sstevel@tonic-gate */ 410*7c478bd9Sstevel@tonic-gate #if defined(__i386) && \ 411*7c478bd9Sstevel@tonic-gate (!defined(_KERNEL) && !defined(_XPG4_2) || defined(__EXTENSIONS__)) 412*7c478bd9Sstevel@tonic-gate #include <sys/privregs.h> 413*7c478bd9Sstevel@tonic-gate #endif /* __i386 (!_KERNEL && !_XPG4_2 || __EXTENSIONS__) */ 414*7c478bd9Sstevel@tonic-gate 415*7c478bd9Sstevel@tonic-gate /* 416*7c478bd9Sstevel@tonic-gate * The following is here for XPG4.2 standards compliance. 417*7c478bd9Sstevel@tonic-gate * regset.h is included in ucontext.h for the definition of 418*7c478bd9Sstevel@tonic-gate * mcontext_t, all of which breaks XPG4.2 namespace. 419*7c478bd9Sstevel@tonic-gate */ 420*7c478bd9Sstevel@tonic-gate 421*7c478bd9Sstevel@tonic-gate #if defined(_XPG4_2) && !defined(__EXTENSIONS__) && !defined(_ASM) 422*7c478bd9Sstevel@tonic-gate 423*7c478bd9Sstevel@tonic-gate /* 424*7c478bd9Sstevel@tonic-gate * The following is here for UNIX 95 compliance (XPG Issue 4, Version 2 425*7c478bd9Sstevel@tonic-gate * System Interfaces and Headers). The structures included here are identical 426*7c478bd9Sstevel@tonic-gate * to those visible elsewhere in this header except that the structure 427*7c478bd9Sstevel@tonic-gate * element names have been changed in accordance with the X/Open namespace 428*7c478bd9Sstevel@tonic-gate * rules. Specifically, depending on the name and scope, the names have 429*7c478bd9Sstevel@tonic-gate * been prepended with a single or double underscore (_ or __). See the 430*7c478bd9Sstevel@tonic-gate * structure definitions in the non-X/Open namespace for more detailed 431*7c478bd9Sstevel@tonic-gate * comments describing each of these structures. 432*7c478bd9Sstevel@tonic-gate */ 433*7c478bd9Sstevel@tonic-gate 434*7c478bd9Sstevel@tonic-gate #if defined(__amd64) 435*7c478bd9Sstevel@tonic-gate 436*7c478bd9Sstevel@tonic-gate typedef struct __fpu { 437*7c478bd9Sstevel@tonic-gate union { 438*7c478bd9Sstevel@tonic-gate struct __fpchip_state { 439*7c478bd9Sstevel@tonic-gate uint16_t __fx_cw; 440*7c478bd9Sstevel@tonic-gate uint16_t __fx_sw; 441*7c478bd9Sstevel@tonic-gate uint16_t __fx_ctw; 442*7c478bd9Sstevel@tonic-gate uint16_t __fx_op; 443*7c478bd9Sstevel@tonic-gate uint64_t __fx_rip; 444*7c478bd9Sstevel@tonic-gate uint64_t __fx_rdp; 445*7c478bd9Sstevel@tonic-gate uint32_t __fx_mxcsr; 446*7c478bd9Sstevel@tonic-gate uint32_t __fx_mxcsr_mask; 447*7c478bd9Sstevel@tonic-gate union { 448*7c478bd9Sstevel@tonic-gate uint16_t __fpr_16[5]; 449*7c478bd9Sstevel@tonic-gate upad128_t __fpr_pad; 450*7c478bd9Sstevel@tonic-gate } __fx_st[8]; 451*7c478bd9Sstevel@tonic-gate upad128_t __fx_xmm[16]; 452*7c478bd9Sstevel@tonic-gate upad128_t __fx_ign2[6]; 453*7c478bd9Sstevel@tonic-gate uint32_t __status; 454*7c478bd9Sstevel@tonic-gate uint32_t __xstatus; 455*7c478bd9Sstevel@tonic-gate } __fpchip_state; 456*7c478bd9Sstevel@tonic-gate uint32_t __f_fpregs[130]; 457*7c478bd9Sstevel@tonic-gate } __fp_reg_set; 458*7c478bd9Sstevel@tonic-gate } fpregset_t; 459*7c478bd9Sstevel@tonic-gate 460*7c478bd9Sstevel@tonic-gate #else /* __i386 */ 461*7c478bd9Sstevel@tonic-gate 462*7c478bd9Sstevel@tonic-gate typedef struct __fpu { 463*7c478bd9Sstevel@tonic-gate union { 464*7c478bd9Sstevel@tonic-gate struct __fpchip_state { 465*7c478bd9Sstevel@tonic-gate uint32_t __state[27]; /* 287/387 saved state */ 466*7c478bd9Sstevel@tonic-gate uint32_t __status; /* saved at exception */ 467*7c478bd9Sstevel@tonic-gate uint32_t __mxcsr; /* SSE control and status */ 468*7c478bd9Sstevel@tonic-gate uint32_t __xstatus; /* SSE mxcsr at exception */ 469*7c478bd9Sstevel@tonic-gate uint32_t __pad[2]; /* align to 128-bits */ 470*7c478bd9Sstevel@tonic-gate upad128_t __xmm[8]; /* %xmm0-%xmm7 */ 471*7c478bd9Sstevel@tonic-gate } __fpchip_state; 472*7c478bd9Sstevel@tonic-gate struct __fp_emul_space { /* for emulator(s) */ 473*7c478bd9Sstevel@tonic-gate uint8_t __fp_emul[246]; 474*7c478bd9Sstevel@tonic-gate uint8_t __fp_epad[2]; 475*7c478bd9Sstevel@tonic-gate } __fp_emul_space; 476*7c478bd9Sstevel@tonic-gate uint32_t __f_fpregs[95]; /* union of the above */ 477*7c478bd9Sstevel@tonic-gate } __fp_reg_set; 478*7c478bd9Sstevel@tonic-gate } fpregset_t; 479*7c478bd9Sstevel@tonic-gate 480*7c478bd9Sstevel@tonic-gate #endif /* __i386 */ 481*7c478bd9Sstevel@tonic-gate 482*7c478bd9Sstevel@tonic-gate typedef struct { 483*7c478bd9Sstevel@tonic-gate gregset_t __gregs; /* general register set */ 484*7c478bd9Sstevel@tonic-gate fpregset_t __fpregs; /* floating point register set */ 485*7c478bd9Sstevel@tonic-gate } mcontext_t; 486*7c478bd9Sstevel@tonic-gate 487*7c478bd9Sstevel@tonic-gate #endif /* _XPG4_2 && !__EXTENSIONS__ && !_ASM */ 488*7c478bd9Sstevel@tonic-gate 489*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 490*7c478bd9Sstevel@tonic-gate } 491*7c478bd9Sstevel@tonic-gate #endif 492*7c478bd9Sstevel@tonic-gate 493*7c478bd9Sstevel@tonic-gate #endif /* _SYS_REGSET_H */ 494