summaryrefslogtreecommitdiff
path: root/usr/src/lib/libbc/libc/sys/common/ucontext.h
blob: 8f2243d85ea65ccb53d67bc245ef95248cc409d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#pragma ident	"%Z%%M%	%I%	%E% SMI"

/* 
 * This file contains all the type definitions necessary to
 * define the equivalent of SVR4 struct ucontext.
 */

/* Definition for alternate stack */
typedef struct sigaltstack {
	char *ss_sp;
	int  ss_size;
	int  ss_flags;
} stack_t;

/* Register window */
struct  rwindow {
        int  rw_local[8];            /* locals */
        int  rw_in[8];               /* ins */
};

#define   SPARC_MAXREGWINDOW      31 /* max windows in SPARC arch. */

struct gwindows {
        int             wbcnt;
        int             *spbuf[SPARC_MAXREGWINDOW];
        struct rwindow  wbuf[SPARC_MAXREGWINDOW];
};

typedef struct gwindows gwindows_t;

/* Floating point registers */
struct fpq {
        unsigned long *fpq_addr;        /* address */
        unsigned long fpq_instr;        /* instruction */
};
 
struct fq {
        union {                         /* FPU inst/addr queue */
                double whole;
                struct fpq fpq;
        } FQu;
};

struct fpu {
        union {                            /* FPU floating point regs */
                unsigned   fpu_regs[32];   /* 32 singles */
                double     fpu_dregs[16];  /* 16 doubles */
        } fpu_fr;
        struct fq       *fpu_q;             /* ptr to array of FQ entries */
        unsigned    fpu_fsr;                /* FPU status register */
        unsigned char   fpu_qcnt;           /* # of entries in saved FQ */
        unsigned char   fpu_q_entrysize;    /* # of bytes per FQ entry */
        unsigned char   fpu_en;             /* flag signifying fpu in use */
};

typedef struct fpu      fpregset_t;

/* Register set */
#define NGREG   19

typedef int  gregset_t[NGREG];

typedef struct mcontext{
        gregset_t       gregs;  /* general register set */
        gwindows_t      *gwins; /* POSSIBLE pointer to register windows */
        fpregset_t      fpregs; /* floating point register set */
        long            filler[21];
} mcontext_t;


typedef struct ucontext{
        unsigned long   uc_flags;
        struct ucontext *uc_link;
        unsigned long   uc_sigmask[4];
        stack_t         uc_stack;
        mcontext_t      uc_mcontext;
        long            uc_filler[23];
} ucontext_t;



/* The following is needed by the setjmp/longjmp routines */

#define _ABI_JBLEN	12	/* _JBLEN from base */

/*
 * The following structure MUST match the ABI size specifier _SIGJBLEN.
 * This is 19 (words). The ABI value for _JBLEN is 12 (words).
 * A sigset_t is 16 bytes and a stack_t is 12 bytes.  The layout must
 * match sigjmp_struct_t, defined in usr/src/lib/libc/inc/sigjmp_struct.h
 */
typedef struct setjmp_struct_t {
	int		sjs_flags;	/* JBUF[ 0]	*/
	int		sjs_sp;		/* JBUF[ 1]	*/
	int		sjs_pc;		/* JBUF[ 2]	*/
	int		sjs_fp;		/* JBUF[ 3]	*/
	int		sjs_i7;		/* JBUF[ 4]	*/
	void		*sjs_uclink;
	unsigned long	sjs_pad[_ABI_JBLEN - 6];
	unsigned long	sjs_sigmask[4];
	stack_t		sjs_stack;
} setjmp_struct_t;

typedef struct o_setjmp_struct_t {
	int		sjs_flags;	/* JBUF[ 0]	*/
	int		sjs_sp;		/* JBUF[ 1]	*/
	int		sjs_pc;		/* JBUF[ 2]	*/
	unsigned long	sjs_sigmask[3];
	stack_t		sjs_stack;
} o_setjmp_struct_t;

#define JB_SAVEMASK	0x1
#define UC_SIGMASK	001
#define UC_STACK	002