]> git.saurik.com Git - apple/xnu.git/blame - bsd/i386/setjmp.h
xnu-792.tar.gz
[apple/xnu.git] / bsd / i386 / setjmp.h
CommitLineData
1c79356b 1/*
9bccf70c 2 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
1c79356b
A
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
e5568f75
A
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
1c79356b 11 *
e5568f75
A
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
1c79356b
A
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
e5568f75
A
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
1c79356b
A
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22/* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
23 *
24 * File: setjmp.h
25 *
26 * Declaration of setjmp routines and data structures.
27 */
28#ifndef _BSD_I386_SETJMP_H
29#define _BSD_I386_SETJMP_H
30
31#include <sys/cdefs.h>
91447636 32#include <machine/signal.h>
1c79356b 33
91447636
A
34/*
35 * _JBLEN is number of ints required to save the following:
36 * eax, ebx, ecx, edx, edi, esi, ebp, esp, ss, eflags, eip,
37 * cs, de, es, fs, gs == 16 ints
38 * onstack, mask = 2 ints
39 */
1c79356b 40
91447636
A
41#if defined(KERNEL)
42typedef struct sigcontext jmp_buf[1];
1c79356b
A
43#define _JBLEN ((sizeof(struct sigcontext)) / sizeof(int))
44typedef int sigjmp_buf[_JBLEN+1];
91447636
A
45#else
46#define _JBLEN (18)
47typedef int jmp_buf[_JBLEN];
48typedef int sigjmp_buf[_JBLEN + 1];
49#endif
50
1c79356b
A
51
52__BEGIN_DECLS
91447636
A
53extern int setjmp(jmp_buf env);
54extern void longjmp(jmp_buf env, int val);
1c79356b
A
55
56#ifndef _ANSI_SOURCE
91447636
A
57int _setjmp(jmp_buf env);
58void _longjmp(jmp_buf, int val);
59int sigsetjmp(sigjmp_buf env, int val);
60void siglongjmp(sigjmp_buf env, int val);
1c79356b
A
61#endif /* _ANSI_SOURCE */
62
91447636
A
63#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE)
64void longjmperror(void);
1c79356b
A
65#endif /* neither ANSI nor POSIX */
66__END_DECLS
67#endif /* !_BSD_I386_SETJMP_H */