summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-21 20:05:43 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-11-23 13:53:35 -0700
commit3064cb13577edd31d3a3ceb79b2bc72314ec208b (patch)
tree9e8a553b25230a1f883d14189ba5362ddce91a14
parent1f644055705aa698af3a248cba938ddb95524a1b (diff)
libcr: coroutine.c: Move things around
-rw-r--r--libcr/coroutine.c44
1 files 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 <valgrind/valgrind.h>
#endif
-/* Implementation *************************************************************/
-
/*
* Portability notes:
*
@@ -137,26 +137,6 @@
#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__
#include <signal.h> /* for sig*, SIG* */
@@ -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