X-Git-Url: http://plrg.eecs.uci.edu/git/?p=c11tester.git;a=blobdiff_plain;f=context.h;h=aa356a9266c326111001492e20a4820ef74ddfd8;hp=862cda5e392451f19bb9b5cfe63680562dbf44bb;hb=3a9f39376685cfded500079d79790d87d581aea4;hpb=2b004336a919f74a5ca8f6d87ad5414360a949c7 diff --git a/context.h b/context.h index 862cda5e..aa356a92 100644 --- a/context.h +++ b/context.h @@ -7,31 +7,19 @@ #define __CONTEXT_H__ #include +#include -static inline int model_swapcontext(ucontext_t *oucp, ucontext_t *ucp) -{ #ifdef MAC - /* - * Mac OSX swapcontext() clobbers some registers, so use a hand-rolled - * version with {get,set}context(). We can avoid the same problem - * (where optimizations can break the following code) because we don't - * statically link with the C library - */ - - /* volatile, so that 'i' doesn't get promoted to a register */ - volatile int i = 0; - getcontext(oucp); +int model_swapcontext(ucontext_t *oucp, ucontext_t *ucp); - if (i == 0) { - i = 1; - setcontext(ucp); - } +#else /* !MAC */ - return 0; -#else +static inline int model_swapcontext(ucontext_t *oucp, ucontext_t *ucp) +{ return swapcontext(oucp, ucp); -#endif } -#endif /* __CONTEXT_H__ */ +#endif /* !MAC */ + +#endif /* __CONTEXT_H__ */