| 1 |
#define setcontext(u) _setmcontext(&(u)->mc) |
| 2 |
#define getcontext(u) _getmcontext(&(u)->mc) |
| 3 |
typedef struct mcontext mcontext_t; |
| 4 |
typedef struct ucontext ucontext_t; |
| 5 |
struct mcontext |
| 6 |
{ |
| 7 |
ulong pc; |
| 8 |
ulong cr; |
| 9 |
ulong ctr; |
| 10 |
ulong xer; |
| 11 |
ulong sp; |
| 12 |
ulong toc; |
| 13 |
ulong r3; |
| 14 |
ulong gpr[19]; |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
}; |
| 22 |
|
| 23 |
struct ucontext |
| 24 |
{ |
| 25 |
struct { |
| 26 |
void *ss_sp; |
| 27 |
uint ss_size; |
| 28 |
} uc_stack; |
| 29 |
sigset_t uc_sigmask; |
| 30 |
mcontext_t mc; |
| 31 |
}; |
| 32 |
|
| 33 |
void makecontext(ucontext_t*, void(*)(void), int, ...); |
| 34 |
int swapcontext(ucontext_t*, const ucontext_t*); |
| 35 |
int _getmcontext(mcontext_t*); |
| 36 |
void _setmcontext(const mcontext_t*); |
| 37 |
|