17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7af88ac7SKuriakose Kuruvilla * Common Development and Distribution License (the "License"). 6*7af88ac7SKuriakose Kuruvilla * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate /* 22*7af88ac7SKuriakose Kuruvilla * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 237c478bd9Sstevel@tonic-gate */ 247c478bd9Sstevel@tonic-gate /* Copyright (c) 1990, 1991 UNIX System Laboratories, Inc. */ 257c478bd9Sstevel@tonic-gate 267c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 277c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate #ifndef _SYS_REGSET_H 307c478bd9Sstevel@tonic-gate #define _SYS_REGSET_H 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate #if !defined(_ASM) 357c478bd9Sstevel@tonic-gate #include <sys/types.h> 367c478bd9Sstevel@tonic-gate #endif 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #ifdef __cplusplus 397c478bd9Sstevel@tonic-gate extern "C" { 407c478bd9Sstevel@tonic-gate #endif 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate /* 457c478bd9Sstevel@tonic-gate * The names and offsets defined here should be specified by the 467c478bd9Sstevel@tonic-gate * AMD64 ABI suppl. 477c478bd9Sstevel@tonic-gate * 487c478bd9Sstevel@tonic-gate * We make fsbase and gsbase part of the lwp context (since they're 497c478bd9Sstevel@tonic-gate * the only way to access the full 64-bit address range via the segment 507c478bd9Sstevel@tonic-gate * registers) and thus belong here too. However we treat them as 517c478bd9Sstevel@tonic-gate * read-only; if %fs or %gs are updated, the results of the descriptor 527c478bd9Sstevel@tonic-gate * table lookup that those updates implicitly cause will be reflected 537c478bd9Sstevel@tonic-gate * in the corresponding fsbase and/or gsbase values the next time the 547c478bd9Sstevel@tonic-gate * context can be inspected. However it is NOT possible to override 557c478bd9Sstevel@tonic-gate * the fsbase/gsbase settings via this interface. 567c478bd9Sstevel@tonic-gate * 577c478bd9Sstevel@tonic-gate * Direct modification of the base registers (thus overriding the 587c478bd9Sstevel@tonic-gate * descriptor table base address) can be achieved with _lwp_setprivate. 597c478bd9Sstevel@tonic-gate */ 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate #define REG_GSBASE 27 627c478bd9Sstevel@tonic-gate #define REG_FSBASE 26 637c478bd9Sstevel@tonic-gate #define REG_DS 25 647c478bd9Sstevel@tonic-gate #define REG_ES 24 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate #define REG_GS 23 677c478bd9Sstevel@tonic-gate #define REG_FS 22 687c478bd9Sstevel@tonic-gate #define REG_SS 21 697c478bd9Sstevel@tonic-gate #define REG_RSP 20 707c478bd9Sstevel@tonic-gate #define REG_RFL 19 717c478bd9Sstevel@tonic-gate #define REG_CS 18 727c478bd9Sstevel@tonic-gate #define REG_RIP 17 737c478bd9Sstevel@tonic-gate #define REG_ERR 16 747c478bd9Sstevel@tonic-gate #define REG_TRAPNO 15 757c478bd9Sstevel@tonic-gate #define REG_RAX 14 767c478bd9Sstevel@tonic-gate #define REG_RCX 13 777c478bd9Sstevel@tonic-gate #define REG_RDX 12 787c478bd9Sstevel@tonic-gate #define REG_RBX 11 797c478bd9Sstevel@tonic-gate #define REG_RBP 10 807c478bd9Sstevel@tonic-gate #define REG_RSI 9 817c478bd9Sstevel@tonic-gate #define REG_RDI 8 827c478bd9Sstevel@tonic-gate #define REG_R8 7 837c478bd9Sstevel@tonic-gate #define REG_R9 6 847c478bd9Sstevel@tonic-gate #define REG_R10 5 857c478bd9Sstevel@tonic-gate #define REG_R11 4 867c478bd9Sstevel@tonic-gate #define REG_R12 3 877c478bd9Sstevel@tonic-gate #define REG_R13 2 887c478bd9Sstevel@tonic-gate #define REG_R14 1 897c478bd9Sstevel@tonic-gate #define REG_R15 0 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate /* 927c478bd9Sstevel@tonic-gate * The names and offsets defined here are specified by i386 ABI suppl. 937c478bd9Sstevel@tonic-gate */ 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate #define SS 18 /* only stored on a privilege transition */ 967c478bd9Sstevel@tonic-gate #define UESP 17 /* only stored on a privilege transition */ 977c478bd9Sstevel@tonic-gate #define EFL 16 987c478bd9Sstevel@tonic-gate #define CS 15 997c478bd9Sstevel@tonic-gate #define EIP 14 1007c478bd9Sstevel@tonic-gate #define ERR 13 1017c478bd9Sstevel@tonic-gate #define TRAPNO 12 1027c478bd9Sstevel@tonic-gate #define EAX 11 1037c478bd9Sstevel@tonic-gate #define ECX 10 1047c478bd9Sstevel@tonic-gate #define EDX 9 1057c478bd9Sstevel@tonic-gate #define EBX 8 1067c478bd9Sstevel@tonic-gate #define ESP 7 1077c478bd9Sstevel@tonic-gate #define EBP 6 1087c478bd9Sstevel@tonic-gate #define ESI 5 1097c478bd9Sstevel@tonic-gate #define EDI 4 1107c478bd9Sstevel@tonic-gate #define DS 3 1117c478bd9Sstevel@tonic-gate #define ES 2 1127c478bd9Sstevel@tonic-gate #define FS 1 1137c478bd9Sstevel@tonic-gate #define GS 0 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate /* aliases for portability */ 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate #if defined(__amd64) 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate #define REG_PC REG_RIP 1207c478bd9Sstevel@tonic-gate #define REG_FP REG_RBP 1217c478bd9Sstevel@tonic-gate #define REG_SP REG_RSP 1227c478bd9Sstevel@tonic-gate #define REG_PS REG_RFL 1237c478bd9Sstevel@tonic-gate #define REG_R0 REG_RAX 1247c478bd9Sstevel@tonic-gate #define REG_R1 REG_RDX 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate #else /* __i386 */ 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate #define REG_PC EIP 1297c478bd9Sstevel@tonic-gate #define REG_FP EBP 1307c478bd9Sstevel@tonic-gate #define REG_SP UESP 1317c478bd9Sstevel@tonic-gate #define REG_PS EFL 1327c478bd9Sstevel@tonic-gate #define REG_R0 EAX 1337c478bd9Sstevel@tonic-gate #define REG_R1 EDX 1347c478bd9Sstevel@tonic-gate 1357c478bd9Sstevel@tonic-gate #endif /* __i386 */ 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 1387c478bd9Sstevel@tonic-gate 1397c478bd9Sstevel@tonic-gate /* 1407c478bd9Sstevel@tonic-gate * A gregset_t is defined as an array type for compatibility with the reference 1417c478bd9Sstevel@tonic-gate * source. This is important due to differences in the way the C language 1427c478bd9Sstevel@tonic-gate * treats arrays and structures as parameters. 1437c478bd9Sstevel@tonic-gate */ 1447c478bd9Sstevel@tonic-gate #if defined(__amd64) 1457c478bd9Sstevel@tonic-gate #define _NGREG 28 1467c478bd9Sstevel@tonic-gate #else 1477c478bd9Sstevel@tonic-gate #define _NGREG 19 1487c478bd9Sstevel@tonic-gate #endif 1497c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 1507c478bd9Sstevel@tonic-gate #define NGREG _NGREG 1517c478bd9Sstevel@tonic-gate #endif 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate #if !defined(_ASM) 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx) 1567c478bd9Sstevel@tonic-gate typedef long greg_t; 1577c478bd9Sstevel@tonic-gate #else 1587c478bd9Sstevel@tonic-gate typedef int greg_t; 1597c478bd9Sstevel@tonic-gate #endif 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate typedef int32_t greg32_t; 1647c478bd9Sstevel@tonic-gate typedef int64_t greg64_t; 1657c478bd9Sstevel@tonic-gate 1667c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate typedef greg_t gregset_t[_NGREG]; 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 1717c478bd9Sstevel@tonic-gate 1727c478bd9Sstevel@tonic-gate #define _NGREG32 19 1737c478bd9Sstevel@tonic-gate #define _NGREG64 28 1747c478bd9Sstevel@tonic-gate 1757c478bd9Sstevel@tonic-gate typedef greg32_t gregset32_t[_NGREG32]; 1767c478bd9Sstevel@tonic-gate typedef greg64_t gregset64_t[_NGREG64]; 1777c478bd9Sstevel@tonic-gate 1787c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 1797c478bd9Sstevel@tonic-gate 1807c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 1817c478bd9Sstevel@tonic-gate 1827c478bd9Sstevel@tonic-gate /* 1837c478bd9Sstevel@tonic-gate * Floating point definitions. 1847c478bd9Sstevel@tonic-gate */ 1857c478bd9Sstevel@tonic-gate 1867c478bd9Sstevel@tonic-gate /* 1877c478bd9Sstevel@tonic-gate * This structure is written to memory by an 'fnsave' instruction 1887c478bd9Sstevel@tonic-gate */ 1897c478bd9Sstevel@tonic-gate struct fnsave_state { 1907c478bd9Sstevel@tonic-gate uint16_t f_fcw; 1917c478bd9Sstevel@tonic-gate uint16_t __f_ign0; 1927c478bd9Sstevel@tonic-gate uint16_t f_fsw; 1937c478bd9Sstevel@tonic-gate uint16_t __f_ign1; 1947c478bd9Sstevel@tonic-gate uint16_t f_ftw; 1957c478bd9Sstevel@tonic-gate uint16_t __f_ign2; 1967c478bd9Sstevel@tonic-gate uint32_t f_eip; 1977c478bd9Sstevel@tonic-gate uint16_t f_cs; 1987c478bd9Sstevel@tonic-gate uint16_t f_fop; 1997c478bd9Sstevel@tonic-gate uint32_t f_dp; 2007c478bd9Sstevel@tonic-gate uint16_t f_ds; 2017c478bd9Sstevel@tonic-gate uint16_t __f_ign3; 2027c478bd9Sstevel@tonic-gate union { 2037c478bd9Sstevel@tonic-gate uint16_t fpr_16[5]; /* 80-bits of x87 state */ 2047c478bd9Sstevel@tonic-gate } f_st[8]; 2057c478bd9Sstevel@tonic-gate }; /* 108 bytes */ 2067c478bd9Sstevel@tonic-gate 2077c478bd9Sstevel@tonic-gate /* 2087c478bd9Sstevel@tonic-gate * This structure is written to memory by an 'fxsave' instruction 2097c478bd9Sstevel@tonic-gate * Note the variant behaviour of this instruction between long mode 2107c478bd9Sstevel@tonic-gate * and legacy environments! 2117c478bd9Sstevel@tonic-gate */ 2127c478bd9Sstevel@tonic-gate struct fxsave_state { 2137c478bd9Sstevel@tonic-gate uint16_t fx_fcw; 2147c478bd9Sstevel@tonic-gate uint16_t fx_fsw; 2157c478bd9Sstevel@tonic-gate uint16_t fx_fctw; /* compressed tag word */ 2167c478bd9Sstevel@tonic-gate uint16_t fx_fop; 2177c478bd9Sstevel@tonic-gate #if defined(__amd64) 2187c478bd9Sstevel@tonic-gate uint64_t fx_rip; 2197c478bd9Sstevel@tonic-gate uint64_t fx_rdp; 2207c478bd9Sstevel@tonic-gate #else 2217c478bd9Sstevel@tonic-gate uint32_t fx_eip; 2227c478bd9Sstevel@tonic-gate uint16_t fx_cs; 2237c478bd9Sstevel@tonic-gate uint16_t __fx_ign0; 2247c478bd9Sstevel@tonic-gate uint32_t fx_dp; 2257c478bd9Sstevel@tonic-gate uint16_t fx_ds; 2267c478bd9Sstevel@tonic-gate uint16_t __fx_ign1; 2277c478bd9Sstevel@tonic-gate #endif 2287c478bd9Sstevel@tonic-gate uint32_t fx_mxcsr; 2297c478bd9Sstevel@tonic-gate uint32_t fx_mxcsr_mask; 2307c478bd9Sstevel@tonic-gate union { 2317c478bd9Sstevel@tonic-gate uint16_t fpr_16[5]; /* 80-bits of x87 state */ 2327c478bd9Sstevel@tonic-gate u_longlong_t fpr_mmx; /* 64-bit mmx register */ 2337c478bd9Sstevel@tonic-gate uint32_t __fpr_pad[4]; /* (pad out to 128-bits) */ 2347c478bd9Sstevel@tonic-gate } fx_st[8]; 2357c478bd9Sstevel@tonic-gate #if defined(__amd64) 2367c478bd9Sstevel@tonic-gate upad128_t fx_xmm[16]; /* 128-bit registers */ 2377c478bd9Sstevel@tonic-gate upad128_t __fx_ign2[6]; 2387c478bd9Sstevel@tonic-gate #else 2397c478bd9Sstevel@tonic-gate upad128_t fx_xmm[8]; /* 128-bit registers */ 2407c478bd9Sstevel@tonic-gate upad128_t __fx_ign2[14]; 2417c478bd9Sstevel@tonic-gate #endif 2427c478bd9Sstevel@tonic-gate }; /* 512 bytes */ 2437c478bd9Sstevel@tonic-gate 244*7af88ac7SKuriakose Kuruvilla /* 245*7af88ac7SKuriakose Kuruvilla * This structure is written to memory by an 'xsave' instruction. 246*7af88ac7SKuriakose Kuruvilla * First 512 byte is compatible with the format of an 'fxsave' area. 247*7af88ac7SKuriakose Kuruvilla */ 248*7af88ac7SKuriakose Kuruvilla struct xsave_state { 249*7af88ac7SKuriakose Kuruvilla struct fxsave_state xs_fxsave; 250*7af88ac7SKuriakose Kuruvilla uint64_t xs_xstate_bv; /* 512 */ 251*7af88ac7SKuriakose Kuruvilla uint64_t xs_rsv_mbz[2]; 252*7af88ac7SKuriakose Kuruvilla uint64_t xs_reserved[5]; 253*7af88ac7SKuriakose Kuruvilla upad128_t xs_ymm[16]; /* avx - 576 */ 254*7af88ac7SKuriakose Kuruvilla }; /* 832 bytes, asserted in fpnoextflt() */ 255*7af88ac7SKuriakose Kuruvilla 2567c478bd9Sstevel@tonic-gate #if defined(__amd64) 2577c478bd9Sstevel@tonic-gate 2587c478bd9Sstevel@tonic-gate typedef struct fpu { 2597c478bd9Sstevel@tonic-gate union { 2607c478bd9Sstevel@tonic-gate struct fpchip_state { 2617c478bd9Sstevel@tonic-gate uint16_t cw; 2627c478bd9Sstevel@tonic-gate uint16_t sw; 2637c478bd9Sstevel@tonic-gate uint8_t fctw; 2647c478bd9Sstevel@tonic-gate uint8_t __fx_rsvd; 2657c478bd9Sstevel@tonic-gate uint16_t fop; 2667c478bd9Sstevel@tonic-gate uint64_t rip; 2677c478bd9Sstevel@tonic-gate uint64_t rdp; 2687c478bd9Sstevel@tonic-gate uint32_t mxcsr; 2697c478bd9Sstevel@tonic-gate uint32_t mxcsr_mask; 2707c478bd9Sstevel@tonic-gate union { 2717c478bd9Sstevel@tonic-gate uint16_t fpr_16[5]; 2727c478bd9Sstevel@tonic-gate upad128_t __fpr_pad; 2737c478bd9Sstevel@tonic-gate } st[8]; 2747c478bd9Sstevel@tonic-gate upad128_t xmm[16]; 2757c478bd9Sstevel@tonic-gate upad128_t __fx_ign2[6]; 2767c478bd9Sstevel@tonic-gate uint32_t status; /* sw at exception */ 2777c478bd9Sstevel@tonic-gate uint32_t xstatus; /* mxcsr at exception */ 2787c478bd9Sstevel@tonic-gate } fpchip_state; 2797c478bd9Sstevel@tonic-gate uint32_t f_fpregs[130]; 2807c478bd9Sstevel@tonic-gate } fp_reg_set; 2817c478bd9Sstevel@tonic-gate } fpregset_t; 2827c478bd9Sstevel@tonic-gate 2837c478bd9Sstevel@tonic-gate #else /* __i386 */ 2847c478bd9Sstevel@tonic-gate 2857c478bd9Sstevel@tonic-gate /* 2867c478bd9Sstevel@tonic-gate * This definition of the floating point structure is binary 2877c478bd9Sstevel@tonic-gate * compatible with the Intel386 psABI definition, and source 2887c478bd9Sstevel@tonic-gate * compatible with that specification for x87-style floating point. 2897c478bd9Sstevel@tonic-gate * It also allows SSE/SSE2 state to be accessed on machines that 2907c478bd9Sstevel@tonic-gate * possess such hardware capabilities. 2917c478bd9Sstevel@tonic-gate */ 2927c478bd9Sstevel@tonic-gate typedef struct fpu { 2937c478bd9Sstevel@tonic-gate union { 2947c478bd9Sstevel@tonic-gate struct fpchip_state { 2957c478bd9Sstevel@tonic-gate uint32_t state[27]; /* 287/387 saved state */ 2967c478bd9Sstevel@tonic-gate uint32_t status; /* saved at exception */ 2977c478bd9Sstevel@tonic-gate uint32_t mxcsr; /* SSE control and status */ 2987c478bd9Sstevel@tonic-gate uint32_t xstatus; /* SSE mxcsr at exception */ 2997c478bd9Sstevel@tonic-gate uint32_t __pad[2]; /* align to 128-bits */ 3007c478bd9Sstevel@tonic-gate upad128_t xmm[8]; /* %xmm0-%xmm7 */ 3017c478bd9Sstevel@tonic-gate } fpchip_state; 3027c478bd9Sstevel@tonic-gate struct fp_emul_space { /* for emulator(s) */ 3037c478bd9Sstevel@tonic-gate uint8_t fp_emul[246]; 3047c478bd9Sstevel@tonic-gate uint8_t fp_epad[2]; 3057c478bd9Sstevel@tonic-gate } fp_emul_space; 3067c478bd9Sstevel@tonic-gate uint32_t f_fpregs[95]; /* union of the above */ 3077c478bd9Sstevel@tonic-gate } fp_reg_set; 3087c478bd9Sstevel@tonic-gate } fpregset_t; 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gate /* 3117c478bd9Sstevel@tonic-gate * (This structure definition is specified in the i386 ABI supplement) 3127c478bd9Sstevel@tonic-gate */ 3137c478bd9Sstevel@tonic-gate typedef struct __old_fpu { 3147c478bd9Sstevel@tonic-gate union { 3157c478bd9Sstevel@tonic-gate struct __old_fpchip_state /* fp extension state */ 3167c478bd9Sstevel@tonic-gate { 3177c478bd9Sstevel@tonic-gate int state[27]; /* 287/387 saved state */ 3187c478bd9Sstevel@tonic-gate int status; /* status word saved at */ 3197c478bd9Sstevel@tonic-gate /* exception */ 3207c478bd9Sstevel@tonic-gate } fpchip_state; 3217c478bd9Sstevel@tonic-gate struct __old_fp_emul_space /* for emulator(s) */ 3227c478bd9Sstevel@tonic-gate { 3237c478bd9Sstevel@tonic-gate char fp_emul[246]; 3247c478bd9Sstevel@tonic-gate char fp_epad[2]; 3257c478bd9Sstevel@tonic-gate } fp_emul_space; 3267c478bd9Sstevel@tonic-gate int f_fpregs[62]; /* union of the above */ 3277c478bd9Sstevel@tonic-gate } fp_reg_set; 3287c478bd9Sstevel@tonic-gate long f_wregs[33]; /* saved weitek state */ 3297c478bd9Sstevel@tonic-gate } __old_fpregset_t; 3307c478bd9Sstevel@tonic-gate 3317c478bd9Sstevel@tonic-gate #endif /* __i386 */ 3327c478bd9Sstevel@tonic-gate 3337c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 3347c478bd9Sstevel@tonic-gate 3357c478bd9Sstevel@tonic-gate /* Kernel view of user i386 fpu structure */ 3367c478bd9Sstevel@tonic-gate 3377c478bd9Sstevel@tonic-gate typedef struct fpu32 { 3387c478bd9Sstevel@tonic-gate union { 3397c478bd9Sstevel@tonic-gate struct fpchip32_state { 3407c478bd9Sstevel@tonic-gate uint32_t state[27]; /* 287/387 saved state */ 3417c478bd9Sstevel@tonic-gate uint32_t status; /* saved at exception */ 3427c478bd9Sstevel@tonic-gate uint32_t mxcsr; /* SSE control and status */ 3437c478bd9Sstevel@tonic-gate uint32_t xstatus; /* SSE mxcsr at exception */ 3447c478bd9Sstevel@tonic-gate uint32_t __pad[2]; /* align to 128-bits */ 3457c478bd9Sstevel@tonic-gate uint32_t xmm[8][4]; /* %xmm0-%xmm7 */ 3467c478bd9Sstevel@tonic-gate } fpchip_state; 3477c478bd9Sstevel@tonic-gate uint32_t f_fpregs[95]; /* union of the above */ 3487c478bd9Sstevel@tonic-gate } fp_reg_set; 3497c478bd9Sstevel@tonic-gate } fpregset32_t; 3507c478bd9Sstevel@tonic-gate 3517c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 3527c478bd9Sstevel@tonic-gate 3537c478bd9Sstevel@tonic-gate /* 3547c478bd9Sstevel@tonic-gate * Kernel's FPU save area 3557c478bd9Sstevel@tonic-gate */ 3567c478bd9Sstevel@tonic-gate typedef struct { 3577c478bd9Sstevel@tonic-gate union _kfpu_u { 3587c478bd9Sstevel@tonic-gate struct fxsave_state kfpu_fx; 3597c478bd9Sstevel@tonic-gate #if defined(__i386) 3607c478bd9Sstevel@tonic-gate struct fnsave_state kfpu_fn; 3617c478bd9Sstevel@tonic-gate #endif 362*7af88ac7SKuriakose Kuruvilla struct xsave_state kfpu_xs; 3637c478bd9Sstevel@tonic-gate } kfpu_u; 3647c478bd9Sstevel@tonic-gate uint32_t kfpu_status; /* saved at #mf exception */ 3657c478bd9Sstevel@tonic-gate uint32_t kfpu_xstatus; /* saved at #xm exception */ 3667c478bd9Sstevel@tonic-gate } kfpu_t; 3677c478bd9Sstevel@tonic-gate 3687c478bd9Sstevel@tonic-gate #if defined(__amd64) 3697c478bd9Sstevel@tonic-gate #define NDEBUGREG 16 3707c478bd9Sstevel@tonic-gate #else 3717c478bd9Sstevel@tonic-gate #define NDEBUGREG 8 3727c478bd9Sstevel@tonic-gate #endif 3737c478bd9Sstevel@tonic-gate 3747c478bd9Sstevel@tonic-gate typedef struct dbregset { 3757c478bd9Sstevel@tonic-gate unsigned long debugreg[NDEBUGREG]; 3767c478bd9Sstevel@tonic-gate } dbregset_t; 3777c478bd9Sstevel@tonic-gate 3787c478bd9Sstevel@tonic-gate /* 3797c478bd9Sstevel@tonic-gate * Structure mcontext defines the complete hardware machine state. 3807c478bd9Sstevel@tonic-gate * (This structure is specified in the i386 ABI suppl.) 3817c478bd9Sstevel@tonic-gate */ 3827c478bd9Sstevel@tonic-gate typedef struct { 3837c478bd9Sstevel@tonic-gate gregset_t gregs; /* general register set */ 3847c478bd9Sstevel@tonic-gate fpregset_t fpregs; /* floating point register set */ 3857c478bd9Sstevel@tonic-gate } mcontext_t; 3867c478bd9Sstevel@tonic-gate 3877c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 3887c478bd9Sstevel@tonic-gate 3897c478bd9Sstevel@tonic-gate typedef struct { 3907c478bd9Sstevel@tonic-gate gregset32_t gregs; /* general register set */ 3917c478bd9Sstevel@tonic-gate fpregset32_t fpregs; /* floating point register set */ 3927c478bd9Sstevel@tonic-gate } mcontext32_t; 3937c478bd9Sstevel@tonic-gate 3947c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 3957c478bd9Sstevel@tonic-gate 3967c478bd9Sstevel@tonic-gate #endif /* _ASM */ 3977c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 3987c478bd9Sstevel@tonic-gate 3997c478bd9Sstevel@tonic-gate /* 4007c478bd9Sstevel@tonic-gate * The version of privregs.h that is used on implementations that run on 4017c478bd9Sstevel@tonic-gate * processors that support the AMD64 instruction set is deliberately not 4027c478bd9Sstevel@tonic-gate * imported here. 4037c478bd9Sstevel@tonic-gate * 4047c478bd9Sstevel@tonic-gate * The amd64 'struct regs' definition may -not- compatible with either 4057c478bd9Sstevel@tonic-gate * 32-bit or 64-bit core file contents, nor with the ucontext. As a result, 4067c478bd9Sstevel@tonic-gate * the 'regs' structure cannot be used portably by applications, and should 4077c478bd9Sstevel@tonic-gate * only be used by the kernel implementation. 4087c478bd9Sstevel@tonic-gate * 4097c478bd9Sstevel@tonic-gate * The inclusion of the i386 version of privregs.h allows for some limited 4107c478bd9Sstevel@tonic-gate * source compatibility with 32-bit applications who expect to use 4117c478bd9Sstevel@tonic-gate * 'struct regs' to match the context of a 32-bit core file, or a ucontext_t. 4127c478bd9Sstevel@tonic-gate * 4137c478bd9Sstevel@tonic-gate * Note that the ucontext_t actually describes the general register in terms 4147c478bd9Sstevel@tonic-gate * of the gregset_t data type, as described in this file. Note also 4157c478bd9Sstevel@tonic-gate * that the core file content is defined by core(4) in terms of data types 4167c478bd9Sstevel@tonic-gate * defined by procfs -- see proc(4). 4177c478bd9Sstevel@tonic-gate */ 4187c478bd9Sstevel@tonic-gate #if defined(__i386) && \ 4197c478bd9Sstevel@tonic-gate (!defined(_KERNEL) && !defined(_XPG4_2) || defined(__EXTENSIONS__)) 4207c478bd9Sstevel@tonic-gate #include <sys/privregs.h> 4217c478bd9Sstevel@tonic-gate #endif /* __i386 (!_KERNEL && !_XPG4_2 || __EXTENSIONS__) */ 4227c478bd9Sstevel@tonic-gate 4237c478bd9Sstevel@tonic-gate /* 4247c478bd9Sstevel@tonic-gate * The following is here for XPG4.2 standards compliance. 4257c478bd9Sstevel@tonic-gate * regset.h is included in ucontext.h for the definition of 4267c478bd9Sstevel@tonic-gate * mcontext_t, all of which breaks XPG4.2 namespace. 4277c478bd9Sstevel@tonic-gate */ 4287c478bd9Sstevel@tonic-gate 4297c478bd9Sstevel@tonic-gate #if defined(_XPG4_2) && !defined(__EXTENSIONS__) && !defined(_ASM) 4307c478bd9Sstevel@tonic-gate 4317c478bd9Sstevel@tonic-gate /* 4327c478bd9Sstevel@tonic-gate * The following is here for UNIX 95 compliance (XPG Issue 4, Version 2 4337c478bd9Sstevel@tonic-gate * System Interfaces and Headers). The structures included here are identical 4347c478bd9Sstevel@tonic-gate * to those visible elsewhere in this header except that the structure 4357c478bd9Sstevel@tonic-gate * element names have been changed in accordance with the X/Open namespace 4367c478bd9Sstevel@tonic-gate * rules. Specifically, depending on the name and scope, the names have 4377c478bd9Sstevel@tonic-gate * been prepended with a single or double underscore (_ or __). See the 4387c478bd9Sstevel@tonic-gate * structure definitions in the non-X/Open namespace for more detailed 4397c478bd9Sstevel@tonic-gate * comments describing each of these structures. 4407c478bd9Sstevel@tonic-gate */ 4417c478bd9Sstevel@tonic-gate 4427c478bd9Sstevel@tonic-gate #if defined(__amd64) 4437c478bd9Sstevel@tonic-gate 4447c478bd9Sstevel@tonic-gate typedef struct __fpu { 4457c478bd9Sstevel@tonic-gate union { 4467c478bd9Sstevel@tonic-gate struct __fpchip_state { 4477c478bd9Sstevel@tonic-gate uint16_t __fx_cw; 4487c478bd9Sstevel@tonic-gate uint16_t __fx_sw; 4497c478bd9Sstevel@tonic-gate uint16_t __fx_ctw; 4507c478bd9Sstevel@tonic-gate uint16_t __fx_op; 4517c478bd9Sstevel@tonic-gate uint64_t __fx_rip; 4527c478bd9Sstevel@tonic-gate uint64_t __fx_rdp; 4537c478bd9Sstevel@tonic-gate uint32_t __fx_mxcsr; 4547c478bd9Sstevel@tonic-gate uint32_t __fx_mxcsr_mask; 4557c478bd9Sstevel@tonic-gate union { 4567c478bd9Sstevel@tonic-gate uint16_t __fpr_16[5]; 4577c478bd9Sstevel@tonic-gate upad128_t __fpr_pad; 4587c478bd9Sstevel@tonic-gate } __fx_st[8]; 4597c478bd9Sstevel@tonic-gate upad128_t __fx_xmm[16]; 4607c478bd9Sstevel@tonic-gate upad128_t __fx_ign2[6]; 4617c478bd9Sstevel@tonic-gate uint32_t __status; 4627c478bd9Sstevel@tonic-gate uint32_t __xstatus; 4637c478bd9Sstevel@tonic-gate } __fpchip_state; 4647c478bd9Sstevel@tonic-gate uint32_t __f_fpregs[130]; 4657c478bd9Sstevel@tonic-gate } __fp_reg_set; 4667c478bd9Sstevel@tonic-gate } fpregset_t; 4677c478bd9Sstevel@tonic-gate 4687c478bd9Sstevel@tonic-gate #else /* __i386 */ 4697c478bd9Sstevel@tonic-gate 4707c478bd9Sstevel@tonic-gate typedef struct __fpu { 4717c478bd9Sstevel@tonic-gate union { 4727c478bd9Sstevel@tonic-gate struct __fpchip_state { 4737c478bd9Sstevel@tonic-gate uint32_t __state[27]; /* 287/387 saved state */ 4747c478bd9Sstevel@tonic-gate uint32_t __status; /* saved at exception */ 4757c478bd9Sstevel@tonic-gate uint32_t __mxcsr; /* SSE control and status */ 4767c478bd9Sstevel@tonic-gate uint32_t __xstatus; /* SSE mxcsr at exception */ 4777c478bd9Sstevel@tonic-gate uint32_t __pad[2]; /* align to 128-bits */ 4787c478bd9Sstevel@tonic-gate upad128_t __xmm[8]; /* %xmm0-%xmm7 */ 4797c478bd9Sstevel@tonic-gate } __fpchip_state; 4807c478bd9Sstevel@tonic-gate struct __fp_emul_space { /* for emulator(s) */ 4817c478bd9Sstevel@tonic-gate uint8_t __fp_emul[246]; 4827c478bd9Sstevel@tonic-gate uint8_t __fp_epad[2]; 4837c478bd9Sstevel@tonic-gate } __fp_emul_space; 4847c478bd9Sstevel@tonic-gate uint32_t __f_fpregs[95]; /* union of the above */ 4857c478bd9Sstevel@tonic-gate } __fp_reg_set; 4867c478bd9Sstevel@tonic-gate } fpregset_t; 4877c478bd9Sstevel@tonic-gate 4887c478bd9Sstevel@tonic-gate #endif /* __i386 */ 4897c478bd9Sstevel@tonic-gate 4907c478bd9Sstevel@tonic-gate typedef struct { 4917c478bd9Sstevel@tonic-gate gregset_t __gregs; /* general register set */ 4927c478bd9Sstevel@tonic-gate fpregset_t __fpregs; /* floating point register set */ 4937c478bd9Sstevel@tonic-gate } mcontext_t; 4947c478bd9Sstevel@tonic-gate 4957c478bd9Sstevel@tonic-gate #endif /* _XPG4_2 && !__EXTENSIONS__ && !_ASM */ 4967c478bd9Sstevel@tonic-gate 4977c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4987c478bd9Sstevel@tonic-gate } 4997c478bd9Sstevel@tonic-gate #endif 5007c478bd9Sstevel@tonic-gate 5017c478bd9Sstevel@tonic-gate #endif /* _SYS_REGSET_H */ 502