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*7a676c83Swroche * Common Development and Distribution License (the "License"). 6*7a676c83Swroche * 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 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 227c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 237c478bd9Sstevel@tonic-gate 247c478bd9Sstevel@tonic-gate 257c478bd9Sstevel@tonic-gate /* 26*7a676c83Swroche * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 277c478bd9Sstevel@tonic-gate * Use is subject to license terms. 287c478bd9Sstevel@tonic-gate */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #ifndef _SYS_REGSET_H 317c478bd9Sstevel@tonic-gate #define _SYS_REGSET_H 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 367c478bd9Sstevel@tonic-gate 377c478bd9Sstevel@tonic-gate #if !defined(_ASM) 387c478bd9Sstevel@tonic-gate #include <sys/int_types.h> 397c478bd9Sstevel@tonic-gate #endif 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate #ifdef __cplusplus 427c478bd9Sstevel@tonic-gate extern "C" { 437c478bd9Sstevel@tonic-gate #endif 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate /* 467c478bd9Sstevel@tonic-gate * Location of the users' stored registers relative to R0. 477c478bd9Sstevel@tonic-gate * Usage is as an index into a gregset_t array or as u.u_ar0[XX]. 487c478bd9Sstevel@tonic-gate */ 497c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 527c478bd9Sstevel@tonic-gate #define REG_CCR (0) 537c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 547c478bd9Sstevel@tonic-gate #define REG_PSR (0) 557c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 567c478bd9Sstevel@tonic-gate #else 577c478bd9Sstevel@tonic-gate #define REG_PSR (0) 587c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate #define REG_PC (1) 617c478bd9Sstevel@tonic-gate #define REG_nPC (2) 627c478bd9Sstevel@tonic-gate #define REG_Y (3) 637c478bd9Sstevel@tonic-gate #define REG_G1 (4) 647c478bd9Sstevel@tonic-gate #define REG_G2 (5) 657c478bd9Sstevel@tonic-gate #define REG_G3 (6) 667c478bd9Sstevel@tonic-gate #define REG_G4 (7) 677c478bd9Sstevel@tonic-gate #define REG_G5 (8) 687c478bd9Sstevel@tonic-gate #define REG_G6 (9) 697c478bd9Sstevel@tonic-gate #define REG_G7 (10) 707c478bd9Sstevel@tonic-gate #define REG_O0 (11) 717c478bd9Sstevel@tonic-gate #define REG_O1 (12) 727c478bd9Sstevel@tonic-gate #define REG_O2 (13) 737c478bd9Sstevel@tonic-gate #define REG_O3 (14) 747c478bd9Sstevel@tonic-gate #define REG_O4 (15) 757c478bd9Sstevel@tonic-gate #define REG_O5 (16) 767c478bd9Sstevel@tonic-gate #define REG_O6 (17) 777c478bd9Sstevel@tonic-gate #define REG_O7 (18) 787c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 797c478bd9Sstevel@tonic-gate #define REG_ASI (19) 807c478bd9Sstevel@tonic-gate #define REG_FPRS (20) 817c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 827c478bd9Sstevel@tonic-gate 837c478bd9Sstevel@tonic-gate /* the following defines are for portability */ 847c478bd9Sstevel@tonic-gate #if !defined(__sparcv9) 857c478bd9Sstevel@tonic-gate #define REG_PS REG_PSR 867c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 877c478bd9Sstevel@tonic-gate #define REG_SP REG_O6 887c478bd9Sstevel@tonic-gate #define REG_R0 REG_O0 897c478bd9Sstevel@tonic-gate #define REG_R1 REG_O1 907c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate /* 937c478bd9Sstevel@tonic-gate * A gregset_t is defined as an array type for compatibility with the reference 947c478bd9Sstevel@tonic-gate * source. This is important due to differences in the way the C language 957c478bd9Sstevel@tonic-gate * treats arrays and structures as parameters. 967c478bd9Sstevel@tonic-gate * 977c478bd9Sstevel@tonic-gate * Note that NGREG is really (sizeof (struct regs) / sizeof (greg_t)), 987c478bd9Sstevel@tonic-gate * but that the SPARC V8 ABI defines it absolutely to be 19. 997c478bd9Sstevel@tonic-gate */ 1007c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 1017c478bd9Sstevel@tonic-gate #define _NGREG 21 1027c478bd9Sstevel@tonic-gate #else /* __sparcv9 */ 1037c478bd9Sstevel@tonic-gate #define _NGREG 19 1047c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 1057c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 1067c478bd9Sstevel@tonic-gate #define NGREG _NGREG 1077c478bd9Sstevel@tonic-gate #endif 1087c478bd9Sstevel@tonic-gate 1097c478bd9Sstevel@tonic-gate #ifndef _ASM 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx) 1127c478bd9Sstevel@tonic-gate typedef long greg_t; 1137c478bd9Sstevel@tonic-gate #else 1147c478bd9Sstevel@tonic-gate typedef int greg_t; 1157c478bd9Sstevel@tonic-gate #endif 1167c478bd9Sstevel@tonic-gate 1177c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate typedef int32_t greg32_t; 1207c478bd9Sstevel@tonic-gate typedef int64_t greg64_t; 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 1237c478bd9Sstevel@tonic-gate 1247c478bd9Sstevel@tonic-gate typedef greg_t gregset_t[_NGREG]; 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate #define _NGREG32 19 1297c478bd9Sstevel@tonic-gate #define _NGREG64 21 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate typedef greg32_t gregset32_t[_NGREG32]; 1327c478bd9Sstevel@tonic-gate typedef greg64_t gregset64_t[_NGREG64]; 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 1357c478bd9Sstevel@tonic-gate 1367c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 1377c478bd9Sstevel@tonic-gate /* 1387c478bd9Sstevel@tonic-gate * The following structures define how a register window can appear on the 1397c478bd9Sstevel@tonic-gate * stack. This structure is available (when required) through the `gwins' 1407c478bd9Sstevel@tonic-gate * field of an mcontext (nested within ucontext). SPARC_MAXWINDOW is the 1417c478bd9Sstevel@tonic-gate * maximum number of outstanding regiters window defined in the SPARC 1427c478bd9Sstevel@tonic-gate * architecture (*not* implementation). 1437c478bd9Sstevel@tonic-gate */ 1447c478bd9Sstevel@tonic-gate #define SPARC_MAXREGWINDOW 31 /* max windows in SPARC arch. */ 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate struct rwindow { 1477c478bd9Sstevel@tonic-gate greg_t rw_local[8]; /* locals */ 1487c478bd9Sstevel@tonic-gate greg_t rw_in[8]; /* ins */ 1497c478bd9Sstevel@tonic-gate }; 1507c478bd9Sstevel@tonic-gate 1517c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate struct rwindow32 { 1547c478bd9Sstevel@tonic-gate greg32_t rw_local[8]; /* locals */ 1557c478bd9Sstevel@tonic-gate greg32_t rw_in[8]; /* ins */ 1567c478bd9Sstevel@tonic-gate }; 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate struct rwindow64 { 1597c478bd9Sstevel@tonic-gate greg64_t rw_local[8]; /* locals */ 1607c478bd9Sstevel@tonic-gate greg64_t rw_in[8]; /* ins */ 1617c478bd9Sstevel@tonic-gate }; 1627c478bd9Sstevel@tonic-gate 1637c478bd9Sstevel@tonic-gate #if defined(_KERNEL) 1647c478bd9Sstevel@tonic-gate extern void rwindow_nto32(struct rwindow *, struct rwindow32 *); 1657c478bd9Sstevel@tonic-gate extern void rwindow_32ton(struct rwindow32 *, struct rwindow *); 1667c478bd9Sstevel@tonic-gate #endif 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate #define rw_fp rw_in[6] /* frame pointer */ 1717c478bd9Sstevel@tonic-gate #define rw_rtn rw_in[7] /* return address */ 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate typedef struct gwindows { 1747c478bd9Sstevel@tonic-gate int wbcnt; 1757c478bd9Sstevel@tonic-gate greg_t *spbuf[SPARC_MAXREGWINDOW]; 1767c478bd9Sstevel@tonic-gate struct rwindow wbuf[SPARC_MAXREGWINDOW]; 1777c478bd9Sstevel@tonic-gate } gwindows_t; 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 1807c478bd9Sstevel@tonic-gate 1817c478bd9Sstevel@tonic-gate typedef struct gwindows32 { 1827c478bd9Sstevel@tonic-gate int32_t wbcnt; 1837c478bd9Sstevel@tonic-gate caddr32_t spbuf[SPARC_MAXREGWINDOW]; 1847c478bd9Sstevel@tonic-gate struct rwindow32 wbuf[SPARC_MAXREGWINDOW]; 1857c478bd9Sstevel@tonic-gate } gwindows32_t; 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate typedef struct gwindows64 { 1887c478bd9Sstevel@tonic-gate int wbcnt; 1897c478bd9Sstevel@tonic-gate greg64_t *spbuf[SPARC_MAXREGWINDOW]; 1907c478bd9Sstevel@tonic-gate struct rwindow64 wbuf[SPARC_MAXREGWINDOW]; 1917c478bd9Sstevel@tonic-gate } gwindows64_t; 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate 1967c478bd9Sstevel@tonic-gate /* 1977c478bd9Sstevel@tonic-gate * Floating point definitions. 1987c478bd9Sstevel@tonic-gate */ 1997c478bd9Sstevel@tonic-gate 2007c478bd9Sstevel@tonic-gate #define MAXFPQ 16 /* max # of fpu queue entries currently supported */ 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate /* 2037c478bd9Sstevel@tonic-gate * struct fq defines the minimal format of a floating point instruction queue 2047c478bd9Sstevel@tonic-gate * entry. The size of entries in the floating point queue are implementation 2057c478bd9Sstevel@tonic-gate * dependent. The union FQu is guarenteed to be the first field in any ABI 2067c478bd9Sstevel@tonic-gate * conformant system implementation. Any additional fields provided by an 2077c478bd9Sstevel@tonic-gate * implementation should not be used applications designed to be ABI conformant. 2087c478bd9Sstevel@tonic-gate */ 2097c478bd9Sstevel@tonic-gate 2107c478bd9Sstevel@tonic-gate struct fpq { 2117c478bd9Sstevel@tonic-gate unsigned int *fpq_addr; /* address */ 2127c478bd9Sstevel@tonic-gate unsigned int fpq_instr; /* instruction */ 2137c478bd9Sstevel@tonic-gate }; 2147c478bd9Sstevel@tonic-gate 2157c478bd9Sstevel@tonic-gate struct fq { 2167c478bd9Sstevel@tonic-gate union { /* FPU inst/addr queue */ 2177c478bd9Sstevel@tonic-gate double whole; 2187c478bd9Sstevel@tonic-gate struct fpq fpq; 2197c478bd9Sstevel@tonic-gate } FQu; 2207c478bd9Sstevel@tonic-gate }; 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 2237c478bd9Sstevel@tonic-gate 2247c478bd9Sstevel@tonic-gate struct fpq32 { 2257c478bd9Sstevel@tonic-gate caddr32_t fpq_addr; /* address */ 2267c478bd9Sstevel@tonic-gate uint32_t fpq_instr; /* instruction */ 2277c478bd9Sstevel@tonic-gate }; 2287c478bd9Sstevel@tonic-gate 2297c478bd9Sstevel@tonic-gate struct fq32 { 2307c478bd9Sstevel@tonic-gate union { /* FPU inst/addr queue */ 2317c478bd9Sstevel@tonic-gate double whole; 2327c478bd9Sstevel@tonic-gate struct fpq32 fpq; 2337c478bd9Sstevel@tonic-gate } FQu; 2347c478bd9Sstevel@tonic-gate }; 2357c478bd9Sstevel@tonic-gate 2367c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 2377c478bd9Sstevel@tonic-gate 2387c478bd9Sstevel@tonic-gate /* 2397c478bd9Sstevel@tonic-gate * struct fpu is the floating point processor state. struct fpu is the sum 2407c478bd9Sstevel@tonic-gate * total of all possible floating point state which includes the state of 2417c478bd9Sstevel@tonic-gate * external floating point hardware, fpa registers, etc..., if it exists. 2427c478bd9Sstevel@tonic-gate * 2437c478bd9Sstevel@tonic-gate * A floating point instuction queue may or may not be associated with 2447c478bd9Sstevel@tonic-gate * the floating point processor state. If a queue does exist, the field 2457c478bd9Sstevel@tonic-gate * fpu_q will point to an array of fpu_qcnt entries where each entry is 2467c478bd9Sstevel@tonic-gate * fpu_q_entrysize long. fpu_q_entry has a lower bound of sizeof (union FQu) 2477c478bd9Sstevel@tonic-gate * and no upper bound. If no floating point queue entries are associated 2487c478bd9Sstevel@tonic-gate * with the processor state, fpu_qcnt will be zeo and fpu_q will be NULL. 2497c478bd9Sstevel@tonic-gate */ 2507c478bd9Sstevel@tonic-gate 2517c478bd9Sstevel@tonic-gate /* 2527c478bd9Sstevel@tonic-gate * The following #define's are obsolete and may be removed in a future release. 2537c478bd9Sstevel@tonic-gate * The corresponding integer types should be used instead (i.e. uint64_t). 2547c478bd9Sstevel@tonic-gate */ 2557c478bd9Sstevel@tonic-gate #define FPU_REGS_TYPE uint32_t 2567c478bd9Sstevel@tonic-gate #define FPU_DREGS_TYPE uint64_t 2577c478bd9Sstevel@tonic-gate #define V7_FPU_FSR_TYPE uint32_t 2587c478bd9Sstevel@tonic-gate #define V9_FPU_FSR_TYPE uint64_t 2597c478bd9Sstevel@tonic-gate #define V9_FPU_FPRS_TYPE uint32_t 2607c478bd9Sstevel@tonic-gate 2617c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 2627c478bd9Sstevel@tonic-gate 2637c478bd9Sstevel@tonic-gate struct fpu { 2647c478bd9Sstevel@tonic-gate union { /* FPU floating point regs */ 2657c478bd9Sstevel@tonic-gate uint32_t fpu_regs[32]; /* 32 singles */ 2667c478bd9Sstevel@tonic-gate double fpu_dregs[32]; /* 32 doubles */ 2677c478bd9Sstevel@tonic-gate long double fpu_qregs[16]; /* 16 quads */ 2687c478bd9Sstevel@tonic-gate } fpu_fr; 2697c478bd9Sstevel@tonic-gate struct fq *fpu_q; /* ptr to array of FQ entries */ 2707c478bd9Sstevel@tonic-gate uint64_t fpu_fsr; /* FPU status register */ 2717c478bd9Sstevel@tonic-gate uint8_t fpu_qcnt; /* # of entries in saved FQ */ 2727c478bd9Sstevel@tonic-gate uint8_t fpu_q_entrysize; /* # of bytes per FQ entry */ 2737c478bd9Sstevel@tonic-gate uint8_t fpu_en; /* flag specifying fpu in use */ 2747c478bd9Sstevel@tonic-gate }; 2757c478bd9Sstevel@tonic-gate 2767c478bd9Sstevel@tonic-gate #else /* __sparcv9 */ 2777c478bd9Sstevel@tonic-gate 2787c478bd9Sstevel@tonic-gate struct fpu { 2797c478bd9Sstevel@tonic-gate union { /* FPU floating point regs */ 2807c478bd9Sstevel@tonic-gate uint32_t fpu_regs[32]; /* 32 singles */ 2817c478bd9Sstevel@tonic-gate double fpu_dregs[16]; /* 16 doubles */ 2827c478bd9Sstevel@tonic-gate } fpu_fr; 2837c478bd9Sstevel@tonic-gate struct fq *fpu_q; /* ptr to array of FQ entries */ 2847c478bd9Sstevel@tonic-gate uint32_t fpu_fsr; /* FPU status register */ 2857c478bd9Sstevel@tonic-gate uint8_t fpu_qcnt; /* # of entries in saved FQ */ 2867c478bd9Sstevel@tonic-gate uint8_t fpu_q_entrysize; /* # of bytes per FQ entry */ 2877c478bd9Sstevel@tonic-gate uint8_t fpu_en; /* flag signifying fpu in use */ 2887c478bd9Sstevel@tonic-gate }; 2897c478bd9Sstevel@tonic-gate 2907c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 2917c478bd9Sstevel@tonic-gate 2927c478bd9Sstevel@tonic-gate typedef struct fpu fpregset_t; 2937c478bd9Sstevel@tonic-gate 2947c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 2957c478bd9Sstevel@tonic-gate 2967c478bd9Sstevel@tonic-gate /* Kernel view of user sparcv7/v8 fpu structure */ 2977c478bd9Sstevel@tonic-gate 2987c478bd9Sstevel@tonic-gate struct fpu32 { 2997c478bd9Sstevel@tonic-gate union { /* FPU floating point regs */ 3007c478bd9Sstevel@tonic-gate uint32_t fpu_regs[32]; /* 32 singles */ 3017c478bd9Sstevel@tonic-gate double fpu_dregs[16]; /* 16 doubles */ 3027c478bd9Sstevel@tonic-gate } fpu_fr; 3037c478bd9Sstevel@tonic-gate caddr32_t fpu_q; /* ptr to array of FQ entries */ 3047c478bd9Sstevel@tonic-gate uint32_t fpu_fsr; /* FPU status register */ 3057c478bd9Sstevel@tonic-gate uint8_t fpu_qcnt; /* # of entries in saved FQ */ 3067c478bd9Sstevel@tonic-gate uint8_t fpu_q_entrysize; /* # of bytes per FQ entry */ 3077c478bd9Sstevel@tonic-gate uint8_t fpu_en; /* flag signifying fpu in use */ 3087c478bd9Sstevel@tonic-gate }; 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gate typedef struct fpu32 fpregset32_t; 3117c478bd9Sstevel@tonic-gate 3127c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 3137c478bd9Sstevel@tonic-gate 314*7a676c83Swroche #if defined(_KERNEL) || defined(_KMDB) 3157c478bd9Sstevel@tonic-gate /* 3167c478bd9Sstevel@tonic-gate * The ABI uses struct fpu, so we use this to describe the kernel's view of the 3177c478bd9Sstevel@tonic-gate * fpu. 3187c478bd9Sstevel@tonic-gate */ 3197c478bd9Sstevel@tonic-gate typedef struct { 3207c478bd9Sstevel@tonic-gate union _fpu_fr { /* V9 FPU floating point regs */ 3217c478bd9Sstevel@tonic-gate uint32_t fpu_regs[32]; /* 32 singles */ 3227c478bd9Sstevel@tonic-gate uint64_t fpu_dregs[32]; /* 32 doubles */ 3237c478bd9Sstevel@tonic-gate long double fpu_qregs[16]; /* 16 quads */ 3247c478bd9Sstevel@tonic-gate } fpu_fr; 3257c478bd9Sstevel@tonic-gate uint64_t fpu_fsr; /* FPU status register */ 3267c478bd9Sstevel@tonic-gate uint32_t fpu_fprs; /* fprs register */ 3277c478bd9Sstevel@tonic-gate struct fq *fpu_q; 3287c478bd9Sstevel@tonic-gate uint8_t fpu_qcnt; 3297c478bd9Sstevel@tonic-gate uint8_t fpu_q_entrysize; 3307c478bd9Sstevel@tonic-gate uint8_t fpu_en; /* flag signifying fpu in use */ 3317c478bd9Sstevel@tonic-gate } kfpu_t; 332*7a676c83Swroche #endif /* _KERNEL || _KMDB */ 3337c478bd9Sstevel@tonic-gate 3347c478bd9Sstevel@tonic-gate /* 3357c478bd9Sstevel@tonic-gate * The following structure is for associating extra register state with 3367c478bd9Sstevel@tonic-gate * the ucontext structure and is kept within the uc_mcontext filler area. 3377c478bd9Sstevel@tonic-gate * 3387c478bd9Sstevel@tonic-gate * If (xrs_id == XRS_ID) then the xrs_ptr field is a valid pointer to 3397c478bd9Sstevel@tonic-gate * extra register state. The exact format of the extra register state 3407c478bd9Sstevel@tonic-gate * pointed to by xrs_ptr is platform-dependent. 3417c478bd9Sstevel@tonic-gate * 3427c478bd9Sstevel@tonic-gate * Note: a platform may or may not manage extra register state. 3437c478bd9Sstevel@tonic-gate */ 3447c478bd9Sstevel@tonic-gate typedef struct { 3457c478bd9Sstevel@tonic-gate unsigned int xrs_id; /* indicates xrs_ptr validity */ 3467c478bd9Sstevel@tonic-gate caddr_t xrs_ptr; /* ptr to extra reg state */ 3477c478bd9Sstevel@tonic-gate } xrs_t; 3487c478bd9Sstevel@tonic-gate 3497c478bd9Sstevel@tonic-gate #define XRS_ID 0x78727300 /* the string "xrs" */ 3507c478bd9Sstevel@tonic-gate 3517c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 3527c478bd9Sstevel@tonic-gate 3537c478bd9Sstevel@tonic-gate typedef struct { 3547c478bd9Sstevel@tonic-gate uint32_t xrs_id; /* indicates xrs_ptr validity */ 3557c478bd9Sstevel@tonic-gate caddr32_t xrs_ptr; /* ptr to extra reg state */ 3567c478bd9Sstevel@tonic-gate } xrs32_t; 3577c478bd9Sstevel@tonic-gate 3587c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 3597c478bd9Sstevel@tonic-gate 3607c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 3617c478bd9Sstevel@tonic-gate 3627c478bd9Sstevel@tonic-gate /* 3637c478bd9Sstevel@tonic-gate * Ancillary State Registers 3647c478bd9Sstevel@tonic-gate * 3657c478bd9Sstevel@tonic-gate * The SPARC V9 architecture defines 25 ASRs, numbered from 7 through 31. 3667c478bd9Sstevel@tonic-gate * ASRs 16 through 31 are available to user programs, though the meaning 3677c478bd9Sstevel@tonic-gate * and content of these registers is implementation dependent. 3687c478bd9Sstevel@tonic-gate */ 3697c478bd9Sstevel@tonic-gate typedef int64_t asrset_t[16]; /* %asr16 - > %asr31 */ 3707c478bd9Sstevel@tonic-gate 3717c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 3727c478bd9Sstevel@tonic-gate 3737c478bd9Sstevel@tonic-gate /* 3747c478bd9Sstevel@tonic-gate * Structure mcontext defines the complete hardware machine state. If 3757c478bd9Sstevel@tonic-gate * the field `gwins' is non NULL, it points to a save area for register 3767c478bd9Sstevel@tonic-gate * window frames. If `gwins' is NULL, the register windows were saved 3777c478bd9Sstevel@tonic-gate * on the user's stack. 3787c478bd9Sstevel@tonic-gate * 3797c478bd9Sstevel@tonic-gate * The filler of 21 longs is historical (now filler[19] plus the xrs_t 3807c478bd9Sstevel@tonic-gate * field). The value was selected to provide binary compatibility with 3817c478bd9Sstevel@tonic-gate * statically linked ICL binaries. It is in the ABI (do not change). It 3827c478bd9Sstevel@tonic-gate * actually appears in the ABI as a single filler of 44 is in the field 3837c478bd9Sstevel@tonic-gate * uc_filler of struct ucontext. It is split here so that ucontext.h can 3847c478bd9Sstevel@tonic-gate * (hopefully) remain architecture independent. 3857c478bd9Sstevel@tonic-gate * 3867c478bd9Sstevel@tonic-gate * Note that 2 longs of the filler are used to hold extra register state info. 3877c478bd9Sstevel@tonic-gate */ 3887c478bd9Sstevel@tonic-gate typedef struct { 3897c478bd9Sstevel@tonic-gate gregset_t gregs; /* general register set */ 3907c478bd9Sstevel@tonic-gate gwindows_t *gwins; /* POSSIBLE pointer to register windows */ 3917c478bd9Sstevel@tonic-gate fpregset_t fpregs; /* floating point register set */ 3927c478bd9Sstevel@tonic-gate xrs_t xrs; /* POSSIBLE extra register state association */ 3937c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 3947c478bd9Sstevel@tonic-gate asrset_t asrs; /* ancillary registers */ 3957c478bd9Sstevel@tonic-gate long filler[4]; /* room for expansion */ 3967c478bd9Sstevel@tonic-gate #else /* __sparcv9 */ 3977c478bd9Sstevel@tonic-gate long filler[19]; 3987c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 3997c478bd9Sstevel@tonic-gate } mcontext_t; 4007c478bd9Sstevel@tonic-gate 4017c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 4027c478bd9Sstevel@tonic-gate 4037c478bd9Sstevel@tonic-gate typedef struct { 4047c478bd9Sstevel@tonic-gate gregset32_t gregs; /* general register set */ 4057c478bd9Sstevel@tonic-gate caddr32_t gwins; /* POSSIBLE pointer to register windows */ 4067c478bd9Sstevel@tonic-gate fpregset32_t fpregs; /* floating point register set */ 4077c478bd9Sstevel@tonic-gate xrs32_t xrs; /* POSSIBLE extra register state association */ 4087c478bd9Sstevel@tonic-gate int32_t filler[19]; 4097c478bd9Sstevel@tonic-gate } mcontext32_t; 4107c478bd9Sstevel@tonic-gate 4117c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 4127c478bd9Sstevel@tonic-gate 4137c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 4147c478bd9Sstevel@tonic-gate #endif /* _ASM */ 4157c478bd9Sstevel@tonic-gate 4167c478bd9Sstevel@tonic-gate /* 4177c478bd9Sstevel@tonic-gate * The version of privregs.h that is used on implementations that run 4187c478bd9Sstevel@tonic-gate * on processors that support the V9 instruction set is deliberately not 4197c478bd9Sstevel@tonic-gate * imported here. 4207c478bd9Sstevel@tonic-gate * 4217c478bd9Sstevel@tonic-gate * The V9 'struct regs' definition is -not- compatible with either 32-bit 4227c478bd9Sstevel@tonic-gate * or 64-bit core file contents, nor with the ucontext. As a result, the 4237c478bd9Sstevel@tonic-gate * 'regs' structure cannot be used portably by applications, and should 4247c478bd9Sstevel@tonic-gate * only be used by the kernel implementation. 4257c478bd9Sstevel@tonic-gate * 4267c478bd9Sstevel@tonic-gate * The inclusion of the SPARC V7 version of privregs.h allows for some 4277c478bd9Sstevel@tonic-gate * limited source compatibility with 32-bit applications who expect to use 4287c478bd9Sstevel@tonic-gate * 'struct regs' to match the content of a 32-bit core file, or a ucontext_t. 4297c478bd9Sstevel@tonic-gate * 4307c478bd9Sstevel@tonic-gate * Note that the ucontext_t actually describes the general registers in 4317c478bd9Sstevel@tonic-gate * terms of the gregset_t data type, as described in this file. Note also 4327c478bd9Sstevel@tonic-gate * that the core file content is defined by core(4) in terms of data types 4337c478bd9Sstevel@tonic-gate * defined by procfs -- see proc(4). 4347c478bd9Sstevel@tonic-gate */ 4357c478bd9Sstevel@tonic-gate #if !defined(__sparcv9) 4367c478bd9Sstevel@tonic-gate #if !defined(_KERNEL) && !defined(_XPG4_2) || defined(__EXTENSIONS__) 4377c478bd9Sstevel@tonic-gate #include <v7/sys/privregs.h> 4387c478bd9Sstevel@tonic-gate #endif /* !_KERNEL && !_XPG4_2 || __EXTENSIONS__ */ 4397c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 4407c478bd9Sstevel@tonic-gate 4417c478bd9Sstevel@tonic-gate /* 4427c478bd9Sstevel@tonic-gate * The following is here for XPG4.2 standards compliance. 4437c478bd9Sstevel@tonic-gate * regset.h is included in ucontext.h for the definition of 4447c478bd9Sstevel@tonic-gate * mcontext_t, all of which breaks XPG4.2 namespace. 4457c478bd9Sstevel@tonic-gate */ 4467c478bd9Sstevel@tonic-gate 4477c478bd9Sstevel@tonic-gate #if defined(_XPG4_2) && !defined(__EXTENSIONS__) 4487c478bd9Sstevel@tonic-gate /* 4497c478bd9Sstevel@tonic-gate * The following is here for UNIX 95 compliance (XPG Issue 4, Version 2 4507c478bd9Sstevel@tonic-gate * System Interfaces and Headers. The structures included here are identical 4517c478bd9Sstevel@tonic-gate * to those visible elsewhere in this header except that the structure 4527c478bd9Sstevel@tonic-gate * element names have been changed in accordance with the X/Open namespace 4537c478bd9Sstevel@tonic-gate * rules. Specifically, depending on the name and scope, the names have 4547c478bd9Sstevel@tonic-gate * been prepended with a single or double underscore (_ or __). See the 4557c478bd9Sstevel@tonic-gate * structure definitions in the non-X/Open namespace for more detailed 4567c478bd9Sstevel@tonic-gate * comments describing each of these structures. 4577c478bd9Sstevel@tonic-gate */ 4587c478bd9Sstevel@tonic-gate 4597c478bd9Sstevel@tonic-gate #ifndef _ASM 4607c478bd9Sstevel@tonic-gate 4617c478bd9Sstevel@tonic-gate /* 4627c478bd9Sstevel@tonic-gate * The following structures define how a register window can appear on the 4637c478bd9Sstevel@tonic-gate * stack. 4647c478bd9Sstevel@tonic-gate */ 4657c478bd9Sstevel@tonic-gate #define _SPARC_MAXREGWINDOW 31 /* max windows in SPARC arch. */ 4667c478bd9Sstevel@tonic-gate 4677c478bd9Sstevel@tonic-gate struct __rwindow { 4687c478bd9Sstevel@tonic-gate greg_t __rw_local[8]; /* locals */ 4697c478bd9Sstevel@tonic-gate greg_t __rw_in[8]; /* ins */ 4707c478bd9Sstevel@tonic-gate }; 4717c478bd9Sstevel@tonic-gate 4727c478bd9Sstevel@tonic-gate #define __rw_fp __rw_in[6] /* frame pointer */ 4737c478bd9Sstevel@tonic-gate #define __rw_rtn __rw_in[7] /* return address */ 4747c478bd9Sstevel@tonic-gate 4757c478bd9Sstevel@tonic-gate struct __gwindows { 4767c478bd9Sstevel@tonic-gate int __wbcnt; 4777c478bd9Sstevel@tonic-gate greg_t *__spbuf[_SPARC_MAXREGWINDOW]; 4787c478bd9Sstevel@tonic-gate struct __rwindow __wbuf[_SPARC_MAXREGWINDOW]; 4797c478bd9Sstevel@tonic-gate }; 4807c478bd9Sstevel@tonic-gate 4817c478bd9Sstevel@tonic-gate typedef struct __gwindows gwindows_t; 4827c478bd9Sstevel@tonic-gate 4837c478bd9Sstevel@tonic-gate /* 4847c478bd9Sstevel@tonic-gate * The fq structure defines the minimal format of a floating point 4857c478bd9Sstevel@tonic-gate * instruction queue entry. 4867c478bd9Sstevel@tonic-gate */ 4877c478bd9Sstevel@tonic-gate 4887c478bd9Sstevel@tonic-gate struct __fpq { 4897c478bd9Sstevel@tonic-gate unsigned int *__fpq_addr; /* address */ 4907c478bd9Sstevel@tonic-gate unsigned int __fpq_instr; /* instruction */ 4917c478bd9Sstevel@tonic-gate }; 4927c478bd9Sstevel@tonic-gate 4937c478bd9Sstevel@tonic-gate struct __fq { 4947c478bd9Sstevel@tonic-gate union { /* FPU inst/addr queue */ 4957c478bd9Sstevel@tonic-gate double __whole; 4967c478bd9Sstevel@tonic-gate struct __fpq __fpq; 4977c478bd9Sstevel@tonic-gate } _FQu; 4987c478bd9Sstevel@tonic-gate }; 4997c478bd9Sstevel@tonic-gate 5007c478bd9Sstevel@tonic-gate /* 5017c478bd9Sstevel@tonic-gate * The fpu structure is the floating point processor state. 5027c478bd9Sstevel@tonic-gate */ 5037c478bd9Sstevel@tonic-gate 5047c478bd9Sstevel@tonic-gate /* 5057c478bd9Sstevel@tonic-gate * The following #define's are obsolete and may be removed in a future release. 5067c478bd9Sstevel@tonic-gate * The corresponding integer types should be used instead (i.e. uint64_t). 5077c478bd9Sstevel@tonic-gate */ 5087c478bd9Sstevel@tonic-gate #define _FPU_REGS_TYPE uint32_t 5097c478bd9Sstevel@tonic-gate #define _FPU_DREGS_TYPE uint64_t 5107c478bd9Sstevel@tonic-gate #define _V7_FPU_FSR_TYPE uint32_t 5117c478bd9Sstevel@tonic-gate #define _V9_FPU_FSR_TYPE uint64_t 5127c478bd9Sstevel@tonic-gate #define _V9_FPU_FPRS_TYPE uint32_t 5137c478bd9Sstevel@tonic-gate 5147c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 5157c478bd9Sstevel@tonic-gate 5167c478bd9Sstevel@tonic-gate /* 5177c478bd9Sstevel@tonic-gate * SPARC Version 9 floating point 5187c478bd9Sstevel@tonic-gate */ 5197c478bd9Sstevel@tonic-gate 5207c478bd9Sstevel@tonic-gate struct __fpu { 5217c478bd9Sstevel@tonic-gate union { /* FPU floating point regs */ 5227c478bd9Sstevel@tonic-gate uint32_t __fpu_regs[32]; /* 32 singles */ 5237c478bd9Sstevel@tonic-gate double __fpu_dregs[32]; /* 32 doubles */ 5247c478bd9Sstevel@tonic-gate long double __fpu_qregs[16]; /* 16 quads */ 5257c478bd9Sstevel@tonic-gate } __fpu_fr; 5267c478bd9Sstevel@tonic-gate struct __fq *__fpu_q; /* ptr to array of FQ entries */ 5277c478bd9Sstevel@tonic-gate uint64_t __fpu_fsr; /* FPU status register */ 5287c478bd9Sstevel@tonic-gate uint8_t __fpu_qcnt; /* # of entries in saved FQ */ 5297c478bd9Sstevel@tonic-gate uint8_t __fpu_q_entrysize; /* # of bytes per FQ entry */ 5307c478bd9Sstevel@tonic-gate uint8_t __fpu_en; /* flag signifying fpu in use */ 5317c478bd9Sstevel@tonic-gate }; 5327c478bd9Sstevel@tonic-gate 5337c478bd9Sstevel@tonic-gate #else /* __sparcv9 */ 5347c478bd9Sstevel@tonic-gate 5357c478bd9Sstevel@tonic-gate /* 5367c478bd9Sstevel@tonic-gate * SPARC Version 7 and 8 floating point 5377c478bd9Sstevel@tonic-gate */ 5387c478bd9Sstevel@tonic-gate 5397c478bd9Sstevel@tonic-gate struct __fpu { 5407c478bd9Sstevel@tonic-gate union { /* FPU floating point regs */ 5417c478bd9Sstevel@tonic-gate uint32_t __fpu_regs[32]; /* 32 singles */ 5427c478bd9Sstevel@tonic-gate double __fpu_dregs[16]; /* 16 doubles */ 5437c478bd9Sstevel@tonic-gate } __fpu_fr; 5447c478bd9Sstevel@tonic-gate struct __fq *__fpu_q; /* ptr to array of FQ entries */ 5457c478bd9Sstevel@tonic-gate uint32_t __fpu_fsr; /* FPU status register */ 5467c478bd9Sstevel@tonic-gate uint8_t __fpu_qcnt; /* # of entries in saved FQ */ 5477c478bd9Sstevel@tonic-gate uint8_t __fpu_q_entrysize; /* # of bytes per FQ entry */ 5487c478bd9Sstevel@tonic-gate uint8_t __fpu_en; /* flag signifying fpu in use */ 5497c478bd9Sstevel@tonic-gate }; 5507c478bd9Sstevel@tonic-gate 5517c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 5527c478bd9Sstevel@tonic-gate 5537c478bd9Sstevel@tonic-gate typedef struct __fpu fpregset_t; 5547c478bd9Sstevel@tonic-gate 5557c478bd9Sstevel@tonic-gate /* 5567c478bd9Sstevel@tonic-gate * The xrs_t structure is for associating extra register state with 5577c478bd9Sstevel@tonic-gate * the ucontext structure and is kept within the uc_mcontext filler area. 5587c478bd9Sstevel@tonic-gate */ 5597c478bd9Sstevel@tonic-gate typedef struct { 5607c478bd9Sstevel@tonic-gate unsigned int __xrs_id; /* indicates xrs_ptr validity */ 5617c478bd9Sstevel@tonic-gate caddr_t __xrs_ptr; /* ptr to extra reg state */ 5627c478bd9Sstevel@tonic-gate } xrs_t; 5637c478bd9Sstevel@tonic-gate 5647c478bd9Sstevel@tonic-gate #define _XRS_ID 0x78727300 /* the string "xrs" */ 5657c478bd9Sstevel@tonic-gate 5667c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 5677c478bd9Sstevel@tonic-gate 5687c478bd9Sstevel@tonic-gate /* 5697c478bd9Sstevel@tonic-gate * Ancillary State Registers 5707c478bd9Sstevel@tonic-gate * 5717c478bd9Sstevel@tonic-gate * The SPARC V9 architecture defines 25 ASRs, numbered from 7 through 31. 5727c478bd9Sstevel@tonic-gate * ASRs 16 through 31 are available to user programs, though the meaning 5737c478bd9Sstevel@tonic-gate * and content of these registers is implementation dependent. 5747c478bd9Sstevel@tonic-gate */ 5757c478bd9Sstevel@tonic-gate typedef int64_t asrset_t[16]; /* %asr16 - > %asr31 */ 5767c478bd9Sstevel@tonic-gate 5777c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 5787c478bd9Sstevel@tonic-gate 5797c478bd9Sstevel@tonic-gate /* 5807c478bd9Sstevel@tonic-gate * Structure mcontext defines the complete hardware machine state. 5817c478bd9Sstevel@tonic-gate */ 5827c478bd9Sstevel@tonic-gate typedef struct { 5837c478bd9Sstevel@tonic-gate gregset_t __gregs; /* general register set */ 5847c478bd9Sstevel@tonic-gate gwindows_t *__gwins; /* POSSIBLE pointer to register windows */ 5857c478bd9Sstevel@tonic-gate fpregset_t __fpregs; /* floating point register set */ 5867c478bd9Sstevel@tonic-gate xrs_t __xrs; /* POSSIBLE extra register state association */ 5877c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 5887c478bd9Sstevel@tonic-gate asrset_t __asrs; /* ancillary registers */ 5897c478bd9Sstevel@tonic-gate long __filler[4]; /* room for expansion */ 5907c478bd9Sstevel@tonic-gate #else /* __sparcv9 */ 5917c478bd9Sstevel@tonic-gate long __filler[19]; 5927c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 5937c478bd9Sstevel@tonic-gate } mcontext_t; 5947c478bd9Sstevel@tonic-gate 5957c478bd9Sstevel@tonic-gate #endif /* _ASM */ 5967c478bd9Sstevel@tonic-gate #endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */ 5977c478bd9Sstevel@tonic-gate 5987c478bd9Sstevel@tonic-gate 5997c478bd9Sstevel@tonic-gate #ifdef __cplusplus 6007c478bd9Sstevel@tonic-gate } 6017c478bd9Sstevel@tonic-gate #endif 6027c478bd9Sstevel@tonic-gate 6037c478bd9Sstevel@tonic-gate #endif /* _SYS_REGSET_H */ 604