mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Better comments around the panic handler
This commit is contained in:
parent
18b25e242e
commit
642c3c1b79
|
@ -214,11 +214,15 @@ fn panic_implementation(info: &core::panic::PanicInfo) -> ! {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we panic during the panic handler, then there isn't much we can do any more. So this code
|
||||||
|
// just infinite loops halting the CPU.
|
||||||
fn avoid_double_panic() {
|
fn avoid_double_panic() {
|
||||||
static IS_PANICKING: portable_atomic::AtomicBool = portable_atomic::AtomicBool::new(false);
|
static IS_PANICKING: portable_atomic::AtomicBool = portable_atomic::AtomicBool::new(false);
|
||||||
|
|
||||||
if IS_PANICKING.load(portable_atomic::Ordering::SeqCst) {
|
if IS_PANICKING.load(portable_atomic::Ordering::SeqCst) {
|
||||||
// we panicked during the panic handler, so not much we can do here
|
loop {
|
||||||
loop {}
|
syscall::halt();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
IS_PANICKING.store(true, portable_atomic::Ordering::SeqCst);
|
IS_PANICKING.store(true, portable_atomic::Ordering::SeqCst);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue