3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=US-ASCII">
4 <title>fcontext_t and related functions
</title>
5 <link rel=
"stylesheet" href=
"../../../../../../doc/src/boostbook.css" type=
"text/css">
6 <meta name=
"generator" content=
"DocBook XSL Stylesheets V1.75.2">
7 <link rel=
"home" href=
"../../index.html" title=
"Chapter 1. Context">
8 <link rel=
"up" href=
"../context.html" title=
"Struct fcontext_t">
9 <link rel=
"prev" href=
"../context.html" title=
"Struct fcontext_t">
10 <link rel=
"next" href=
"../econtext.html" title=
"Class execution_context">
12 <body bgcolor=
"white" text=
"black" link=
"#0000FF" vlink=
"#840084" alink=
"#0000FF">
13 <table cellpadding=
"2" width=
"100%"><tr>
14 <td valign=
"top"><img alt=
"Boost C++ Libraries" width=
"277" height=
"86" src=
"../../../../../../boost.png"></td>
15 <td align=
"center"><a href=
"../../../../../../index.html">Home
</a></td>
16 <td align=
"center"><a href=
"../../../../../../libs/libraries.htm">Libraries
</a></td>
17 <td align=
"center"><a href=
"http://www.boost.org/users/people.html">People
</a></td>
18 <td align=
"center"><a href=
"http://www.boost.org/users/faq.html">FAQ
</a></td>
19 <td align=
"center"><a href=
"../../../../../../more/index.htm">More
</a></td>
22 <div class=
"spirit-nav">
23 <a accesskey=
"p" href=
"../context.html"><img src=
"../../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../context.html"><img src=
"../../../../../../doc/src/images/up.png" alt=
"Up"></a><a accesskey=
"h" href=
"../../index.html"><img src=
"../../../../../../doc/src/images/home.png" alt=
"Home"></a><a accesskey=
"n" href=
"../econtext.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>
26 <div class=
"titlepage"><div><div><h3 class=
"title">
27 <a name=
"context.context.boost_fcontext"></a><a class=
"link" href=
"boost_fcontext.html" title=
"fcontext_t and related functions"><code class=
"computeroutput"><span class=
"identifier">fcontext_t
</span></code>
28 and related functions
</a>
29 </h3></div></div></div>
30 <pre class=
"programlisting"><span class=
"keyword">struct
</span> <span class=
"identifier">stack_t
</span>
31 <span class=
"special">{
</span>
32 <span class=
"keyword">void
</span><span class=
"special">*
</span> <span class=
"identifier">sp
</span><span class=
"special">;
</span>
33 <span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">size_t
</span> <span class=
"identifier">size
</span><span class=
"special">;
</span>
34 <span class=
"special">};
</span>
36 <span class=
"keyword">typedef
</span> <span class=
"special"><</span><span class=
"identifier">opaque
</span> <span class=
"identifier">pointer
</span> <span class=
"special">></span> <span class=
"identifier">fcontext_t
</span><span class=
"special">;
</span>
38 <span class=
"identifier">intptr_t
</span> <span class=
"identifier">jump_fcontext
</span><span class=
"special">(
</span><span class=
"identifier">fcontext_t
</span><span class=
"special">*
</span> <span class=
"identifier">ofc
</span><span class=
"special">,
</span><span class=
"identifier">fcontext_t
</span> <span class=
"identifier">nfc
</span><span class=
"special">,
</span><span class=
"identifier">intptr_t
</span> <span class=
"identifier">vp
</span><span class=
"special">,
</span><span class=
"keyword">bool
</span> <span class=
"identifier">preserve_fpu
</span><span class=
"special">=
</span><span class=
"keyword">true
</span><span class=
"special">);
</span>
39 <span class=
"identifier">fcontext_t
</span> <span class=
"identifier">make_fcontext
</span><span class=
"special">(
</span><span class=
"keyword">void
</span><span class=
"special">*
</span> <span class=
"identifier">sp
</span><span class=
"special">,
</span><span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">size_t
</span> <span class=
"identifier">size
</span><span class=
"special">,
</span><span class=
"keyword">void
</span><span class=
"special">(*
</span><span class=
"identifier">fn
</span><span class=
"special">)(
</span><span class=
"identifier">intptr_t
</span><span class=
"special">));
</span>
42 <a name=
"context.context.boost_fcontext.h0"></a>
43 <span><a name=
"context.context.boost_fcontext._code__phrase_role__identifier__sp__phrase___code_"></a></span><a class=
"link" href=
"boost_fcontext.html#context.context.boost_fcontext._code__phrase_role__identifier__sp__phrase___code_"><code class=
"computeroutput"><span class=
"identifier">sp
</span></code></a>
45 <div class=
"variablelist">
46 <p class=
"title"><b></b></p>
48 <dt><span class=
"term">Member:
</span></dt>
50 Pointer to the beginning of the stack (depending of the architecture
51 the stack grows downwards or upwards).
56 <a name=
"context.context.boost_fcontext.h1"></a>
57 <span><a name=
"context.context.boost_fcontext._code__phrase_role__identifier__size__phrase___code_"></a></span><a class=
"link" href=
"boost_fcontext.html#context.context.boost_fcontext._code__phrase_role__identifier__size__phrase___code_"><code class=
"computeroutput"><span class=
"identifier">size
</span></code></a>
59 <div class=
"variablelist">
60 <p class=
"title"><b></b></p>
62 <dt><span class=
"term">Member:
</span></dt>
64 Size of the stack in bytes.
69 <a name=
"context.context.boost_fcontext.h2"></a>
70 <span><a name=
"context.context.boost_fcontext._code__phrase_role__identifier__fc_stack__phrase___code_"></a></span><a class=
"link" href=
"boost_fcontext.html#context.context.boost_fcontext._code__phrase_role__identifier__fc_stack__phrase___code_"><code class=
"computeroutput"><span class=
"identifier">fc_stack
</span></code></a>
72 <div class=
"variablelist">
73 <p class=
"title"><b></b></p>
75 <dt><span class=
"term">Member:
</span></dt>
77 Tracks the memory for the context's stack.
82 <a name=
"context.context.boost_fcontext.h3"></a>
83 <span><a name=
"context.context.boost_fcontext._code__phrase_role__identifier__intptr_t__phrase___phrase_role__identifier__jump_fcontext__phrase__phrase_role__special_____phrase__phrase_role__identifier__fcontext_t__phrase__phrase_role__special_____phrase___phrase_role__identifier__ofc__phrase__phrase_role__special_____phrase__phrase_role__identifier__fcontext_t__phrase___phrase_role__identifier__nfc__phrase__phrase_role__special_____phrase__phrase_role__identifier__intptr_t__phrase___phrase_role__identifier__p__phrase__phrase_role__special_____phrase__phrase_role__keyword__bool__phrase___phrase_role__identifier__preserve_fpu__phrase__phrase_role__special_____phrase__phrase_role__keyword__true__phrase__phrase_role__special_____phrase___code_"></a></span><a class=
"link" href=
"boost_fcontext.html#context.context.boost_fcontext._code__phrase_role__identifier__intptr_t__phrase___phrase_role__identifier__jump_fcontext__phrase__phrase_role__special_____phrase__phrase_role__identifier__fcontext_t__phrase__phrase_role__special_____phrase___phrase_role__identifier__ofc__phrase__phrase_role__special_____phrase__phrase_role__identifier__fcontext_t__phrase___phrase_role__identifier__nfc__phrase__phrase_role__special_____phrase__phrase_role__identifier__intptr_t__phrase___phrase_role__identifier__p__phrase__phrase_role__special_____phrase__phrase_role__keyword__bool__phrase___phrase_role__identifier__preserve_fpu__phrase__phrase_role__special_____phrase__phrase_role__keyword__true__phrase__phrase_role__special_____phrase___code_"><code class=
"computeroutput"><span class=
"identifier">intptr_t
</span> <span class=
"identifier">jump_fcontext
</span><span class=
"special">(
</span><span class=
"identifier">fcontext_t
</span><span class=
"special">*
</span> <span class=
"identifier">ofc
</span><span class=
"special">,
</span><span class=
"identifier">fcontext_t
</span> <span class=
"identifier">nfc
</span><span class=
"special">,
</span><span class=
"identifier">intptr_t
</span> <span class=
"identifier">p
</span><span class=
"special">,
</span><span class=
"keyword">bool
</span>
84 <span class=
"identifier">preserve_fpu
</span><span class=
"special">=
</span><span class=
"keyword">true
</span><span class=
"special">)
</span></code></a>
86 <div class=
"variablelist">
87 <p class=
"title"><b></b></p>
89 <dt><span class=
"term">Effects:
</span></dt>
91 Stores the current context data (stack pointer, instruction pointer,
92 and CPU registers) to
<code class=
"computeroutput"><span class=
"special">*
</span><span class=
"identifier">ofc
</span></code> and restores the context data
93 from
<code class=
"computeroutput"><span class=
"identifier">nfc
</span></code>, which implies
94 jumping to
<code class=
"computeroutput"><span class=
"identifier">nfc
</span></code>'s execution
95 context. The intptr_t argument,
<code class=
"computeroutput"><span class=
"identifier">p
</span></code>,
96 is passed to the current context to be returned by the most recent
97 call to
<code class=
"computeroutput"><span class=
"identifier">jump_fcontext
</span><span class=
"special">()
</span></code> in the same thread. The last argument
98 controls if fpu registers have to be preserved.
100 <dt><span class=
"term">Returns:
</span></dt>
102 The third pointer argument passed to the most recent call to
<code class=
"computeroutput"><span class=
"identifier">jump_fcontext
</span><span class=
"special">()
</span></code>,
108 <a name=
"context.context.boost_fcontext.h4"></a>
109 <span><a name=
"context.context.boost_fcontext._code__phrase_role__identifier__fcontext_t__phrase___phrase_role__identifier__make_fcontext__phrase__phrase_role__special_____phrase__phrase_role__keyword__void__phrase__phrase_role__special_____phrase___phrase_role__identifier__sp__phrase__phrase_role__special_____phrase__phrase_role__identifier__std__phrase__phrase_role__special______phrase__phrase_role__identifier__size_t__phrase___phrase_role__identifier__size__phrase__phrase_role__special_____phrase__phrase_role__keyword__void__phrase__phrase_role__special______phrase__phrase_role__identifier__fn__phrase__phrase_role__special______phrase__phrase_role__identifier__intptr_t__phrase__phrase_role__special______phrase___code_"></a></span><a class=
"link" href=
"boost_fcontext.html#context.context.boost_fcontext._code__phrase_role__identifier__fcontext_t__phrase___phrase_role__identifier__make_fcontext__phrase__phrase_role__special_____phrase__phrase_role__keyword__void__phrase__phrase_role__special_____phrase___phrase_role__identifier__sp__phrase__phrase_role__special_____phrase__phrase_role__identifier__std__phrase__phrase_role__special______phrase__phrase_role__identifier__size_t__phrase___phrase_role__identifier__size__phrase__phrase_role__special_____phrase__phrase_role__keyword__void__phrase__phrase_role__special______phrase__phrase_role__identifier__fn__phrase__phrase_role__special______phrase__phrase_role__identifier__intptr_t__phrase__phrase_role__special______phrase___code_"><code class=
"computeroutput"><span class=
"identifier">fcontext_t
</span> <span class=
"identifier">make_fcontext
</span><span class=
"special">(
</span><span class=
"keyword">void
</span><span class=
"special">*
</span>
110 <span class=
"identifier">sp
</span><span class=
"special">,
</span><span class=
"identifier">std
</span><span class=
"special">::
</span><span class=
"identifier">size_t
</span>
111 <span class=
"identifier">size
</span><span class=
"special">,
</span><span class=
"keyword">void
</span><span class=
"special">(*
</span><span class=
"identifier">fn
</span><span class=
"special">)(
</span><span class=
"identifier">intptr_t
</span><span class=
"special">))
</span></code></a>
113 <div class=
"variablelist">
114 <p class=
"title"><b></b></p>
116 <dt><span class=
"term">Precondition:
</span></dt>
118 Stack
<code class=
"computeroutput"><span class=
"identifier">sp
</span></code> and function
119 pointer
<code class=
"computeroutput"><span class=
"identifier">fn
</span></code> are valid
120 (depending on the architecture
<code class=
"computeroutput"><span class=
"identifier">sp
</span></code>
121 points to the top or bottom of the stack) and
<code class=
"computeroutput"><span class=
"identifier">size
</span></code>
124 <dt><span class=
"term">Effects:
</span></dt>
126 Creates an fcontext_t on top of the stack and prepares the stack to
127 execute the
<span class=
"emphasis"><em>context-function
</em></span> <code class=
"computeroutput"><span class=
"identifier">fn
</span></code>.
129 <dt><span class=
"term">Returns:
</span></dt>
131 Returns a fcontext_t which is placed on the stack.
136 <table xmlns:
rev=
"http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width=
"100%"><tr>
137 <td align=
"left"></td>
138 <td align=
"right"><div class=
"copyright-footer">Copyright
© 2014 Oliver Kowalke
<p>
139 Distributed under the Boost Software License, Version
1.0. (See accompanying
140 file LICENSE_1_0.txt or copy at
<a href=
"http://www.boost.org/LICENSE_1_0.txt" target=
"_top">http://www.boost.org/LICENSE_1_0.txt
</a>)
145 <div class=
"spirit-nav">
146 <a accesskey=
"p" href=
"../context.html"><img src=
"../../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../context.html"><img src=
"../../../../../../doc/src/images/up.png" alt=
"Up"></a><a accesskey=
"h" href=
"../../index.html"><img src=
"../../../../../../doc/src/images/home.png" alt=
"Home"></a><a accesskey=
"n" href=
"../econtext.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>