1
0
Fork 0
forked from AbleOS/ableos
ableos/kernel/src/arch/aarch64/mod.rs

35 lines
794 B
Rust
Raw Normal View History

2023-07-17 09:36:39 -05:00
use {core::arch::asm, limine::FramebufferRequest};
2023-07-20 04:21:00 -05:00
pub mod logging;
pub use logging::log;
2023-07-17 09:36:39 -05:00
pub const PAGE_SIZE: usize = 4096;
2023-07-14 20:00:50 -05:00
2023-07-13 22:41:09 -05:00
#[no_mangle]
unsafe extern "C" fn _kernel_start() -> ! {
2023-07-20 04:21:00 -05:00
crate::logger::init().expect("failed to set logger");
log::info!("Initialising AKern {}", crate::VERSION);
static FB_REQ: FramebufferRequest = FramebufferRequest::new(0);
2023-07-17 09:36:39 -05:00
let fb1 = &FB_REQ.get_response().get().unwrap().framebuffers()[0];
2023-07-17 09:36:39 -05:00
for i in 0..100_usize {
let offset = i * fb1.pitch as usize + i * 4;
unsafe {
*(fb1.address.as_ptr().unwrap().offset(offset as isize) as *mut u32) = 0xFFFFFFFF;
}
}
2023-07-17 09:36:39 -05:00
spin_loop();
}
2023-07-15 08:04:53 -05:00
pub fn spin_loop() -> ! {
2023-07-17 09:36:39 -05:00
loop {
unsafe { asm!("wfi") }
}
}
2023-07-17 09:36:39 -05:00
pub fn hardware_random_u64() -> u64 {
0
}