sel4_panicking/count/
without_tls.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//
// Copyright 2023, Colias Group, LLC
//
// SPDX-License-Identifier: BSD-2-Clause
//

use core::sync::atomic::{AtomicBool, Ordering};

use sel4_panicking_env::abort;

static PANICKING: AtomicBool = AtomicBool::new(false);

pub(crate) fn count_panic() {
    if PANICKING.load(Ordering::SeqCst) {
        abort!("recursive panic encountered");
    }
}

pub(crate) fn count_panic_caught() {
    PANICKING.store(false, Ordering::SeqCst);
}