gint/src/cpu
Lephe 7aa86235a3
cpu: fix a data race occurring on the cpu_atomic lock
The function was designed with multi-threaded concurrency in mind,
where threads can take over while the lock is held and simply block
trying to acquire it, which allows the lock holder to proceed.

However interrupt handlers are different; they have priority, so once
they start they must complete immediately. The cannot afford to block
on the lock as the program would simply freeze. In exchange, they clean
up before they leave, so there are some guarantees on the execution
state even when interrupted.

The correct protection is therefore not a lock but a temporary block on
interrupts. There is no data race on the value of the saved IMASK
because it is preserved during interrupt handling.
2021-05-12 09:17:25 +02:00
..
atomic.c cpu: fix a data race occurring on the cpu_atomic lock 2021-05-12 09:17:25 +02:00
cpu.c kernel: driver and world system overhaul 2021-04-23 20:44:08 +02:00
registers.s kernel: driver and world system overhaul 2021-04-23 20:44:08 +02:00
sleep.c cpu: allow functions to block the sleep() function 2021-05-12 09:17:25 +02:00