PPL Logo

util/uJcontext.h File Reference

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 Documentation

typedef void(* uJcontext_fn_t)(void *a1, void *a2)

Start a uJcontext flow of control.

Definition at line 22 of file uJcontext.h.

typedef void(* uJcontext_swap_fn_t)(struct uJcontext_t *newContext)

Called before switching to a uJcontext flow of control.

Definition at line 42 of file uJcontext.h.


Function Documentation

int getJcontext ( uJcontext_t __ucp  ) 

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:


Generated on Mon Sep 21 08:12:24 2020 for Charm++ by  doxygen 1.5.5