1
0
Fork 0
forked from AbleOS/ableos
ableos/kernel/src/lib.rs
2024-09-13 22:41:31 +01:00

68 lines
1.4 KiB
Rust

//! The ableOS kernel.
//! Named akern.
//! Akern is woefully undersupported at the moment but we are looking to add support improve hardware discovery and make our lives as kernel and operating system developers easier and better
#![no_std]
#![feature(new_uninit)]
#![feature(
abi_x86_interrupt,
alloc_error_handler,
ptr_sub_ptr,
custom_test_frameworks,
naked_functions,
pointer_is_aligned_to
)]
#![test_runner(crate::test_runner)]
#![cfg_attr(not(debug_assertions), allow(unused, deprecated))]
#![allow(dead_code)]
extern crate alloc;
mod allocator;
mod arch;
mod bootmodules;
mod capabilities;
mod device_tree;
mod handle;
mod holeybytes;
mod ipc;
mod kmain;
mod logger;
mod memory;
mod task;
mod utils;
use versioning::Version;
/// Kernel's version
pub const VERSION: Version = Version {
major: 0,
minor: 2,
patch: 0,
};
#[panic_handler]
#[cfg(target_os = "none")]
fn panic(info: &core::panic::PanicInfo) -> ! {
arch::register_dump();
if let Some(loc) = info.location() {
let _ = crate::arch::log(format_args!(
"Location: {}: {}, {}\r\n",
loc.file(),
loc.line(),
loc.column()
));
}
let msg = info.message();
let _ = crate::arch::log(format_args!("{msg}\r\n"));
loop {}
}
#[cfg(test)]
fn test_runner(tests: &[&dyn Fn()]) {
println!("Running {} tests", tests.len());
for test in tests {
test();
}
}