Go to the source code of this file.
Data Structures | |
struct | uJcontext_stack_t |
Describes the stack for a uJcontext flow of control. More... | |
struct | uJcontext_t |
Represents a uJcontext flow of control. More... | |
Typedefs | |
typedef void(* | uJcontext_fn_t )(void *a1, void *a2) |
Start a uJcontext flow of control. | |
typedef void(* | uJcontext_swap_fn_t )(struct uJcontext_t *newContext) |
Called before switching to a uJcontext flow of control. | |
Functions | |
int | getJcontext (uJcontext_t *__ucp) |
int | setJcontext (const uJcontext_t *__ucp) |
int | swapJcontext (uJcontext_t *__oucp, const uJcontext_t *__ucp) |
void | makeJcontext (uJcontext_t *__ucp, uJcontext_fn_t func, int __argc, void *a1, void *a2) |
typedef void(* uJcontext_fn_t)(void *a1, void *a2) |
typedef void(* uJcontext_swap_fn_t)(struct uJcontext_t *newContext) |
int getJcontext | ( | uJcontext_t * | __ucp | ) |
Definition at line 52 of file uJcontext.C.
References uJcontext_t::_uc_args, uJcontext_t::_uc_fn, getStack(), uJcontext_stack_t::ss_flags, uJcontext_stack_t::ss_size, uJcontext_stack_t::ss_sp, uJcontext_t::uc_flags, uJcontext_t::uc_link, uJcontext_t::uc_sigmask, uJcontext_t::uc_stack, and uJcontext_t::uc_swap.
int setJcontext | ( | const uJcontext_t * | __ucp | ) |
Some machines reference variables (e.g., arguments, saved link) from their caller's stack frame, so we need to leave a little extra space before the new stack pointer.
Microsoft's _alloca is too smart-- it checks the pages being allocated to see if they're all valid stack pages, so our hack of using a huge alloca to change the stack pointer instead results in an address error (from "chkstk").
Manually changing the stack pointer seems to work properly; and because local variables are referenced via the frame pointer (ebp), this is all that's needed.
Definition at line 70 of file uJcontext.C.
References uJcontext_t::_uc_args, uJcontext_t::_uc_fn, uJcontext_t::_uc_jmp_buf, setJcontext(), uJcontext_stack_t::ss_size, uJcontext_stack_t::ss_sp, uJcontext_t::uc_link, uJcontext_t::uc_stack, uJcontext_t::uc_swap, and VERBOSE().
int swapJcontext | ( | uJcontext_t * | __oucp, | |
const uJcontext_t * | __ucp | |||
) |
Definition at line 166 of file uJcontext.C.
References uJcontext_t::_uc_jmp_buf, setJcontext(), and VERBOSE().
void makeJcontext | ( | uJcontext_t * | __ucp, | |
uJcontext_fn_t | func, | |||
int | __argc, | |||
void * | a1, | |||
void * | a2 | |||
) |
Definition at line 185 of file uJcontext.C.
References uJcontext_t::_uc_args, uJcontext_t::_uc_fn, and VERBOSE().