blob: a39be28a940f0ff88fb59d350dab86ce746f5d92 [file] [log] [blame]
rscb8f742d2005-01-11 17:43:53 +00001typedef struct mcontext mcontext_t;
rsc50f7ec32005-01-07 21:47:30 +00002typedef struct ucontext ucontext_t;
rscb8f742d2005-01-11 17:43:53 +00003struct mcontext
rsc50f7ec32005-01-07 21:47:30 +00004{
5 ulong pc; /* lr */
6 ulong cr; /* mfcr */
7 ulong ctr; /* mfcr */
8 ulong xer; /* mfcr */
9 ulong sp; /* callee saved: r1 */
10 ulong toc; /* callee saved: r2 */
11 ulong r3; /* first arg to function, return register: r3 */
12 ulong gpr[19]; /* callee saved: r13-r31 */
13// XXX: currently do not save vector registers or floating-point state
14// ulong pad;
15// uvlong fpr[18]; /* callee saved: f14-f31 */
16// ulong vr[4*12]; /* callee saved: v20-v31, 256-bits each */
17};
18
rscb8f742d2005-01-11 17:43:53 +000019struct ucontext
20{
21 struct {
22 void *ss_sp;
23 uint ss_size;
24 } uc_stack;
25 sigset_t uc_sigmask;
26 mcontext_t mc;
27};
28
rsc50f7ec32005-01-07 21:47:30 +000029void makecontext(ucontext_t*, void(*)(void), int, ...);
rscb8f742d2005-01-11 17:43:53 +000030int getcontext(ucontext_t*);
rsc50f7ec32005-01-07 21:47:30 +000031int setcontext(ucontext_t*);
32int swapcontext(ucontext_t*, ucontext_t*);
rscb8f742d2005-01-11 17:43:53 +000033int _getmcontext(mcontext_t*);
34void _setmcontext(mcontext_t*);
rsc50f7ec32005-01-07 21:47:30 +000035