1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 28*7c478bd9Sstevel@tonic-gate 29*7c478bd9Sstevel@tonic-gate /* 30*7c478bd9Sstevel@tonic-gate * This file contains all the type definitions necessary to 31*7c478bd9Sstevel@tonic-gate * define the equivalent of SVR4 struct ucontext. 32*7c478bd9Sstevel@tonic-gate */ 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate /* Definition for alternate stack */ 35*7c478bd9Sstevel@tonic-gate typedef struct sigaltstack { 36*7c478bd9Sstevel@tonic-gate char *ss_sp; 37*7c478bd9Sstevel@tonic-gate int ss_size; 38*7c478bd9Sstevel@tonic-gate int ss_flags; 39*7c478bd9Sstevel@tonic-gate } stack_t; 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate /* Register window */ 42*7c478bd9Sstevel@tonic-gate struct rwindow { 43*7c478bd9Sstevel@tonic-gate int rw_local[8]; /* locals */ 44*7c478bd9Sstevel@tonic-gate int rw_in[8]; /* ins */ 45*7c478bd9Sstevel@tonic-gate }; 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate #define SPARC_MAXREGWINDOW 31 /* max windows in SPARC arch. */ 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate struct gwindows { 50*7c478bd9Sstevel@tonic-gate int wbcnt; 51*7c478bd9Sstevel@tonic-gate int *spbuf[SPARC_MAXREGWINDOW]; 52*7c478bd9Sstevel@tonic-gate struct rwindow wbuf[SPARC_MAXREGWINDOW]; 53*7c478bd9Sstevel@tonic-gate }; 54*7c478bd9Sstevel@tonic-gate 55*7c478bd9Sstevel@tonic-gate typedef struct gwindows gwindows_t; 56*7c478bd9Sstevel@tonic-gate 57*7c478bd9Sstevel@tonic-gate /* Floating point registers */ 58*7c478bd9Sstevel@tonic-gate struct fpq { 59*7c478bd9Sstevel@tonic-gate unsigned long *fpq_addr; /* address */ 60*7c478bd9Sstevel@tonic-gate unsigned long fpq_instr; /* instruction */ 61*7c478bd9Sstevel@tonic-gate }; 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate struct fq { 64*7c478bd9Sstevel@tonic-gate union { /* FPU inst/addr queue */ 65*7c478bd9Sstevel@tonic-gate double whole; 66*7c478bd9Sstevel@tonic-gate struct fpq fpq; 67*7c478bd9Sstevel@tonic-gate } FQu; 68*7c478bd9Sstevel@tonic-gate }; 69*7c478bd9Sstevel@tonic-gate 70*7c478bd9Sstevel@tonic-gate struct fpu { 71*7c478bd9Sstevel@tonic-gate union { /* FPU floating point regs */ 72*7c478bd9Sstevel@tonic-gate unsigned fpu_regs[32]; /* 32 singles */ 73*7c478bd9Sstevel@tonic-gate double fpu_dregs[16]; /* 16 doubles */ 74*7c478bd9Sstevel@tonic-gate } fpu_fr; 75*7c478bd9Sstevel@tonic-gate struct fq *fpu_q; /* ptr to array of FQ entries */ 76*7c478bd9Sstevel@tonic-gate unsigned fpu_fsr; /* FPU status register */ 77*7c478bd9Sstevel@tonic-gate unsigned char fpu_qcnt; /* # of entries in saved FQ */ 78*7c478bd9Sstevel@tonic-gate unsigned char fpu_q_entrysize; /* # of bytes per FQ entry */ 79*7c478bd9Sstevel@tonic-gate unsigned char fpu_en; /* flag signifying fpu in use */ 80*7c478bd9Sstevel@tonic-gate }; 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate typedef struct fpu fpregset_t; 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate /* Register set */ 85*7c478bd9Sstevel@tonic-gate #define NGREG 19 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate typedef int gregset_t[NGREG]; 88*7c478bd9Sstevel@tonic-gate 89*7c478bd9Sstevel@tonic-gate typedef struct mcontext{ 90*7c478bd9Sstevel@tonic-gate gregset_t gregs; /* general register set */ 91*7c478bd9Sstevel@tonic-gate gwindows_t *gwins; /* POSSIBLE pointer to register windows */ 92*7c478bd9Sstevel@tonic-gate fpregset_t fpregs; /* floating point register set */ 93*7c478bd9Sstevel@tonic-gate long filler[21]; 94*7c478bd9Sstevel@tonic-gate } mcontext_t; 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate typedef struct ucontext{ 98*7c478bd9Sstevel@tonic-gate unsigned long uc_flags; 99*7c478bd9Sstevel@tonic-gate struct ucontext *uc_link; 100*7c478bd9Sstevel@tonic-gate unsigned long uc_sigmask[4]; 101*7c478bd9Sstevel@tonic-gate stack_t uc_stack; 102*7c478bd9Sstevel@tonic-gate mcontext_t uc_mcontext; 103*7c478bd9Sstevel@tonic-gate long uc_filler[23]; 104*7c478bd9Sstevel@tonic-gate } ucontext_t; 105*7c478bd9Sstevel@tonic-gate 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate 108*7c478bd9Sstevel@tonic-gate /* The following is needed by the setjmp/longjmp routines */ 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate #define _ABI_JBLEN 12 /* _JBLEN from base */ 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate /* 113*7c478bd9Sstevel@tonic-gate * The following structure MUST match the ABI size specifier _SIGJBLEN. 114*7c478bd9Sstevel@tonic-gate * This is 19 (words). The ABI value for _JBLEN is 12 (words). 115*7c478bd9Sstevel@tonic-gate * A sigset_t is 16 bytes and a stack_t is 12 bytes. The layout must 116*7c478bd9Sstevel@tonic-gate * match sigjmp_struct_t, defined in usr/src/lib/libc/inc/sigjmp_struct.h 117*7c478bd9Sstevel@tonic-gate */ 118*7c478bd9Sstevel@tonic-gate typedef struct setjmp_struct_t { 119*7c478bd9Sstevel@tonic-gate int sjs_flags; /* JBUF[ 0] */ 120*7c478bd9Sstevel@tonic-gate int sjs_sp; /* JBUF[ 1] */ 121*7c478bd9Sstevel@tonic-gate int sjs_pc; /* JBUF[ 2] */ 122*7c478bd9Sstevel@tonic-gate int sjs_fp; /* JBUF[ 3] */ 123*7c478bd9Sstevel@tonic-gate int sjs_i7; /* JBUF[ 4] */ 124*7c478bd9Sstevel@tonic-gate void *sjs_uclink; 125*7c478bd9Sstevel@tonic-gate unsigned long sjs_pad[_ABI_JBLEN - 6]; 126*7c478bd9Sstevel@tonic-gate unsigned long sjs_sigmask[4]; 127*7c478bd9Sstevel@tonic-gate stack_t sjs_stack; 128*7c478bd9Sstevel@tonic-gate } setjmp_struct_t; 129*7c478bd9Sstevel@tonic-gate 130*7c478bd9Sstevel@tonic-gate typedef struct o_setjmp_struct_t { 131*7c478bd9Sstevel@tonic-gate int sjs_flags; /* JBUF[ 0] */ 132*7c478bd9Sstevel@tonic-gate int sjs_sp; /* JBUF[ 1] */ 133*7c478bd9Sstevel@tonic-gate int sjs_pc; /* JBUF[ 2] */ 134*7c478bd9Sstevel@tonic-gate unsigned long sjs_sigmask[3]; 135*7c478bd9Sstevel@tonic-gate stack_t sjs_stack; 136*7c478bd9Sstevel@tonic-gate } o_setjmp_struct_t; 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate #define JB_SAVEMASK 0x1 139*7c478bd9Sstevel@tonic-gate #define UC_SIGMASK 001 140*7c478bd9Sstevel@tonic-gate #define UC_STACK 002 141*7c478bd9Sstevel@tonic-gate 142