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 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 23*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 24*7c478bd9Sstevel@tonic-gate 25*7c478bd9Sstevel@tonic-gate 26*7c478bd9Sstevel@tonic-gate /* 27*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 28*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 29*7c478bd9Sstevel@tonic-gate */ 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate #ifndef _SYS_REGSET_H 32*7c478bd9Sstevel@tonic-gate #define _SYS_REGSET_H 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.1 */ 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 37*7c478bd9Sstevel@tonic-gate 38*7c478bd9Sstevel@tonic-gate #if !defined(_ASM) 39*7c478bd9Sstevel@tonic-gate #include <sys/int_types.h> 40*7c478bd9Sstevel@tonic-gate #endif 41*7c478bd9Sstevel@tonic-gate 42*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 43*7c478bd9Sstevel@tonic-gate extern "C" { 44*7c478bd9Sstevel@tonic-gate #endif 45*7c478bd9Sstevel@tonic-gate 46*7c478bd9Sstevel@tonic-gate /* 47*7c478bd9Sstevel@tonic-gate * Location of the users' stored registers relative to R0. 48*7c478bd9Sstevel@tonic-gate * Usage is as an index into a gregset_t array or as u.u_ar0[XX]. 49*7c478bd9Sstevel@tonic-gate */ 50*7c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 51*7c478bd9Sstevel@tonic-gate 52*7c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 53*7c478bd9Sstevel@tonic-gate #define REG_CCR (0) 54*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 55*7c478bd9Sstevel@tonic-gate #define REG_PSR (0) 56*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 57*7c478bd9Sstevel@tonic-gate #else 58*7c478bd9Sstevel@tonic-gate #define REG_PSR (0) 59*7c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 60*7c478bd9Sstevel@tonic-gate 61*7c478bd9Sstevel@tonic-gate #define REG_PC (1) 62*7c478bd9Sstevel@tonic-gate #define REG_nPC (2) 63*7c478bd9Sstevel@tonic-gate #define REG_Y (3) 64*7c478bd9Sstevel@tonic-gate #define REG_G1 (4) 65*7c478bd9Sstevel@tonic-gate #define REG_G2 (5) 66*7c478bd9Sstevel@tonic-gate #define REG_G3 (6) 67*7c478bd9Sstevel@tonic-gate #define REG_G4 (7) 68*7c478bd9Sstevel@tonic-gate #define REG_G5 (8) 69*7c478bd9Sstevel@tonic-gate #define REG_G6 (9) 70*7c478bd9Sstevel@tonic-gate #define REG_G7 (10) 71*7c478bd9Sstevel@tonic-gate #define REG_O0 (11) 72*7c478bd9Sstevel@tonic-gate #define REG_O1 (12) 73*7c478bd9Sstevel@tonic-gate #define REG_O2 (13) 74*7c478bd9Sstevel@tonic-gate #define REG_O3 (14) 75*7c478bd9Sstevel@tonic-gate #define REG_O4 (15) 76*7c478bd9Sstevel@tonic-gate #define REG_O5 (16) 77*7c478bd9Sstevel@tonic-gate #define REG_O6 (17) 78*7c478bd9Sstevel@tonic-gate #define REG_O7 (18) 79*7c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 80*7c478bd9Sstevel@tonic-gate #define REG_ASI (19) 81*7c478bd9Sstevel@tonic-gate #define REG_FPRS (20) 82*7c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate /* the following defines are for portability */ 85*7c478bd9Sstevel@tonic-gate #if !defined(__sparcv9) 86*7c478bd9Sstevel@tonic-gate #define REG_PS REG_PSR 87*7c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 88*7c478bd9Sstevel@tonic-gate #define REG_SP REG_O6 89*7c478bd9Sstevel@tonic-gate #define REG_R0 REG_O0 90*7c478bd9Sstevel@tonic-gate #define REG_R1 REG_O1 91*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 92*7c478bd9Sstevel@tonic-gate 93*7c478bd9Sstevel@tonic-gate /* 94*7c478bd9Sstevel@tonic-gate * A gregset_t is defined as an array type for compatibility with the reference 95*7c478bd9Sstevel@tonic-gate * source. This is important due to differences in the way the C language 96*7c478bd9Sstevel@tonic-gate * treats arrays and structures as parameters. 97*7c478bd9Sstevel@tonic-gate * 98*7c478bd9Sstevel@tonic-gate * Note that NGREG is really (sizeof (struct regs) / sizeof (greg_t)), 99*7c478bd9Sstevel@tonic-gate * but that the SPARC V8 ABI defines it absolutely to be 19. 100*7c478bd9Sstevel@tonic-gate */ 101*7c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 102*7c478bd9Sstevel@tonic-gate #define _NGREG 21 103*7c478bd9Sstevel@tonic-gate #else /* __sparcv9 */ 104*7c478bd9Sstevel@tonic-gate #define _NGREG 19 105*7c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 106*7c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 107*7c478bd9Sstevel@tonic-gate #define NGREG _NGREG 108*7c478bd9Sstevel@tonic-gate #endif 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate #ifndef _ASM 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate #if defined(_LP64) || defined(_I32LPx) 113*7c478bd9Sstevel@tonic-gate typedef long greg_t; 114*7c478bd9Sstevel@tonic-gate #else 115*7c478bd9Sstevel@tonic-gate typedef int greg_t; 116*7c478bd9Sstevel@tonic-gate #endif 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gate typedef int32_t greg32_t; 121*7c478bd9Sstevel@tonic-gate typedef int64_t greg64_t; 122*7c478bd9Sstevel@tonic-gate 123*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 124*7c478bd9Sstevel@tonic-gate 125*7c478bd9Sstevel@tonic-gate typedef greg_t gregset_t[_NGREG]; 126*7c478bd9Sstevel@tonic-gate 127*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 128*7c478bd9Sstevel@tonic-gate 129*7c478bd9Sstevel@tonic-gate #define _NGREG32 19 130*7c478bd9Sstevel@tonic-gate #define _NGREG64 21 131*7c478bd9Sstevel@tonic-gate 132*7c478bd9Sstevel@tonic-gate typedef greg32_t gregset32_t[_NGREG32]; 133*7c478bd9Sstevel@tonic-gate typedef greg64_t gregset64_t[_NGREG64]; 134*7c478bd9Sstevel@tonic-gate 135*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 136*7c478bd9Sstevel@tonic-gate 137*7c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 138*7c478bd9Sstevel@tonic-gate /* 139*7c478bd9Sstevel@tonic-gate * The following structures define how a register window can appear on the 140*7c478bd9Sstevel@tonic-gate * stack. This structure is available (when required) through the `gwins' 141*7c478bd9Sstevel@tonic-gate * field of an mcontext (nested within ucontext). SPARC_MAXWINDOW is the 142*7c478bd9Sstevel@tonic-gate * maximum number of outstanding regiters window defined in the SPARC 143*7c478bd9Sstevel@tonic-gate * architecture (*not* implementation). 144*7c478bd9Sstevel@tonic-gate */ 145*7c478bd9Sstevel@tonic-gate #define SPARC_MAXREGWINDOW 31 /* max windows in SPARC arch. */ 146*7c478bd9Sstevel@tonic-gate 147*7c478bd9Sstevel@tonic-gate struct rwindow { 148*7c478bd9Sstevel@tonic-gate greg_t rw_local[8]; /* locals */ 149*7c478bd9Sstevel@tonic-gate greg_t rw_in[8]; /* ins */ 150*7c478bd9Sstevel@tonic-gate }; 151*7c478bd9Sstevel@tonic-gate 152*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 153*7c478bd9Sstevel@tonic-gate 154*7c478bd9Sstevel@tonic-gate struct rwindow32 { 155*7c478bd9Sstevel@tonic-gate greg32_t rw_local[8]; /* locals */ 156*7c478bd9Sstevel@tonic-gate greg32_t rw_in[8]; /* ins */ 157*7c478bd9Sstevel@tonic-gate }; 158*7c478bd9Sstevel@tonic-gate 159*7c478bd9Sstevel@tonic-gate struct rwindow64 { 160*7c478bd9Sstevel@tonic-gate greg64_t rw_local[8]; /* locals */ 161*7c478bd9Sstevel@tonic-gate greg64_t rw_in[8]; /* ins */ 162*7c478bd9Sstevel@tonic-gate }; 163*7c478bd9Sstevel@tonic-gate 164*7c478bd9Sstevel@tonic-gate #if defined(_KERNEL) 165*7c478bd9Sstevel@tonic-gate extern void rwindow_nto32(struct rwindow *, struct rwindow32 *); 166*7c478bd9Sstevel@tonic-gate extern void rwindow_32ton(struct rwindow32 *, struct rwindow *); 167*7c478bd9Sstevel@tonic-gate #endif 168*7c478bd9Sstevel@tonic-gate 169*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 170*7c478bd9Sstevel@tonic-gate 171*7c478bd9Sstevel@tonic-gate #define rw_fp rw_in[6] /* frame pointer */ 172*7c478bd9Sstevel@tonic-gate #define rw_rtn rw_in[7] /* return address */ 173*7c478bd9Sstevel@tonic-gate 174*7c478bd9Sstevel@tonic-gate typedef struct gwindows { 175*7c478bd9Sstevel@tonic-gate int wbcnt; 176*7c478bd9Sstevel@tonic-gate greg_t *spbuf[SPARC_MAXREGWINDOW]; 177*7c478bd9Sstevel@tonic-gate struct rwindow wbuf[SPARC_MAXREGWINDOW]; 178*7c478bd9Sstevel@tonic-gate } gwindows_t; 179*7c478bd9Sstevel@tonic-gate 180*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 181*7c478bd9Sstevel@tonic-gate 182*7c478bd9Sstevel@tonic-gate typedef struct gwindows32 { 183*7c478bd9Sstevel@tonic-gate int32_t wbcnt; 184*7c478bd9Sstevel@tonic-gate caddr32_t spbuf[SPARC_MAXREGWINDOW]; 185*7c478bd9Sstevel@tonic-gate struct rwindow32 wbuf[SPARC_MAXREGWINDOW]; 186*7c478bd9Sstevel@tonic-gate } gwindows32_t; 187*7c478bd9Sstevel@tonic-gate 188*7c478bd9Sstevel@tonic-gate typedef struct gwindows64 { 189*7c478bd9Sstevel@tonic-gate int wbcnt; 190*7c478bd9Sstevel@tonic-gate greg64_t *spbuf[SPARC_MAXREGWINDOW]; 191*7c478bd9Sstevel@tonic-gate struct rwindow64 wbuf[SPARC_MAXREGWINDOW]; 192*7c478bd9Sstevel@tonic-gate } gwindows64_t; 193*7c478bd9Sstevel@tonic-gate 194*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 195*7c478bd9Sstevel@tonic-gate 196*7c478bd9Sstevel@tonic-gate 197*7c478bd9Sstevel@tonic-gate /* 198*7c478bd9Sstevel@tonic-gate * Floating point definitions. 199*7c478bd9Sstevel@tonic-gate */ 200*7c478bd9Sstevel@tonic-gate 201*7c478bd9Sstevel@tonic-gate #define MAXFPQ 16 /* max # of fpu queue entries currently supported */ 202*7c478bd9Sstevel@tonic-gate 203*7c478bd9Sstevel@tonic-gate /* 204*7c478bd9Sstevel@tonic-gate * struct fq defines the minimal format of a floating point instruction queue 205*7c478bd9Sstevel@tonic-gate * entry. The size of entries in the floating point queue are implementation 206*7c478bd9Sstevel@tonic-gate * dependent. The union FQu is guarenteed to be the first field in any ABI 207*7c478bd9Sstevel@tonic-gate * conformant system implementation. Any additional fields provided by an 208*7c478bd9Sstevel@tonic-gate * implementation should not be used applications designed to be ABI conformant. 209*7c478bd9Sstevel@tonic-gate */ 210*7c478bd9Sstevel@tonic-gate 211*7c478bd9Sstevel@tonic-gate struct fpq { 212*7c478bd9Sstevel@tonic-gate unsigned int *fpq_addr; /* address */ 213*7c478bd9Sstevel@tonic-gate unsigned int fpq_instr; /* instruction */ 214*7c478bd9Sstevel@tonic-gate }; 215*7c478bd9Sstevel@tonic-gate 216*7c478bd9Sstevel@tonic-gate struct fq { 217*7c478bd9Sstevel@tonic-gate union { /* FPU inst/addr queue */ 218*7c478bd9Sstevel@tonic-gate double whole; 219*7c478bd9Sstevel@tonic-gate struct fpq fpq; 220*7c478bd9Sstevel@tonic-gate } FQu; 221*7c478bd9Sstevel@tonic-gate }; 222*7c478bd9Sstevel@tonic-gate 223*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 224*7c478bd9Sstevel@tonic-gate 225*7c478bd9Sstevel@tonic-gate struct fpq32 { 226*7c478bd9Sstevel@tonic-gate caddr32_t fpq_addr; /* address */ 227*7c478bd9Sstevel@tonic-gate uint32_t fpq_instr; /* instruction */ 228*7c478bd9Sstevel@tonic-gate }; 229*7c478bd9Sstevel@tonic-gate 230*7c478bd9Sstevel@tonic-gate struct fq32 { 231*7c478bd9Sstevel@tonic-gate union { /* FPU inst/addr queue */ 232*7c478bd9Sstevel@tonic-gate double whole; 233*7c478bd9Sstevel@tonic-gate struct fpq32 fpq; 234*7c478bd9Sstevel@tonic-gate } FQu; 235*7c478bd9Sstevel@tonic-gate }; 236*7c478bd9Sstevel@tonic-gate 237*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 238*7c478bd9Sstevel@tonic-gate 239*7c478bd9Sstevel@tonic-gate /* 240*7c478bd9Sstevel@tonic-gate * struct fpu is the floating point processor state. struct fpu is the sum 241*7c478bd9Sstevel@tonic-gate * total of all possible floating point state which includes the state of 242*7c478bd9Sstevel@tonic-gate * external floating point hardware, fpa registers, etc..., if it exists. 243*7c478bd9Sstevel@tonic-gate * 244*7c478bd9Sstevel@tonic-gate * A floating point instuction queue may or may not be associated with 245*7c478bd9Sstevel@tonic-gate * the floating point processor state. If a queue does exist, the field 246*7c478bd9Sstevel@tonic-gate * fpu_q will point to an array of fpu_qcnt entries where each entry is 247*7c478bd9Sstevel@tonic-gate * fpu_q_entrysize long. fpu_q_entry has a lower bound of sizeof (union FQu) 248*7c478bd9Sstevel@tonic-gate * and no upper bound. If no floating point queue entries are associated 249*7c478bd9Sstevel@tonic-gate * with the processor state, fpu_qcnt will be zeo and fpu_q will be NULL. 250*7c478bd9Sstevel@tonic-gate */ 251*7c478bd9Sstevel@tonic-gate 252*7c478bd9Sstevel@tonic-gate /* 253*7c478bd9Sstevel@tonic-gate * The following #define's are obsolete and may be removed in a future release. 254*7c478bd9Sstevel@tonic-gate * The corresponding integer types should be used instead (i.e. uint64_t). 255*7c478bd9Sstevel@tonic-gate */ 256*7c478bd9Sstevel@tonic-gate #define FPU_REGS_TYPE uint32_t 257*7c478bd9Sstevel@tonic-gate #define FPU_DREGS_TYPE uint64_t 258*7c478bd9Sstevel@tonic-gate #define V7_FPU_FSR_TYPE uint32_t 259*7c478bd9Sstevel@tonic-gate #define V9_FPU_FSR_TYPE uint64_t 260*7c478bd9Sstevel@tonic-gate #define V9_FPU_FPRS_TYPE uint32_t 261*7c478bd9Sstevel@tonic-gate 262*7c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 263*7c478bd9Sstevel@tonic-gate 264*7c478bd9Sstevel@tonic-gate struct fpu { 265*7c478bd9Sstevel@tonic-gate union { /* FPU floating point regs */ 266*7c478bd9Sstevel@tonic-gate uint32_t fpu_regs[32]; /* 32 singles */ 267*7c478bd9Sstevel@tonic-gate double fpu_dregs[32]; /* 32 doubles */ 268*7c478bd9Sstevel@tonic-gate long double fpu_qregs[16]; /* 16 quads */ 269*7c478bd9Sstevel@tonic-gate } fpu_fr; 270*7c478bd9Sstevel@tonic-gate struct fq *fpu_q; /* ptr to array of FQ entries */ 271*7c478bd9Sstevel@tonic-gate uint64_t fpu_fsr; /* FPU status register */ 272*7c478bd9Sstevel@tonic-gate uint8_t fpu_qcnt; /* # of entries in saved FQ */ 273*7c478bd9Sstevel@tonic-gate uint8_t fpu_q_entrysize; /* # of bytes per FQ entry */ 274*7c478bd9Sstevel@tonic-gate uint8_t fpu_en; /* flag specifying fpu in use */ 275*7c478bd9Sstevel@tonic-gate }; 276*7c478bd9Sstevel@tonic-gate 277*7c478bd9Sstevel@tonic-gate #else /* __sparcv9 */ 278*7c478bd9Sstevel@tonic-gate 279*7c478bd9Sstevel@tonic-gate struct fpu { 280*7c478bd9Sstevel@tonic-gate union { /* FPU floating point regs */ 281*7c478bd9Sstevel@tonic-gate uint32_t fpu_regs[32]; /* 32 singles */ 282*7c478bd9Sstevel@tonic-gate double fpu_dregs[16]; /* 16 doubles */ 283*7c478bd9Sstevel@tonic-gate } fpu_fr; 284*7c478bd9Sstevel@tonic-gate struct fq *fpu_q; /* ptr to array of FQ entries */ 285*7c478bd9Sstevel@tonic-gate uint32_t fpu_fsr; /* FPU status register */ 286*7c478bd9Sstevel@tonic-gate uint8_t fpu_qcnt; /* # of entries in saved FQ */ 287*7c478bd9Sstevel@tonic-gate uint8_t fpu_q_entrysize; /* # of bytes per FQ entry */ 288*7c478bd9Sstevel@tonic-gate uint8_t fpu_en; /* flag signifying fpu in use */ 289*7c478bd9Sstevel@tonic-gate }; 290*7c478bd9Sstevel@tonic-gate 291*7c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 292*7c478bd9Sstevel@tonic-gate 293*7c478bd9Sstevel@tonic-gate typedef struct fpu fpregset_t; 294*7c478bd9Sstevel@tonic-gate 295*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 296*7c478bd9Sstevel@tonic-gate 297*7c478bd9Sstevel@tonic-gate /* Kernel view of user sparcv7/v8 fpu structure */ 298*7c478bd9Sstevel@tonic-gate 299*7c478bd9Sstevel@tonic-gate struct fpu32 { 300*7c478bd9Sstevel@tonic-gate union { /* FPU floating point regs */ 301*7c478bd9Sstevel@tonic-gate uint32_t fpu_regs[32]; /* 32 singles */ 302*7c478bd9Sstevel@tonic-gate double fpu_dregs[16]; /* 16 doubles */ 303*7c478bd9Sstevel@tonic-gate } fpu_fr; 304*7c478bd9Sstevel@tonic-gate caddr32_t fpu_q; /* ptr to array of FQ entries */ 305*7c478bd9Sstevel@tonic-gate uint32_t fpu_fsr; /* FPU status register */ 306*7c478bd9Sstevel@tonic-gate uint8_t fpu_qcnt; /* # of entries in saved FQ */ 307*7c478bd9Sstevel@tonic-gate uint8_t fpu_q_entrysize; /* # of bytes per FQ entry */ 308*7c478bd9Sstevel@tonic-gate uint8_t fpu_en; /* flag signifying fpu in use */ 309*7c478bd9Sstevel@tonic-gate }; 310*7c478bd9Sstevel@tonic-gate 311*7c478bd9Sstevel@tonic-gate typedef struct fpu32 fpregset32_t; 312*7c478bd9Sstevel@tonic-gate 313*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 314*7c478bd9Sstevel@tonic-gate 315*7c478bd9Sstevel@tonic-gate /* 316*7c478bd9Sstevel@tonic-gate * The ABI uses struct fpu, so we use this to describe the kernel's view of the 317*7c478bd9Sstevel@tonic-gate * fpu. 318*7c478bd9Sstevel@tonic-gate */ 319*7c478bd9Sstevel@tonic-gate typedef struct { 320*7c478bd9Sstevel@tonic-gate union _fpu_fr { /* V9 FPU floating point regs */ 321*7c478bd9Sstevel@tonic-gate uint32_t fpu_regs[32]; /* 32 singles */ 322*7c478bd9Sstevel@tonic-gate uint64_t fpu_dregs[32]; /* 32 doubles */ 323*7c478bd9Sstevel@tonic-gate long double fpu_qregs[16]; /* 16 quads */ 324*7c478bd9Sstevel@tonic-gate } fpu_fr; 325*7c478bd9Sstevel@tonic-gate uint64_t fpu_fsr; /* FPU status register */ 326*7c478bd9Sstevel@tonic-gate uint32_t fpu_fprs; /* fprs register */ 327*7c478bd9Sstevel@tonic-gate struct fq *fpu_q; 328*7c478bd9Sstevel@tonic-gate uint8_t fpu_qcnt; 329*7c478bd9Sstevel@tonic-gate uint8_t fpu_q_entrysize; 330*7c478bd9Sstevel@tonic-gate uint8_t fpu_en; /* flag signifying fpu in use */ 331*7c478bd9Sstevel@tonic-gate } kfpu_t; 332*7c478bd9Sstevel@tonic-gate 333*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 334*7c478bd9Sstevel@tonic-gate 335*7c478bd9Sstevel@tonic-gate #if !defined(_XPG4_2) || defined(__EXTENSIONS__) 336*7c478bd9Sstevel@tonic-gate /* 337*7c478bd9Sstevel@tonic-gate * The following structure is for associating extra register state with 338*7c478bd9Sstevel@tonic-gate * the ucontext structure and is kept within the uc_mcontext filler area. 339*7c478bd9Sstevel@tonic-gate * 340*7c478bd9Sstevel@tonic-gate * If (xrs_id == XRS_ID) then the xrs_ptr field is a valid pointer to 341*7c478bd9Sstevel@tonic-gate * extra register state. The exact format of the extra register state 342*7c478bd9Sstevel@tonic-gate * pointed to by xrs_ptr is platform-dependent. 343*7c478bd9Sstevel@tonic-gate * 344*7c478bd9Sstevel@tonic-gate * Note: a platform may or may not manage extra register state. 345*7c478bd9Sstevel@tonic-gate */ 346*7c478bd9Sstevel@tonic-gate typedef struct { 347*7c478bd9Sstevel@tonic-gate unsigned int xrs_id; /* indicates xrs_ptr validity */ 348*7c478bd9Sstevel@tonic-gate caddr_t xrs_ptr; /* ptr to extra reg state */ 349*7c478bd9Sstevel@tonic-gate } xrs_t; 350*7c478bd9Sstevel@tonic-gate 351*7c478bd9Sstevel@tonic-gate #define XRS_ID 0x78727300 /* the string "xrs" */ 352*7c478bd9Sstevel@tonic-gate 353*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 354*7c478bd9Sstevel@tonic-gate 355*7c478bd9Sstevel@tonic-gate typedef struct { 356*7c478bd9Sstevel@tonic-gate uint32_t xrs_id; /* indicates xrs_ptr validity */ 357*7c478bd9Sstevel@tonic-gate caddr32_t xrs_ptr; /* ptr to extra reg state */ 358*7c478bd9Sstevel@tonic-gate } xrs32_t; 359*7c478bd9Sstevel@tonic-gate 360*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 361*7c478bd9Sstevel@tonic-gate 362*7c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 363*7c478bd9Sstevel@tonic-gate 364*7c478bd9Sstevel@tonic-gate /* 365*7c478bd9Sstevel@tonic-gate * Ancillary State Registers 366*7c478bd9Sstevel@tonic-gate * 367*7c478bd9Sstevel@tonic-gate * The SPARC V9 architecture defines 25 ASRs, numbered from 7 through 31. 368*7c478bd9Sstevel@tonic-gate * ASRs 16 through 31 are available to user programs, though the meaning 369*7c478bd9Sstevel@tonic-gate * and content of these registers is implementation dependent. 370*7c478bd9Sstevel@tonic-gate */ 371*7c478bd9Sstevel@tonic-gate typedef int64_t asrset_t[16]; /* %asr16 - > %asr31 */ 372*7c478bd9Sstevel@tonic-gate 373*7c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 374*7c478bd9Sstevel@tonic-gate 375*7c478bd9Sstevel@tonic-gate /* 376*7c478bd9Sstevel@tonic-gate * Structure mcontext defines the complete hardware machine state. If 377*7c478bd9Sstevel@tonic-gate * the field `gwins' is non NULL, it points to a save area for register 378*7c478bd9Sstevel@tonic-gate * window frames. If `gwins' is NULL, the register windows were saved 379*7c478bd9Sstevel@tonic-gate * on the user's stack. 380*7c478bd9Sstevel@tonic-gate * 381*7c478bd9Sstevel@tonic-gate * The filler of 21 longs is historical (now filler[19] plus the xrs_t 382*7c478bd9Sstevel@tonic-gate * field). The value was selected to provide binary compatibility with 383*7c478bd9Sstevel@tonic-gate * statically linked ICL binaries. It is in the ABI (do not change). It 384*7c478bd9Sstevel@tonic-gate * actually appears in the ABI as a single filler of 44 is in the field 385*7c478bd9Sstevel@tonic-gate * uc_filler of struct ucontext. It is split here so that ucontext.h can 386*7c478bd9Sstevel@tonic-gate * (hopefully) remain architecture independent. 387*7c478bd9Sstevel@tonic-gate * 388*7c478bd9Sstevel@tonic-gate * Note that 2 longs of the filler are used to hold extra register state info. 389*7c478bd9Sstevel@tonic-gate */ 390*7c478bd9Sstevel@tonic-gate typedef struct { 391*7c478bd9Sstevel@tonic-gate gregset_t gregs; /* general register set */ 392*7c478bd9Sstevel@tonic-gate gwindows_t *gwins; /* POSSIBLE pointer to register windows */ 393*7c478bd9Sstevel@tonic-gate fpregset_t fpregs; /* floating point register set */ 394*7c478bd9Sstevel@tonic-gate xrs_t xrs; /* POSSIBLE extra register state association */ 395*7c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 396*7c478bd9Sstevel@tonic-gate asrset_t asrs; /* ancillary registers */ 397*7c478bd9Sstevel@tonic-gate long filler[4]; /* room for expansion */ 398*7c478bd9Sstevel@tonic-gate #else /* __sparcv9 */ 399*7c478bd9Sstevel@tonic-gate long filler[19]; 400*7c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 401*7c478bd9Sstevel@tonic-gate } mcontext_t; 402*7c478bd9Sstevel@tonic-gate 403*7c478bd9Sstevel@tonic-gate #if defined(_SYSCALL32) 404*7c478bd9Sstevel@tonic-gate 405*7c478bd9Sstevel@tonic-gate typedef struct { 406*7c478bd9Sstevel@tonic-gate gregset32_t gregs; /* general register set */ 407*7c478bd9Sstevel@tonic-gate caddr32_t gwins; /* POSSIBLE pointer to register windows */ 408*7c478bd9Sstevel@tonic-gate fpregset32_t fpregs; /* floating point register set */ 409*7c478bd9Sstevel@tonic-gate xrs32_t xrs; /* POSSIBLE extra register state association */ 410*7c478bd9Sstevel@tonic-gate int32_t filler[19]; 411*7c478bd9Sstevel@tonic-gate } mcontext32_t; 412*7c478bd9Sstevel@tonic-gate 413*7c478bd9Sstevel@tonic-gate #endif /* _SYSCALL32 */ 414*7c478bd9Sstevel@tonic-gate 415*7c478bd9Sstevel@tonic-gate #endif /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */ 416*7c478bd9Sstevel@tonic-gate #endif /* _ASM */ 417*7c478bd9Sstevel@tonic-gate 418*7c478bd9Sstevel@tonic-gate /* 419*7c478bd9Sstevel@tonic-gate * The version of privregs.h that is used on implementations that run 420*7c478bd9Sstevel@tonic-gate * on processors that support the V9 instruction set is deliberately not 421*7c478bd9Sstevel@tonic-gate * imported here. 422*7c478bd9Sstevel@tonic-gate * 423*7c478bd9Sstevel@tonic-gate * The V9 'struct regs' definition is -not- compatible with either 32-bit 424*7c478bd9Sstevel@tonic-gate * or 64-bit core file contents, nor with the ucontext. As a result, the 425*7c478bd9Sstevel@tonic-gate * 'regs' structure cannot be used portably by applications, and should 426*7c478bd9Sstevel@tonic-gate * only be used by the kernel implementation. 427*7c478bd9Sstevel@tonic-gate * 428*7c478bd9Sstevel@tonic-gate * The inclusion of the SPARC V7 version of privregs.h allows for some 429*7c478bd9Sstevel@tonic-gate * limited source compatibility with 32-bit applications who expect to use 430*7c478bd9Sstevel@tonic-gate * 'struct regs' to match the content of a 32-bit core file, or a ucontext_t. 431*7c478bd9Sstevel@tonic-gate * 432*7c478bd9Sstevel@tonic-gate * Note that the ucontext_t actually describes the general registers in 433*7c478bd9Sstevel@tonic-gate * terms of the gregset_t data type, as described in this file. Note also 434*7c478bd9Sstevel@tonic-gate * that the core file content is defined by core(4) in terms of data types 435*7c478bd9Sstevel@tonic-gate * defined by procfs -- see proc(4). 436*7c478bd9Sstevel@tonic-gate */ 437*7c478bd9Sstevel@tonic-gate #if !defined(__sparcv9) 438*7c478bd9Sstevel@tonic-gate #if !defined(_KERNEL) && !defined(_XPG4_2) || defined(__EXTENSIONS__) 439*7c478bd9Sstevel@tonic-gate #include <v7/sys/privregs.h> 440*7c478bd9Sstevel@tonic-gate #endif /* !_KERNEL && !_XPG4_2 || __EXTENSIONS__ */ 441*7c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 442*7c478bd9Sstevel@tonic-gate 443*7c478bd9Sstevel@tonic-gate /* 444*7c478bd9Sstevel@tonic-gate * The following is here for XPG4.2 standards compliance. 445*7c478bd9Sstevel@tonic-gate * regset.h is included in ucontext.h for the definition of 446*7c478bd9Sstevel@tonic-gate * mcontext_t, all of which breaks XPG4.2 namespace. 447*7c478bd9Sstevel@tonic-gate */ 448*7c478bd9Sstevel@tonic-gate 449*7c478bd9Sstevel@tonic-gate #if defined(_XPG4_2) && !defined(__EXTENSIONS__) 450*7c478bd9Sstevel@tonic-gate /* 451*7c478bd9Sstevel@tonic-gate * The following is here for UNIX 95 compliance (XPG Issue 4, Version 2 452*7c478bd9Sstevel@tonic-gate * System Interfaces and Headers. The structures included here are identical 453*7c478bd9Sstevel@tonic-gate * to those visible elsewhere in this header except that the structure 454*7c478bd9Sstevel@tonic-gate * element names have been changed in accordance with the X/Open namespace 455*7c478bd9Sstevel@tonic-gate * rules. Specifically, depending on the name and scope, the names have 456*7c478bd9Sstevel@tonic-gate * been prepended with a single or double underscore (_ or __). See the 457*7c478bd9Sstevel@tonic-gate * structure definitions in the non-X/Open namespace for more detailed 458*7c478bd9Sstevel@tonic-gate * comments describing each of these structures. 459*7c478bd9Sstevel@tonic-gate */ 460*7c478bd9Sstevel@tonic-gate 461*7c478bd9Sstevel@tonic-gate #ifndef _ASM 462*7c478bd9Sstevel@tonic-gate 463*7c478bd9Sstevel@tonic-gate /* 464*7c478bd9Sstevel@tonic-gate * The following structures define how a register window can appear on the 465*7c478bd9Sstevel@tonic-gate * stack. 466*7c478bd9Sstevel@tonic-gate */ 467*7c478bd9Sstevel@tonic-gate #define _SPARC_MAXREGWINDOW 31 /* max windows in SPARC arch. */ 468*7c478bd9Sstevel@tonic-gate 469*7c478bd9Sstevel@tonic-gate struct __rwindow { 470*7c478bd9Sstevel@tonic-gate greg_t __rw_local[8]; /* locals */ 471*7c478bd9Sstevel@tonic-gate greg_t __rw_in[8]; /* ins */ 472*7c478bd9Sstevel@tonic-gate }; 473*7c478bd9Sstevel@tonic-gate 474*7c478bd9Sstevel@tonic-gate #define __rw_fp __rw_in[6] /* frame pointer */ 475*7c478bd9Sstevel@tonic-gate #define __rw_rtn __rw_in[7] /* return address */ 476*7c478bd9Sstevel@tonic-gate 477*7c478bd9Sstevel@tonic-gate struct __gwindows { 478*7c478bd9Sstevel@tonic-gate int __wbcnt; 479*7c478bd9Sstevel@tonic-gate greg_t *__spbuf[_SPARC_MAXREGWINDOW]; 480*7c478bd9Sstevel@tonic-gate struct __rwindow __wbuf[_SPARC_MAXREGWINDOW]; 481*7c478bd9Sstevel@tonic-gate }; 482*7c478bd9Sstevel@tonic-gate 483*7c478bd9Sstevel@tonic-gate typedef struct __gwindows gwindows_t; 484*7c478bd9Sstevel@tonic-gate 485*7c478bd9Sstevel@tonic-gate /* 486*7c478bd9Sstevel@tonic-gate * The fq structure defines the minimal format of a floating point 487*7c478bd9Sstevel@tonic-gate * instruction queue entry. 488*7c478bd9Sstevel@tonic-gate */ 489*7c478bd9Sstevel@tonic-gate 490*7c478bd9Sstevel@tonic-gate struct __fpq { 491*7c478bd9Sstevel@tonic-gate unsigned int *__fpq_addr; /* address */ 492*7c478bd9Sstevel@tonic-gate unsigned int __fpq_instr; /* instruction */ 493*7c478bd9Sstevel@tonic-gate }; 494*7c478bd9Sstevel@tonic-gate 495*7c478bd9Sstevel@tonic-gate struct __fq { 496*7c478bd9Sstevel@tonic-gate union { /* FPU inst/addr queue */ 497*7c478bd9Sstevel@tonic-gate double __whole; 498*7c478bd9Sstevel@tonic-gate struct __fpq __fpq; 499*7c478bd9Sstevel@tonic-gate } _FQu; 500*7c478bd9Sstevel@tonic-gate }; 501*7c478bd9Sstevel@tonic-gate 502*7c478bd9Sstevel@tonic-gate /* 503*7c478bd9Sstevel@tonic-gate * The fpu structure is the floating point processor state. 504*7c478bd9Sstevel@tonic-gate */ 505*7c478bd9Sstevel@tonic-gate 506*7c478bd9Sstevel@tonic-gate /* 507*7c478bd9Sstevel@tonic-gate * The following #define's are obsolete and may be removed in a future release. 508*7c478bd9Sstevel@tonic-gate * The corresponding integer types should be used instead (i.e. uint64_t). 509*7c478bd9Sstevel@tonic-gate */ 510*7c478bd9Sstevel@tonic-gate #define _FPU_REGS_TYPE uint32_t 511*7c478bd9Sstevel@tonic-gate #define _FPU_DREGS_TYPE uint64_t 512*7c478bd9Sstevel@tonic-gate #define _V7_FPU_FSR_TYPE uint32_t 513*7c478bd9Sstevel@tonic-gate #define _V9_FPU_FSR_TYPE uint64_t 514*7c478bd9Sstevel@tonic-gate #define _V9_FPU_FPRS_TYPE uint32_t 515*7c478bd9Sstevel@tonic-gate 516*7c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 517*7c478bd9Sstevel@tonic-gate 518*7c478bd9Sstevel@tonic-gate /* 519*7c478bd9Sstevel@tonic-gate * SPARC Version 9 floating point 520*7c478bd9Sstevel@tonic-gate */ 521*7c478bd9Sstevel@tonic-gate 522*7c478bd9Sstevel@tonic-gate struct __fpu { 523*7c478bd9Sstevel@tonic-gate union { /* FPU floating point regs */ 524*7c478bd9Sstevel@tonic-gate uint32_t __fpu_regs[32]; /* 32 singles */ 525*7c478bd9Sstevel@tonic-gate double __fpu_dregs[32]; /* 32 doubles */ 526*7c478bd9Sstevel@tonic-gate long double __fpu_qregs[16]; /* 16 quads */ 527*7c478bd9Sstevel@tonic-gate } __fpu_fr; 528*7c478bd9Sstevel@tonic-gate struct __fq *__fpu_q; /* ptr to array of FQ entries */ 529*7c478bd9Sstevel@tonic-gate uint64_t __fpu_fsr; /* FPU status register */ 530*7c478bd9Sstevel@tonic-gate uint8_t __fpu_qcnt; /* # of entries in saved FQ */ 531*7c478bd9Sstevel@tonic-gate uint8_t __fpu_q_entrysize; /* # of bytes per FQ entry */ 532*7c478bd9Sstevel@tonic-gate uint8_t __fpu_en; /* flag signifying fpu in use */ 533*7c478bd9Sstevel@tonic-gate }; 534*7c478bd9Sstevel@tonic-gate 535*7c478bd9Sstevel@tonic-gate #else /* __sparcv9 */ 536*7c478bd9Sstevel@tonic-gate 537*7c478bd9Sstevel@tonic-gate /* 538*7c478bd9Sstevel@tonic-gate * SPARC Version 7 and 8 floating point 539*7c478bd9Sstevel@tonic-gate */ 540*7c478bd9Sstevel@tonic-gate 541*7c478bd9Sstevel@tonic-gate struct __fpu { 542*7c478bd9Sstevel@tonic-gate union { /* FPU floating point regs */ 543*7c478bd9Sstevel@tonic-gate uint32_t __fpu_regs[32]; /* 32 singles */ 544*7c478bd9Sstevel@tonic-gate double __fpu_dregs[16]; /* 16 doubles */ 545*7c478bd9Sstevel@tonic-gate } __fpu_fr; 546*7c478bd9Sstevel@tonic-gate struct __fq *__fpu_q; /* ptr to array of FQ entries */ 547*7c478bd9Sstevel@tonic-gate uint32_t __fpu_fsr; /* FPU status register */ 548*7c478bd9Sstevel@tonic-gate uint8_t __fpu_qcnt; /* # of entries in saved FQ */ 549*7c478bd9Sstevel@tonic-gate uint8_t __fpu_q_entrysize; /* # of bytes per FQ entry */ 550*7c478bd9Sstevel@tonic-gate uint8_t __fpu_en; /* flag signifying fpu in use */ 551*7c478bd9Sstevel@tonic-gate }; 552*7c478bd9Sstevel@tonic-gate 553*7c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 554*7c478bd9Sstevel@tonic-gate 555*7c478bd9Sstevel@tonic-gate typedef struct __fpu fpregset_t; 556*7c478bd9Sstevel@tonic-gate 557*7c478bd9Sstevel@tonic-gate /* 558*7c478bd9Sstevel@tonic-gate * The xrs_t structure is for associating extra register state with 559*7c478bd9Sstevel@tonic-gate * the ucontext structure and is kept within the uc_mcontext filler area. 560*7c478bd9Sstevel@tonic-gate */ 561*7c478bd9Sstevel@tonic-gate typedef struct { 562*7c478bd9Sstevel@tonic-gate unsigned int __xrs_id; /* indicates xrs_ptr validity */ 563*7c478bd9Sstevel@tonic-gate caddr_t __xrs_ptr; /* ptr to extra reg state */ 564*7c478bd9Sstevel@tonic-gate } xrs_t; 565*7c478bd9Sstevel@tonic-gate 566*7c478bd9Sstevel@tonic-gate #define _XRS_ID 0x78727300 /* the string "xrs" */ 567*7c478bd9Sstevel@tonic-gate 568*7c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 569*7c478bd9Sstevel@tonic-gate 570*7c478bd9Sstevel@tonic-gate /* 571*7c478bd9Sstevel@tonic-gate * Ancillary State Registers 572*7c478bd9Sstevel@tonic-gate * 573*7c478bd9Sstevel@tonic-gate * The SPARC V9 architecture defines 25 ASRs, numbered from 7 through 31. 574*7c478bd9Sstevel@tonic-gate * ASRs 16 through 31 are available to user programs, though the meaning 575*7c478bd9Sstevel@tonic-gate * and content of these registers is implementation dependent. 576*7c478bd9Sstevel@tonic-gate */ 577*7c478bd9Sstevel@tonic-gate typedef int64_t asrset_t[16]; /* %asr16 - > %asr31 */ 578*7c478bd9Sstevel@tonic-gate 579*7c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 580*7c478bd9Sstevel@tonic-gate 581*7c478bd9Sstevel@tonic-gate /* 582*7c478bd9Sstevel@tonic-gate * Structure mcontext defines the complete hardware machine state. 583*7c478bd9Sstevel@tonic-gate */ 584*7c478bd9Sstevel@tonic-gate typedef struct { 585*7c478bd9Sstevel@tonic-gate gregset_t __gregs; /* general register set */ 586*7c478bd9Sstevel@tonic-gate gwindows_t *__gwins; /* POSSIBLE pointer to register windows */ 587*7c478bd9Sstevel@tonic-gate fpregset_t __fpregs; /* floating point register set */ 588*7c478bd9Sstevel@tonic-gate xrs_t __xrs; /* POSSIBLE extra register state association */ 589*7c478bd9Sstevel@tonic-gate #if defined(__sparcv9) 590*7c478bd9Sstevel@tonic-gate asrset_t __asrs; /* ancillary registers */ 591*7c478bd9Sstevel@tonic-gate long __filler[4]; /* room for expansion */ 592*7c478bd9Sstevel@tonic-gate #else /* __sparcv9 */ 593*7c478bd9Sstevel@tonic-gate long __filler[19]; 594*7c478bd9Sstevel@tonic-gate #endif /* __sparcv9 */ 595*7c478bd9Sstevel@tonic-gate } mcontext_t; 596*7c478bd9Sstevel@tonic-gate 597*7c478bd9Sstevel@tonic-gate #endif /* _ASM */ 598*7c478bd9Sstevel@tonic-gate #endif /* defined(_XPG4_2) && !defined(__EXTENSIONS__) */ 599*7c478bd9Sstevel@tonic-gate 600*7c478bd9Sstevel@tonic-gate 601*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 602*7c478bd9Sstevel@tonic-gate } 603*7c478bd9Sstevel@tonic-gate #endif 604*7c478bd9Sstevel@tonic-gate 605*7c478bd9Sstevel@tonic-gate #endif /* _SYS_REGSET_H */ 606