mirror of
https://github.com/XunilGroup/XunilOS.git
synced 2026-04-25 11:49:03 +02:00
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.
29 lines
828 B
Rust
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");
|
|
}
|
|
}
|
|
}
|