diff options
| author | Ada Christine <adachristine18@gmail.com> | 2022-02-18 17:23:40 +0000 |
|---|---|---|
| committer | Ada Christine <adachristine18@gmail.com> | 2022-02-18 17:23:40 +0000 |
| commit | 91ad310687ae37339db3dd5d51d47db87f2cf749 (patch) | |
| tree | 52394214c3b000cbf5cb999c53f9c7aca2b97dcc /kc | |
| parent | 7ad9d2715a737b1a1b9dd7ff411ffa6d27fb549e (diff) | |
use the appropriate semantics for atomics
Diffstat (limited to 'kc')
| -rw-r--r-- | kc/core/cpu/irq.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kc/core/cpu/irq.c b/kc/core/cpu/irq.c index 639aca3..e4dd29f 100644 --- a/kc/core/cpu/irq.c +++ b/kc/core/cpu/irq.c @@ -2,21 +2,22 @@ #include <stdatomic.h> -static atomic_uint_fast64_t irq_lock_count = 0; +static volatile atomic_uint_fast64_t irq_lock_count = 0; void irq_lock(void) { + irq_lock_count++; __asm__ volatile ("cli;"); } void irq_unlock(void) { - if (irq_lock_count >= 1) + if (atomic_load(&irq_lock_count) >= 1) { irq_lock_count--; } - if (irq_lock_count == 0) + if (atomic_load(&irq_lock_count) == 0) { __asm__ volatile ("sti;"); } |
