From 3064cb13577edd31d3a3ceb79b2bc72314ec208b Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Thu, 21 Nov 2024 20:05:43 -0700 Subject: libcr: coroutine.c: Move things around --- libcr/coroutine.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/libcr/coroutine.c b/libcr/coroutine.c index 35a060d..cb872b0 100644 --- a/libcr/coroutine.c +++ b/libcr/coroutine.c @@ -39,12 +39,12 @@ #error config.h must define CONFIG_COROUTINE_VALGRIND #endif +/* Implementation *************************************************************/ + #if CONFIG_COROUTINE_VALGRIND #include #endif -/* Implementation *************************************************************/ - /* * Portability notes: * @@ -136,26 +136,6 @@ { /* bracket to get Emacs indentation to work how I want */ #endif -/*==================================================================== - * Wrappers for setjmp()/longjmp() that do *not* save the - * interrupt mask. */ -#if __unix__ - /* On __unix__, we use POSIX real-time signals as interrupts. - * POSIX leaves it implementation-defined whether - * setjmp()/longjmp() save the signal mask; while glibc does - * not save it, let's not rely on that. */ - #define cr_plat_setjmp(env) sigsetjmp(env, 0) - #define cr_plat_longjmp(env, val) siglongjmp(env, val) -#elif __NEWLIB__ - /* newlib does not have sigsetjmp()/sigsetlongjmp(), but - * setjmp()/longjmp() do not save the interrupt mask, * so we - * can use them directly. */ - #define cr_plat_setjmp(env) setjmp(env) - #define cr_plat_longjmp(env, val) longjmp(env, val) -#else - #error unsupported platform (not __unix__, not __NEWLIB__) -#endif - /*==================================================================== * Interrupt management routines. */ #if __unix__ @@ -315,6 +295,26 @@ #error unsupported CPU (not __ARM_ARCH_6M__, not __x86_64__) #endif +/*==================================================================== + * Wrappers for setjmp()/longjmp() that do *not* save the + * interrupt mask. */ +#if __unix__ + /* On __unix__, we use POSIX real-time signals as interrupts. + * POSIX leaves it implementation-defined whether + * setjmp()/longjmp() save the signal mask; while glibc does + * not save it, let's not rely on that. */ + #define cr_plat_setjmp(env) sigsetjmp(env, 0) + #define cr_plat_longjmp(env, val) siglongjmp(env, val) +#elif __NEWLIB__ + /* newlib does not have sigsetjmp()/sigsetlongjmp(), but + * setjmp()/longjmp() do not save the interrupt mask, * so we + * can use them directly. */ + #define cr_plat_setjmp(env) setjmp(env) + #define cr_plat_longjmp(env, val) longjmp(env, val) +#else + #error unsupported platform (not __unix__, not __NEWLIB__) +#endif + #if 0 } #endif -- cgit v1.2.3-2-g168b