Blob
1 #define setcontext(u) libthread_setmcontext(&(u)->mc)2 #define getcontext(u) libthread_getmcontext(&(u)->mc)3 typedef struct mcontext mcontext_t;4 typedef struct ucontext ucontext_t;6 struct mcontext7 {8 uintptr ax;9 uintptr bx;10 uintptr cx;11 uintptr dx;12 uintptr si;13 uintptr di;14 uintptr bp;15 uintptr sp;16 uintptr r8;17 uintptr r9;18 uintptr r10;19 uintptr r11;20 uintptr r12;21 uintptr r13;22 uintptr r14;23 uintptr r15;24 /*25 // XXX: currently do not save vector registers or floating-point state26 */27 };29 struct ucontext30 {31 struct {32 void *ss_sp;33 uint ss_size;34 } uc_stack;35 sigset_t uc_sigmask;36 mcontext_t mc;37 };39 void makecontext(ucontext_t*, void(*)(void), int, ...);40 int swapcontext(ucontext_t*, ucontext_t*);41 int libthread_getmcontext(mcontext_t*);42 void libthread_setmcontext(mcontext_t*);