1
0
Fork 0
forked from AbleOS/ableos
ableos_time/kernel/src/lib.rs

50 lines
952 B
Rust
Raw Normal View History

2022-04-11 17:23:11 -05:00
//! The ableOS kernel.
2022-12-07 18:26:43 -06:00
#![feature(
abi_x86_interrupt,
alloc_error_handler,
panic_info_message,
prelude_import
)]
2022-05-07 07:08:34 -05:00
#![no_std]
extern crate alloc;
2022-05-07 07:08:34 -05:00
pub mod allocator;
pub mod arch;
2022-12-06 18:10:38 -06:00
pub mod kmain;
2022-12-07 18:26:43 -06:00
pub mod logger;
pub mod task;
2022-03-02 08:38:22 -06:00
use versioning::Version;
2022-04-11 17:23:11 -05:00
/// Kernel's version
2022-12-06 18:43:26 -06:00
pub const VERSION: Version = Version {
2022-03-02 08:38:22 -06:00
major: 0,
2022-12-06 18:10:38 -06:00
minor: 2,
patch: 0,
2022-03-02 08:38:22 -06:00
};
2022-12-06 18:10:38 -06:00
#[panic_handler]
fn panic(info: &core::panic::PanicInfo) -> ! {
2022-12-07 18:26:43 -06:00
// 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"));
}
2022-12-06 18:10:38 -06:00
loop {}
}