xref: /titanic_50/usr/src/lib/libc/inc/sigjmp_struct.h (revision accf27a5824ae84dfac7b089c4325917231a7d15)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
24  */
25 
26 #ifndef _SIGJMP_STRUCT_H
27 #define	_SIGJMP_STRUCT_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 #include <sys/types.h>
34 #include <sys/stack.h>
35 #include <ucontext.h>
36 #include <setjmp.h>
37 
38 #if defined(__sparc)
39 
40 /*
41  * The following structure MUST match the ABI size specifier _SIGJBLEN.
42  * This is 19 (longs).  The ABI value for _JBLEN is 12 (longs).
43  * A greg_t is a long.  A sigset_t is 4 ints and a stack_t is 3 longs.
44  *
45  * The layout of this structure must match the layout of the same
46  * structures defined in usr/src/lib/libbc/libc/sys/common/ucontext.h
47  * and usr/src/ucblib/libucb/sparc/sys/setjmp.c.  Other than that,
48  * the layout is private, not known to applications.
49  *
50  * We make the first 5 members match the implementations of
51  * setjmp()/longjmp(), so that an application could (stupidly)
52  * do sigsetjmp(env) followed by longjmp(env) (but not setjmp(env)
53  * followed by siglongjmp(env)).
54  */
55 typedef struct {
56 	int		sjs_flags;	/* JBUF[ 0]	*/
57 	greg_t		sjs_sp;		/* JBUF[ 1]	*/
58 	greg_t		sjs_pc;		/* JBUF[ 2]	*/
59 	greg_t		sjs_fp;		/* JBUF[ 3]	*/
60 	greg_t		sjs_i7;		/* JBUF[ 4]	*/
61 	ucontext_t	*sjs_uclink;
62 	ulong_t		sjs_pad[_JBLEN - 6];
63 	sigset_t	sjs_sigmask;
64 #if defined(_LP64)
65 	greg_t		sjs_asi;
66 	greg_t		sjs_fprs;
67 #endif
68 	stack_t		sjs_stack;
69 } sigjmp_struct_t;
70 
71 #define	JB_SAVEMASK	0x1
72 #define	JB_FRAMEPTR	0x2
73 
74 #endif	/* __sparc */
75 
76 #ifdef	__cplusplus
77 }
78 #endif
79 
80 #endif /* _SIGJMP_STRUCT_H */
81