diff options
Diffstat (limited to 'arch/x86_64/lock.c')
| -rw-r--r-- | arch/x86_64/lock.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86_64/lock.c b/arch/x86_64/lock.c new file mode 100644 index 0000000..b010ee6 --- /dev/null +++ b/arch/x86_64/lock.c @@ -0,0 +1,18 @@ +#include "lock.h" + +extern int _kernel_panic_unlock; + +void +take_mutex(atomic_flag *lock) +{ + if(_kernel_panic_unlock) return; + while(atomic_flag_test_and_set(lock)) { + __builtin_ia32_pause(); + } +} + +void +release_mutex(atomic_flag *lock) +{ + atomic_flag_clear(lock); +} |
