FreeBSD/Linux Kernel Cross Reference
sys/sys/ucontext.h
1 /* $NetBSD: ucontext.h,v 1.9 2006/08/20 08:02:21 skrll Exp $ */
2
3 /*-
4 * Copyright (c) 1999, 2003 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Klaus Klein, and by Jason R. Thorpe.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the NetBSD
21 * Foundation, Inc. and its contributors.
22 * 4. Neither the name of The NetBSD Foundation nor the names of its
23 * contributors may be used to endorse or promote products derived
24 * from this software without specific prior written permission.
25 *
26 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 * POSSIBILITY OF SUCH DAMAGE.
37 */
38
39 #ifndef _SYS_UCONTEXT_H_
40 #define _SYS_UCONTEXT_H_
41
42 #include <sys/sigtypes.h>
43 #include <machine/mcontext.h>
44
45 typedef struct __ucontext ucontext_t;
46
47 struct __ucontext {
48 unsigned int uc_flags; /* properties */
49 ucontext_t * uc_link; /* context to resume */
50 sigset_t uc_sigmask; /* signals blocked in this context */
51 stack_t uc_stack; /* the stack used by this context */
52 mcontext_t uc_mcontext; /* machine state */
53 #if defined(_UC_MACHINE_PAD)
54 long __uc_pad[_UC_MACHINE_PAD];
55 #endif
56 };
57
58 #ifndef _UC_UCONTEXT_ALIGN
59 #define _UC_UCONTEXT_ALIGN (~0)
60 #endif
61
62 /* uc_flags */
63 #define _UC_SIGMASK 0x01 /* valid uc_sigmask */
64 #define _UC_STACK 0x02 /* valid uc_stack */
65 #define _UC_CPU 0x04 /* valid GPR context in uc_mcontext */
66 #define _UC_FPU 0x08 /* valid FPU context in uc_mcontext */
67
68 #ifdef _KERNEL
69 struct lwp;
70
71 void getucontext(struct lwp *, ucontext_t *);
72 int setucontext(struct lwp *, const ucontext_t *);
73 void cpu_getmcontext(struct lwp *, mcontext_t *, unsigned int *);
74 int cpu_setmcontext(struct lwp *, const mcontext_t *, unsigned int);
75 #endif /* _KERNEL */
76
77 #endif /* !_SYS_UCONTEXT_H_ */
Cache object: 6c3470cea7c3eed805b3eecdf048f905
|