setjmp.h revision 104493
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: head/sys/ia64/include/setjmp.h 104493 2002-10-04 22:10:06Z mike $
40 */
41
42#ifndef _MACHINE_SETJMP_H_
43#define	_MACHINE_SETJMP_H_
44
45/*
46 * IA64 assembler doesn't like C style comments.  This also means we can't
47 * include other include files to get things like the roundup2() macro.
48 *
49 * NOTE:  Actual register storage must start on a 16 byte boundary.  Both
50 * setjmp and longjmp make that adjustment before referencing the contents
51 * of jmp_buf.  The macro JMPBUF_ADDR_OF() allows someone to get the address
52 * of an individual item saved in jmp_buf.
53 */
54
55#define	our_roundup(x, y)	(((x)+((y)-1))&(~((y)-1)))
56
57#define	JMPBUF_ALIGNMENT	0x10
58#define	JMPBUF_ADDR_OF(buf, item) \
59    ((size_t)((our_roundup((size_t)buf, JMPBUF_ALIGNMENT)) + item))
60
61#define	J_UNAT		0
62#define	J_NATS		0x8
63#define	J_PFS		0x10
64#define	J_BSP		0x18
65#define	J_RNAT		0x20
66#define	J_PREDS		0x28
67#define	J_LC		0x30
68#define	J_R4		0x38
69#define	J_R5		0x40
70#define	J_R6		0x48
71#define	J_R7		0x50
72#define	J_SP		0x58
73#define	J_F2		0x60
74#define	J_F3		0x70
75#define	J_F4		0x80
76#define	J_F5		0x90
77#define	J_F16		0xa0
78#define	J_F17		0xb0
79#define	J_F18		0xc0
80#define	J_F19		0xd0
81#define	J_F20		0xe0
82#define	J_F21		0xf0
83#define	J_F22		0x100
84#define	J_F23		0x110
85#define	J_F24		0x120
86#define	J_F25		0x130
87#define	J_F26		0x140
88#define	J_F27		0x150
89#define	J_F28		0x160
90#define	J_F29		0x170
91#define	J_F30		0x180
92#define	J_F31		0x190
93#define	J_FPSR		0x1a0
94#define	J_B0		0x1a8
95#define	J_B1		0x1b0
96#define	J_B2		0x1b8
97#define	J_B3		0x1c0
98#define	J_B4		0x1c8
99#define	J_B5		0x1d0
100#define	J_SIG0		0x1d8
101#define	J_SIG1		0x1e0
102#define	J_SIGMASK	0x1e8
103#define	J_END		0x1f0
104
105#ifndef LOCORE
106/*
107 * jmp_buf and sigjmp_buf are encapsulated in different structs to force
108 * compile-time diagnostics for mismatches.  The structs are the same
109 * internally to avoid some run-time errors for mismatches.
110 */
111#ifndef _ANSI_SOURCE
112typedef	struct _sigjmp_buf {
113	char	Buffer[J_END + JMPBUF_ALIGNMENT];
114} sigjmp_buf[1];
115#endif
116
117typedef	struct _jmp_buf {
118	char	Buffer[J_END + JMPBUF_ALIGNMENT];
119} jmp_buf[1];
120#endif
121
122#endif /* !_MACHINE_SETJMP_H_ */
123