Files
XunilOS/kernel/src/arch/arch.rs
csd4ni3l 4a3c1c9ced Add a linked list allocator for heap that can now do 256 mib due to
frame allocator optimizations, make a basic init function in arch that
will initialize everything for a given arch. Add tests in kmain for
alloc, and add a Locked struct used for static mutables and the linked
list.
2026-03-28 15:06:16 +01:00

29 lines
828 B
Rust

use core::arch::asm;
use limine::response::{HhdmResponse, MemoryMapResponse};
#[cfg(target_arch = "x86_64")]
use crate::arch::x86_64::{init::init_x86_64, paging::XunilFrameAllocator};
#[cfg(target_arch = "x86_64")]
use x86_64::structures::paging::OffsetPageTable;
#[cfg(target_arch = "x86_64")]
pub fn init<'a>(
hhdm_response: &HhdmResponse,
memory_map_response: &'a MemoryMapResponse,
) -> (OffsetPageTable<'static>, XunilFrameAllocator<'a>) {
return init_x86_64(hhdm_response, memory_map_response);
}
pub fn idle() -> ! {
loop {
unsafe {
#[cfg(target_arch = "x86_64")]
asm!("hlt");
#[cfg(any(target_arch = "aarch64", target_arch = "riscv64"))]
asm!("wfi");
#[cfg(target_arch = "loongarch64")]
asm!("idle 0");
}
}
}