ableos/kernel/src/lib.rs

68 lines
1.4 KiB
Rust
Raw Normal View History

2022-04-11 17:23:11 -05:00
//! 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
2023-05-23 05:16:14 -05:00
#![no_std]
#![no_main]
2023-03-30 16:43:04 -05:00
#![feature(
slice_split_once,
2024-09-16 14:15:51 -05:00
exclusive_wrapper,
2024-10-25 10:37:38 -05:00
core_intrinsics,
2023-03-30 16:43:04 -05:00
abi_x86_interrupt,
2024-11-17 14:29:32 -06:00
lazy_get,
2023-03-30 16:43:04 -05:00
alloc_error_handler,
2024-11-26 13:32:19 -06:00
local_waker,
context_ext,
2023-05-23 05:16:14 -05:00
ptr_sub_ptr,
2023-10-27 20:26:04 -05:00
naked_functions,
2024-11-26 13:32:19 -06:00
pointer_is_aligned_to
2023-03-30 16:43:04 -05:00
)]
#![allow(dead_code, internal_features, static_mut_refs)]
2022-05-07 07:08:34 -05:00
extern crate alloc;
2023-03-30 16:43:04 -05:00
mod allocator;
mod arch;
2023-07-08 23:22:44 -05:00
mod bootmodules;
2023-08-22 08:52:30 -05:00
mod capabilities;
mod device_tree;
2024-09-19 06:05:11 -05:00
mod exe_format;
2023-08-22 08:52:30 -05:00
mod handle;
mod holeybytes;
mod ipc;
2023-03-30 16:43:04 -05:00
mod kmain;
mod logger;
mod memory;
2023-08-22 08:52:30 -05:00
mod task;
mod utils;
2024-11-26 16:02:54 -06:00
#[allow(improper_ctypes, non_upper_case_globals)]
mod ktest;
2024-11-26 16:02:54 -06:00
use versioning::Version;
2022-03-02 08:38:22 -06:00
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]
2024-09-13 16:41:31 -05:00
#[cfg(target_os = "none")]
2023-03-30 16:43:04 -05:00
fn panic(info: &core::panic::PanicInfo) -> ! {
2024-11-26 16:02:54 -06:00
use alloc::string::ToString;
arch::register_dump();
2023-03-30 16:43:04 -05:00
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().to_string().replace("\n", "\r\n");
2024-09-13 16:41:31 -05:00
let _ = crate::arch::log(format_args!("{msg}\r\n"));
2023-03-30 16:43:04 -05:00
loop {}
}