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

66 lines
1.2 KiB
Rust
Raw Normal View History

2022-04-11 17:23:11 -05:00
//! The ableOS kernel.
2023-03-30 16:43:04 -05:00
#![feature(
abi_x86_interrupt,
alloc_error_handler,
inline_const,
panic_info_message,
pointer_is_aligned,
prelude_import,
ptr_sub_ptr
)]
2023-05-23 04:26:32 -05:00
#![deny(clippy::pedantic)]
2022-05-07 07:08:34 -05:00
#![no_std]
2023-05-15 02:19:34 -05:00
#![feature(custom_test_frameworks)]
#![test_runner(crate::test_runner)]
2023-04-10 01:16:30 -05:00
// #![deny(missing_docs)]
2022-05-07 07:08:34 -05:00
extern crate alloc;
2023-03-30 16:43:04 -05:00
mod allocator;
mod arch;
2023-05-06 06:50:24 -05:00
pub mod device_tree;
2023-04-07 16:44:33 -05:00
pub mod handle;
2023-05-15 02:19:34 -05:00
pub mod host_functions;
pub mod ipc;
2023-03-30 16:43:04 -05:00
mod kmain;
mod logger;
mod memory;
2023-05-06 06:50:24 -05:00
pub mod utils;
2022-03-02 08:38:22 -06:00
use versioning::Version;
2022-04-11 17:23:11 -05:00
/// Kernel's version
2023-03-30 16:43:04 -05:00
pub const VERSION: Version = Version {
2022-03-02 08:38:22 -06:00
major: 0,
2023-03-30 16:43:04 -05:00
minor: 2,
patch: 0,
2022-03-02 08:38:22 -06:00
};
2023-03-30 16:43:04 -05:00
#[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 {}
}
2023-05-15 02:19:34 -05:00
#[cfg(test)]
fn test_runner(tests: &[&dyn Fn()]) {
println!("Running {} tests", tests.len());
for test in tests {
test();
}
}