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

52 lines
954 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,
2022-12-22 10:22:11 -06:00
pointer_is_aligned,
prelude_import,
ptr_sub_ptr
2022-12-07 18:26:43 -06:00
)]
2022-05-07 07:08:34 -05:00
#![no_std]
extern crate alloc;
mod allocator;
mod arch;
mod kmain;
mod logger;
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
2023-01-07 17:44:13 -06:00
let _ = crate::arch::log(format_args!(
2023-01-07 17:45:47 -06:00
"\r\n\x1b[1m\x1b[4m\x1b[38;5;125mKernel Panic\x1b[0m\r\n",
2022-12-07 18:26:43 -06:00
));
if let Some(loc) = info.location() {
2023-01-07 17:44:13 -06:00
let _ = crate::arch::log(format_args!(
2022-12-08 13:15:10 -06:00
"Location: {}: {}, {}\r\n",
2022-12-07 18:26:43 -06:00
loc.file(),
loc.line(),
loc.column()
));
}
if let Some(msg) = info.message() {
2023-01-07 17:44:13 -06:00
let _ = crate::arch::log(format_args!("{msg}\r\n"));
2022-12-07 18:26:43 -06:00
}
2022-12-06 18:10:38 -06:00
loop {}
}