forked from AbleOS/ableos
66 lines
1.2 KiB
Rust
66 lines
1.2 KiB
Rust
//! The ableOS kernel.
|
|
|
|
#![feature(
|
|
abi_x86_interrupt,
|
|
alloc_error_handler,
|
|
inline_const,
|
|
panic_info_message,
|
|
pointer_is_aligned,
|
|
prelude_import,
|
|
ptr_sub_ptr
|
|
)]
|
|
#![deny(clippy::pedantic)]
|
|
#![no_std]
|
|
#![feature(custom_test_frameworks)]
|
|
#![test_runner(crate::test_runner)]
|
|
|
|
// #![deny(missing_docs)]
|
|
|
|
extern crate alloc;
|
|
|
|
mod allocator;
|
|
mod arch;
|
|
pub mod device_tree;
|
|
pub mod handle;
|
|
pub mod host_functions;
|
|
pub mod ipc;
|
|
mod kmain;
|
|
mod logger;
|
|
mod memory;
|
|
pub mod utils;
|
|
|
|
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) -> ! {
|
|
if let Some(loc) = info.location() {
|
|
let _ = crate::arch::log(format_args!(
|
|
"Location: {}: {}, {}\r\n",
|
|
loc.file(),
|
|
loc.line(),
|
|
loc.column()
|
|
));
|
|
}
|
|
|
|
if let Some(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();
|
|
}
|
|
}
|