setjmp.h revision 256281
1/*-
2 * Copyright (c) 2000
3 * Intel Corporation.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 *
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 *
17 * 3. All advertising materials mentioning features or use of this software
18 *    must display the following acknowledgement:
19 *
20 *    This product includes software developed by Intel Corporation and
21 *    its contributors.
22 *
23 * 4. Neither the name of Intel Corporation or its contributors may be
24 *    used to endorse or promote products derived from this software
25 *    without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION AND CONTRIBUTORS ``AS IS''
28 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED.  IN NO EVENT SHALL INTEL CORPORATION OR CONTRIBUTORS BE
31 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
37 * THE POSSIBILITY OF SUCH DAMAGE.
38 *
39 * $FreeBSD: stable/10/sys/ia64/include/setjmp.h 118048 2003-07-26 08:03:43Z marcel $
40 */
41
42#ifndef _MACHINE_SETJMP_H_
43#define	_MACHINE_SETJMP_H_
44
45#include <sys/cdefs.h>
46
47#if __BSD_VISIBLE
48#define	JMPBUF_ADDR_OF(buf, item)	((unsigned long)((char *)buf + item))
49
50#define	J_UNAT		0
51#define	J_NATS		0x8
52#define	J_PFS		0x10
53#define	J_BSP		0x18
54#define	J_RNAT		0x20
55#define	J_PREDS		0x28
56#define	J_LC		0x30
57#define	J_R4		0x38
58#define	J_R5		0x40
59#define	J_R6		0x48
60#define	J_R7		0x50
61#define	J_SP		0x58
62#define	J_F2		0x60
63#define	J_F3		0x70
64#define	J_F4		0x80
65#define	J_F5		0x90
66#define	J_F16		0xa0
67#define	J_F17		0xb0
68#define	J_F18		0xc0
69#define	J_F19		0xd0
70#define	J_F20		0xe0
71#define	J_F21		0xf0
72#define	J_F22		0x100
73#define	J_F23		0x110
74#define	J_F24		0x120
75#define	J_F25		0x130
76#define	J_F26		0x140
77#define	J_F27		0x150
78#define	J_F28		0x160
79#define	J_F29		0x170
80#define	J_F30		0x180
81#define	J_F31		0x190
82#define	J_FPSR		0x1a0
83#define	J_B0		0x1a8
84#define	J_B1		0x1b0
85#define	J_B2		0x1b8
86#define	J_B3		0x1c0
87#define	J_B4		0x1c8
88#define	J_B5		0x1d0
89#define	J_SIGMASK	0x1d8
90#define	J_SIGSET	0x1e0
91#endif /* __BSD_VISIBLE */
92
93#define	_JBLEN		0x20			/* Size in long doubles */
94
95/*
96 * XXX this check is wrong, since LOCORE is in the application namespace and
97 * applications shouldn't be able to affect the implementation.  One workaround
98 * would be to only check LOCORE if _KERNEL is defined, but unfortunately
99 * LOCORE is used outside of the kernel.  The best solution would be to rename
100 * LOCORE to _LOCORE, so that it can be used in userland to safely affect the
101 * implementation.
102 */
103#ifndef LOCORE
104
105/*
106 * jmp_buf and sigjmp_buf are encapsulated in different structs to force
107 * compile-time diagnostics for mismatches.  The structs are the same
108 * internally to avoid some run-time errors for mismatches.
109 */
110#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE
111struct _sigjmp_buf {
112	long double buf[_JBLEN];
113};
114typedef struct _sigjmp_buf sigjmp_buf[1];
115#endif
116
117struct _jmp_buf {
118	long double buf[_JBLEN];
119};
120typedef struct _jmp_buf	jmp_buf[1];
121
122#ifdef _KERNEL
123#ifdef CTASSERT
124CTASSERT(sizeof(struct _jmp_buf) == 512);
125#endif
126#endif
127
128#endif /* !LOCORE */
129
130#endif /* !_MACHINE_SETJMP_H_ */
131