Files
FoundryOS/kernel/src/lib.rs
T

54 lines
1.2 KiB
Rust

#![no_std]
#![feature(abi_x86_interrupt)]
#![warn(
clippy::correctness,
clippy::nursery,
clippy::unnecessary_cast,
clippy::all,
clippy::suspicious,
clippy::perf,
rustdoc::missing_errors_doc,
rustdoc::missing_panics_doc
)]
use core::arch::asm;
use graphics::font::{FONT_SPLEEN_8X16, Font};
use limine::BaseRevision;
mod arch;
mod graphics;
mod io;
/// Sets the base revision to the latest revision supported by the crate.
/// See specification for further info.
/// Be sure to mark all limine requests with #[used], otherwise they may be
/// removed by the compiler.
#[used]
// The .requests section allows limine to find the requests faster and more safely.
#[unsafe(link_section = ".requests")]
static BASE_REVISION: BaseRevision = BaseRevision::new();
/// The default font used when setting up the framebuffer code.
pub const DEFAULT_FONT: Font = FONT_SPLEEN_8X16;
#[panic_handler]
fn rust_panic(_info: &core::panic::PanicInfo) -> ! {
hcf();
}
pub fn hcf() -> ! {
loop {
unsafe {
asm!("hlt");
}
}
}
pub fn boot() -> Result<(), &'static str> {
if !BASE_REVISION.is_supported() {
return Err("base revision not supported");
}
Ok(())
}