Blob


1 typedef struct mcontext mcontext_t;
2 typedef struct ucontext ucontext_t;
3 struct mcontext
4 {
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 };
19 struct 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 };
29 void makecontext(ucontext_t*, void(*)(void), int, ...);
30 int getcontext(ucontext_t*);
31 int setcontext(ucontext_t*);
32 int swapcontext(ucontext_t*, ucontext_t*);
33 int _getmcontext(mcontext_t*);
34 void _setmcontext(mcontext_t*);