Debian Codegraph @

src/amd64-ucontext.h

raw symbols SCIP
1 #define setcontext(u) setmcontext(&(u)->uc_mcontext)
2 #define getcontext(u) getmcontext(&(u)->uc_mcontext)
3 typedef struct mcontext mcontext_t;
4 typedef struct ucontext ucontext_t;
5
6 extern int swapcontext(ucontext_t*, const ucontext_t*);
7 extern void makecontext(ucontext_t*, void(*)(void), int, ...);
8 extern int getmcontext(mcontext_t*);
9 extern void setmcontext(const mcontext_t*);
10
11 /*-
12 * Copyright (c) 1999 Marcel Moolenaar
13 * All rights reserved.
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer
20 * in this position and unchanged.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 * 3. The name of the author may not be used to endorse or promote products
25 * derived from this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
28 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
29 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
30 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
31 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
32 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
36 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 *
38 * $FreeBSD: src/sys/sys/ucontext.h,v 1.4 1999/10/11 20:33:17 luoqi Exp $
39 */
40
41 /* #include <machine/ucontext.h> */
42
43 /*-
44 * Copyright (c) 1999 Marcel Moolenaar
45 * All rights reserved.
46 *
47 * Redistribution and use in source and binary forms, with or without
48 * modification, are permitted provided that the following conditions
49 * are met:
50 * 1. Redistributions of source code must retain the above copyright
51 * notice, this list of conditions and the following disclaimer
52 * in this position and unchanged.
53 * 2. Redistributions in binary form must reproduce the above copyright
54 * notice, this list of conditions and the following disclaimer in the
55 * documentation and/or other materials provided with the distribution.
56 * 3. The name of the author may not be used to endorse or promote products
57 * derived from this software without specific prior written permission.
58 *
59 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
60 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
61 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
62 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
63 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
64 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
65 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
66 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
67 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
68 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
69 *
70 * $FreeBSD: src/sys/i386/include/ucontext.h,v 1.4 1999/10/11 20:33:09 luoqi Exp $
71 */
72
73 struct mcontext {
74 /*
75 * The first 20 fields must match the definition of
76 * sigcontext. So that we can support sigcontext
77 * and ucontext_t at the same time.
78 */
79 long mc_onstack; /* sigcontext compat. */
80 long mc_rdi; /* machine state (struct trapframe) */
81 long mc_rsi;
82 long mc_rdx;
83 long mc_rcx;
84 long mc_r8;
85 long mc_r9;
86 long mc_rax;
87 long mc_rbx;
88 long mc_rbp;
89 long mc_r10;
90 long mc_r11;
91 long mc_r12;
92 long mc_r13;
93 long mc_r14;
94 long mc_r15;
95 long mc_trapno;
96 long mc_addr;
97 long mc_flags;
98 long mc_err;
99 long mc_rip;
100 long mc_cs;
101 long mc_rflags;
102 long mc_rsp;
103 long mc_ss;
104
105 long mc_len; /* sizeof(mcontext_t) */
106 #define _MC_FPFMT_NODEV 0x10000 /* device not present or configured */
107 #define _MC_FPFMT_XMM 0x10002
108 long mc_fpformat;
109 #define _MC_FPOWNED_NONE 0x20000 /* FP state not used */
110 #define _MC_FPOWNED_FPU 0x20001 /* FP state came from FPU */
111 #define _MC_FPOWNED_PCB 0x20002 /* FP state came from PCB */
112 long mc_ownedfp;
113 /*
114 * See <machine/fpu.h> for the internals of mc_fpstate[].
115 */
116 long mc_fpstate[64];
117 long mc_spare[8];
118 };
119
120 struct ucontext {
121 /*
122 * Keep the order of the first two fields. Also,
123 * keep them the first two fields in the structure.
124 * This way we can have a union with struct
125 * sigcontext and ucontext_t. This allows us to
126 * support them both at the same time.
127 * note: the union is not defined, though.
128 */
129 sigset_t uc_sigmask;
130 mcontext_t uc_mcontext;
131
132 struct __ucontext *uc_link;
133 stack_t uc_stack;
134 int __spare__[8];
135 };
136
137