Userspace dlmalloc port, supporting syscalls mman_map()/mman_unmap()

This commit is contained in:
2025-09-10 21:52:01 +02:00
parent 91c493c818
commit 2f9f4d9397
19 changed files with 378 additions and 2 deletions

18
ulib/sync/spinlock.c Normal file
View File

@ -0,0 +1,18 @@
#include <stdatomic.h>
#include <sync/spinlock.h>
#define HINT() asm volatile("pause");
void spinlock_init(SpinLock *sl) {
atomic_store(&sl->lock, false);
}
void spinlock_acquire(SpinLock *sl) {
while (atomic_test_and_set_explicit(&sl->lock, memory_order_release)) {
HINT();
}
}
void spinlock_release(SpinLock *sl) {
atomic_clear_flag_explicit(&sl->lock, memory_order_release);
}