Add mutex syscalls

This commit is contained in:
2026-01-20 22:18:43 +01:00
parent fff51321bc
commit 7eceecf6e3
9 changed files with 122 additions and 22 deletions

View File

@@ -9,17 +9,21 @@
#define EXAMPLE 1
#if EXAMPLE == 1
void app_main (void) {
test ('a');
test ('a');
test ('a');
int* xs = malloc (1024 * sizeof (*xs));
memset (xs, 123, 1024 * sizeof (*xs));
free (xs);
test ('a');
test ('a');
test ('a');
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