forked from AbleOS/ableos
50 lines
950 B
Rust
50 lines
950 B
Rust
//! The ableOS kernel.
|
|
|
|
#![feature(
|
|
abi_x86_interrupt,
|
|
alloc_error_handler,
|
|
panic_info_message,
|
|
prelude_import
|
|
)]
|
|
#![no_std]
|
|
|
|
extern crate alloc;
|
|
|
|
pub mod allocator;
|
|
pub mod arch;
|
|
pub mod kmain;
|
|
pub mod logger;
|
|
pub mod task;
|
|
|
|
use versioning::Version;
|
|
|
|
/// Kernel's version
|
|
pub const VERSION: Version = Version {
|
|
major: 0,
|
|
minor: 2,
|
|
patch: 0,
|
|
};
|
|
|
|
#[panic_handler]
|
|
fn panic(info: &core::panic::PanicInfo) -> ! {
|
|
// TODO: Better panic handler
|
|
let _ = crate::arch::serial_fmt(format_args!(
|
|
"\x1b[1m\x1b[4m\x1b[38;5;125mKernel Panic\x1b[0m\r\n",
|
|
));
|
|
|
|
if let Some(loc) = info.location() {
|
|
let _ = crate::arch::serial_fmt(format_args!(
|
|
"Location: {}: {}, {}\r\n",
|
|
loc.file(),
|
|
loc.line(),
|
|
loc.column()
|
|
));
|
|
}
|
|
|
|
if let Some(msg) = info.message() {
|
|
let _ = crate::arch::serial_fmt(format_args!("{msg}\r\n"));
|
|
}
|
|
|
|
loop {}
|
|
}
|