Files
mop3/init/init.c
2026-01-20 22:18:43 +01:00

30 lines
563 B
C

#include <alloc/liballoc.h>
#include <limits.h>
#include <m/status.h>
#include <m/system.h>
#include <stddef.h>
#include <stdint.h>
#include <string/string.h>
#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