⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

veridian_kernel/arch/x86_64/
entry.rs

1//! x86_64 kernel entry point and panic handler.
2//!
3//! Provides `arch_early_init` for architecture-specific setup (interrupt
4//! disable, SBI/PIC init) and `arch_panic_handler` for kernel panic output.
5
6use core::panic::PanicInfo;
7
8use crate::early_println;
9
10pub fn arch_early_init() {
11    // SAFETY: The cli instruction disables hardware interrupts. Required during
12    // early boot to prevent interrupt handlers from firing before the IDT is set
13    // up.
14    unsafe {
15        core::arch::asm!("cli", options(nomem, nostack));
16    }
17
18    // Initialize early serial before any println! usage
19    crate::arch::x86_64::early_serial::init();
20    early_println!("[EARLY] x86_64 kernel_main reached!");
21    early_println!("[EARLY] VeridianOS Kernel v{}", env!("CARGO_PKG_VERSION"));
22    early_println!("[EARLY] Architecture: x86_64");
23}
24
25pub fn arch_panic_handler(info: &PanicInfo) {
26    println!("[KERNEL PANIC] {}", info);
27    crate::graphics::fbcon::flush();
28}