#include #include #include #include #include #include #include #define EXAMPLE 1 #if EXAMPLE == 1 void app_thread1 (void) { test ('b'); quit (); } int spawn (void (*fn) (void)) { size_t stack_size = 256 * PAGE_SIZE; void* stack = malloc (stack_size); if (stack == NULL) return -ST_OOM_ERROR; uintptr_t stack_top = (uintptr_t)stack + stack_size; return clone (stack_top, stack_size, fn); } void app_main (void) { spawn (&app_thread1); } #endif