kernel: add basic spinlocks

This commit is contained in:
2023-02-04 17:46:05 +00:00
parent 6e290ee18a
commit d0a431c860
5 changed files with 125 additions and 18 deletions

View File

@@ -1,14 +0,0 @@
#include <socks/locks.h>
void spin_lock_irqsave(spin_lock_t *lck, unsigned long *flags)
{
while (!__sync_bool_compare_and_swap(lck, 0, 1)) {
/* pause */
}
}
void spin_unlock_irqrestore(spin_lock_t *lck, unsigned long flags)
{
__sync_lock_release(lck);
}