#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); }