use core::panic::PanicInfo;

use crate::{irq::irqflags::local_irq_disable, println, processor::cpu_relax, smp::smp_send_stop};

#[panic_handler]
fn panic_handler(info: &PanicInfo) -> ! {
    local_irq_disable();

    println!("---[ Kernel panic - not syncing: {} ]---", info.message());
    smp_send_stop();
    #[cfg(debug_assertions)]
    {
        if let Some(msg) = info.location() {
            println!("---[ Kernel panic - {} ]---", msg);
        }
    }
    loop {
        cpu_relax();
    }
}
