build: add a "user" arch to allow the kernel to run as a program on the host machine
This commit is contained in:
27
arch/user/hwlock.c
Normal file
27
arch/user/hwlock.c
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user