all kernel headers have been moved from include/mango to include/kernel and include definitions that are only relevant to kernel-space. any definitions that are relevant to both kernel- and user-space (i.e. type definitions, syscall IDs) have been moved to include/mango within libmango.
28 lines
486 B
C
28 lines
486 B
C
#include <kernel/machine/hwlock.h>
|
|
#include <kernel/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);
|
|
}
|