1104493Smike/*-
282867Sdfr * Copyright (c) 2000
382867Sdfr * Intel Corporation.
466458Sdfr * All rights reserved.
566458Sdfr *
682867Sdfr * Redistribution and use in source and binary forms, with or without
782867Sdfr * modification, are permitted provided that the following conditions
882867Sdfr * are met:
966458Sdfr *
1082867Sdfr * 1. Redistributions of source code must retain the above copyright
1182867Sdfr *    notice, this list of conditions and the following disclaimer.
1266458Sdfr *
1382867Sdfr * 2. Redistributions in binary form must reproduce the above copyright
1482867Sdfr *    notice, this list of conditions and the following disclaimer in the
1582867Sdfr *    documentation and/or other materials provided with the distribution.
1682867Sdfr *
1782867Sdfr * 3. All advertising materials mentioning features or use of this software
1882867Sdfr *    must display the following acknowledgement:
1982867Sdfr *
2082867Sdfr *    This product includes software developed by Intel Corporation and
2182867Sdfr *    its contributors.
2282867Sdfr *
2382867Sdfr * 4. Neither the name of Intel Corporation or its contributors may be
2482867Sdfr *    used to endorse or promote products derived from this software
2582867Sdfr *    without specific prior written permission.
2682867Sdfr *
2782867Sdfr * THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION AND CONTRIBUTORS ``AS IS''
2882867Sdfr * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2982867Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
3082867Sdfr * ARE DISCLAIMED.  IN NO EVENT SHALL INTEL CORPORATION OR CONTRIBUTORS BE
3182867Sdfr * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
3282867Sdfr * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
3382867Sdfr * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
3482867Sdfr * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
3582867Sdfr * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3682867Sdfr * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
3782867Sdfr * THE POSSIBILITY OF SUCH DAMAGE.
3882867Sdfr *
39104493Smike * $FreeBSD$
4066458Sdfr */
4166458Sdfr
42104493Smike#ifndef _MACHINE_SETJMP_H_
43104493Smike#define	_MACHINE_SETJMP_H_
44104493Smike
45104505Smike#include <sys/cdefs.h>
46104505Smike
47104505Smike#if __BSD_VISIBLE
48106755Smarcel#define	JMPBUF_ADDR_OF(buf, item)	((unsigned long)((char *)buf + item))
4966458Sdfr
50104493Smike#define	J_UNAT		0
51104493Smike#define	J_NATS		0x8
52104493Smike#define	J_PFS		0x10
53104493Smike#define	J_BSP		0x18
54104493Smike#define	J_RNAT		0x20
55104493Smike#define	J_PREDS		0x28
56104493Smike#define	J_LC		0x30
57104493Smike#define	J_R4		0x38
58104493Smike#define	J_R5		0x40
59104493Smike#define	J_R6		0x48
60104493Smike#define	J_R7		0x50
61104493Smike#define	J_SP		0x58
62104493Smike#define	J_F2		0x60
63104493Smike#define	J_F3		0x70
64104493Smike#define	J_F4		0x80
65104493Smike#define	J_F5		0x90
66104493Smike#define	J_F16		0xa0
67104493Smike#define	J_F17		0xb0
68104493Smike#define	J_F18		0xc0
69104493Smike#define	J_F19		0xd0
70104493Smike#define	J_F20		0xe0
71104493Smike#define	J_F21		0xf0
72104493Smike#define	J_F22		0x100
73104493Smike#define	J_F23		0x110
74104493Smike#define	J_F24		0x120
75104493Smike#define	J_F25		0x130
76104493Smike#define	J_F26		0x140
77104493Smike#define	J_F27		0x150
78104493Smike#define	J_F28		0x160
79104493Smike#define	J_F29		0x170
80104493Smike#define	J_F30		0x180
81104493Smike#define	J_F31		0x190
82104493Smike#define	J_FPSR		0x1a0
83104493Smike#define	J_B0		0x1a8
84104493Smike#define	J_B1		0x1b0
85104493Smike#define	J_B2		0x1b8
86104493Smike#define	J_B3		0x1c0
87104493Smike#define	J_B4		0x1c8
88104493Smike#define	J_B5		0x1d0
89111894Smarcel#define	J_SIGMASK	0x1d8
90111894Smarcel#define	J_SIGSET	0x1e0
91104505Smike#endif /* __BSD_VISIBLE */
9282867Sdfr
93118048Smarcel#define	_JBLEN		0x20			/* Size in long doubles */
94104505Smike
95104505Smike/*
96104505Smike * XXX this check is wrong, since LOCORE is in the application namespace and
97104505Smike * applications shouldn't be able to affect the implementation.  One workaround
98104505Smike * would be to only check LOCORE if _KERNEL is defined, but unfortunately
99104505Smike * LOCORE is used outside of the kernel.  The best solution would be to rename
100104505Smike * LOCORE to _LOCORE, so that it can be used in userland to safely affect the
101104505Smike * implementation.
102104505Smike */
10382867Sdfr#ifndef LOCORE
104106755Smarcel
10566458Sdfr/*
10666458Sdfr * jmp_buf and sigjmp_buf are encapsulated in different structs to force
10766458Sdfr * compile-time diagnostics for mismatches.  The structs are the same
10866458Sdfr * internally to avoid some run-time errors for mismatches.
10966458Sdfr */
110104505Smike#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE
111106755Smarcelstruct _sigjmp_buf {
112118048Smarcel	long double buf[_JBLEN];
113118048Smarcel};
114106755Smarceltypedef struct _sigjmp_buf sigjmp_buf[1];
115104493Smike#endif
116104493Smike
117106755Smarcelstruct _jmp_buf {
118118048Smarcel	long double buf[_JBLEN];
119118048Smarcel};
120106755Smarceltypedef struct _jmp_buf	jmp_buf[1];
121104493Smike
122118048Smarcel#ifdef _KERNEL
123118048Smarcel#ifdef CTASSERT
124118048SmarcelCTASSERT(sizeof(struct _jmp_buf) == 512);
125118048Smarcel#endif
126118048Smarcel#endif
127118048Smarcel
128106755Smarcel#endif /* !LOCORE */
129106755Smarcel
130104493Smike#endif /* !_MACHINE_SETJMP_H_ */
131