diff options
| author | Jon Santmyer <jon@jonsantmyer.com> | 2026-09-04 11:31:40 -0400 |
|---|---|---|
| committer | Jon Santmyer <jon@jonsantmyer.com> | 2026-09-04 11:31:40 -0400 |
| commit | 8251da342161767fe203627223ccd4a7026701c6 (patch) | |
| tree | af2db0f11b0ea8ad35f88663a855bab39a80f679 /arch/x86_64/lock.c | |
| download | jove-kernel-8251da342161767fe203627223ccd4a7026701c6.tar.gz jove-kernel-8251da342161767fe203627223ccd4a7026701c6.tar.bz2 jove-kernel-8251da342161767fe203627223ccd4a7026701c6.zip | |
initial commit. working on tasking
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); +} |
