FreeBSD/Linux Kernel Cross Reference
sys/sys/ucontext.h
1 /* $NetBSD: ucontext.h,v 1.11 2008/10/15 06:51:21 wrstuden 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 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 #ifndef _SYS_UCONTEXT_H_
33 #define _SYS_UCONTEXT_H_
34
35 #include <sys/sigtypes.h>
36 #include <machine/mcontext.h>
37
38 typedef struct __ucontext ucontext_t;
39
40 struct __ucontext {
41 unsigned int uc_flags; /* properties */
42 ucontext_t * uc_link; /* context to resume */
43 sigset_t uc_sigmask; /* signals blocked in this context */
44 stack_t uc_stack; /* the stack used by this context */
45 mcontext_t uc_mcontext; /* machine state */
46 #if defined(_UC_MACHINE_PAD)
47 long __uc_pad[_UC_MACHINE_PAD];
48 #endif
49 };
50
51 #ifndef _UC_UCONTEXT_ALIGN
52 #define _UC_UCONTEXT_ALIGN (~0)
53 #endif
54
55 /* uc_flags */
56 #define _UC_SIGMASK 0x01 /* valid uc_sigmask */
57 #define _UC_STACK 0x02 /* valid uc_stack */
58 #define _UC_CPU 0x04 /* valid GPR context in uc_mcontext */
59 #define _UC_FPU 0x08 /* valid FPU context in uc_mcontext */
60
61 #ifdef _KERNEL
62 struct lwp;
63
64 void getucontext(struct lwp *, ucontext_t *);
65 void getucontext_sa(struct lwp *, ucontext_t *);
66 int setucontext(struct lwp *, const ucontext_t *);
67 void cpu_getmcontext(struct lwp *, mcontext_t *, unsigned int *);
68 int cpu_setmcontext(struct lwp *, const mcontext_t *, unsigned int);
69 #endif /* _KERNEL */
70
71 #endif /* !_SYS_UCONTEXT_H_ */
Cache object: 8421b75289ce14d9dd600e7e264e1b0b
|