Last active
November 1, 2016 02:45
-
-
Save DaoWen/eb651af76a18b4c4a3526d6eb13ba2c7 to your computer and use it in GitHub Desktop.
C header file providing the interface for the Boost.Context assembly routines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Link code against the correct versions of the jump*.S and make*.S files | |
* from https://github.com/boostorg/context/tree/develop/src/asm. | |
* | |
* These function prototypes are based on those in fcontext.hpp, at | |
* https://github.com/boostorg/context/blob/develop/include/boost/context, | |
* which includes the following copyright notice: | |
* | |
* Copyright Oliver Kowalke 2009. | |
* Distributed under the Boost Software License, Version 1.0. | |
* (See accompanying file LICENSE_1_0.txt or copy at | |
* http://www.boost.org/LICENSE_1_0.txt) | |
*/ | |
#include <stdlib.h> | |
#include <stdbool.h> | |
typedef struct { void *sp; } fcontext_t; | |
/** | |
* sp - top of the new stack (i.e., HIGHEST address!) | |
* size - size of the stack | |
* fn - function to call when starting the new context | |
*/ | |
extern fcontext_t make_fcontext(void *sp, size_t size, void (*fn)(void*)); | |
/** | |
* ofc - old (current) context | |
* nfc - new context (should already be set up) | |
* vp - if nfc was created by make_fcontext, then this is the argument to fn | |
* otherwise, this is the return value of jump_fcontext in nfc | |
* preserve_fpu - should we save the floating point unit state? | |
*/ | |
extern void *jump_fcontext(fcontext_t *ofc, | |
fcontext_t nfc, void *vp, bool preserve_fpu); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment