Blob


1 typedef struct mcontext mcontext_t;
2 typedef struct ucontext ucontext_t;
4 extern int getcontext(ucontext_t*);
5 extern void setcontext(ucontext_t*);
6 extern int swapcontext(ucontext_t*, ucontext_t*);
7 extern void makecontext(ucontext_t*, void(*)(), int, ...);
9 /*-
10 * Copyright (c) 1999 Marcel Moolenaar
11 * All rights reserved.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer
18 * in this position and unchanged.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 * 3. The name of the author may not be used to endorse or promote products
23 * derived from this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
26 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
34 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 *
36 * $FreeBSD: src/sys/sys/ucontext.h,v 1.4 1999/10/11 20:33:17 luoqi Exp $
37 */
39 /* #include <machine/ucontext.h> */
41 /*-
42 * Copyright (c) 1999 Marcel Moolenaar
43 * All rights reserved.
44 *
45 * Redistribution and use in source and binary forms, with or without
46 * modification, are permitted provided that the following conditions
47 * are met:
48 * 1. Redistributions of source code must retain the above copyright
49 * notice, this list of conditions and the following disclaimer
50 * in this position and unchanged.
51 * 2. Redistributions in binary form must reproduce the above copyright
52 * notice, this list of conditions and the following disclaimer in the
53 * documentation and/or other materials provided with the distribution.
54 * 3. The name of the author may not be used to endorse or promote products
55 * derived from this software without specific prior written permission.
56 *
57 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
58 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
59 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
60 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
61 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
62 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
63 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
64 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
65 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
66 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
67 *
68 * $FreeBSD: src/sys/i386/include/ucontext.h,v 1.4 1999/10/11 20:33:09 luoqi Exp $
69 */
71 struct mcontext {
72 /*
73 * The first 20 fields must match the definition of
74 * sigcontext. So that we can support sigcontext
75 * and ucontext_t at the same time.
76 */
77 int mc_onstack; /* XXX - sigcontext compat. */
78 int mc_gs;
79 int mc_fs;
80 int mc_es;
81 int mc_ds;
82 int mc_edi;
83 int mc_esi;
84 int mc_ebp;
85 int mc_isp;
86 int mc_ebx;
87 int mc_edx;
88 int mc_ecx;
89 int mc_eax;
90 int mc_trapno;
91 int mc_err;
92 int mc_eip;
93 int mc_cs;
94 int mc_eflags;
95 int mc_esp; /* machine state */
96 int mc_ss;
98 int mc_fpregs[28]; /* env87 + fpacc87 + u_long */
99 int __spare__[17];
100 };
102 struct ucontext {
103 /*
104 * Keep the order of the first two fields. Also,
105 * keep them the first two fields in the structure.
106 * This way we can have a union with struct
107 * sigcontext and ucontext_t. This allows us to
108 * support them both at the same time.
109 * note: the union is not defined, though.
110 */
111 sigset_t uc_sigmask;
112 mcontext_t uc_mcontext;
114 struct __ucontext *uc_link;
115 stack_t uc_stack;
116 int __spare__[8];
117 };