build: add a "user" arch to allow the kernel to run as a program on the host machine

This commit is contained in:
2023-02-25 17:58:23 +00:00
parent 8c87e78797
commit eed73e2414
21 changed files with 286 additions and 26 deletions

27
arch/user/hwlock.c Normal file
View File

@@ -0,0 +1,27 @@
#include <socks/machine/hwlock.h>
#include <socks/compiler.h>
void ml_hwlock_lock(ml_hwlock_t *lck)
{
volatile int q = 0;
while (!__sync_bool_compare_and_swap(lck, 0, 1)) {
q++;
}
}
void ml_hwlock_unlock(ml_hwlock_t *lck)
{
__sync_lock_release(lck);
}
void ml_hwlock_lock_irqsave(ml_hwlock_t *lck, unsigned long *flags)
{
(void)flags;
ml_hwlock_lock(lck);
}
void ml_hwlock_unlock_irqrestore(ml_hwlock_t *lck, unsigned long flags)
{
(void)flags;
ml_hwlock_unlock(lck);
}