#![no_std] pub mod console; pub mod device_tree; pub mod util; #[cfg(not(test))] mod panic; /// The entrypoint to the kernel. This should be executed by hart0 alone. It performs some early /// boot tasks, then wakes up any other harts. /// /// # Safety /// /// - The `device_tree` pointer must be a valid pointer into physical memory. See /// `device_tree::FlattenedDeviceTree::from_ptr` for the precise requirements. /// - This must be called in supervisor mode with paging and traps disabled, but with all traps /// delegated to supervisor mode. #[no_mangle] pub unsafe extern "C" fn hart0_boot(device_tree: *const u8) -> ! { console::init(); log::info!("device_tree = {device_tree:?}"); let flattened_device_tree = unsafe { device_tree::FlattenedDeviceTree::from_ptr(device_tree) } .expect("invalid DeviceTree"); for event in flattened_device_tree.struct_events() { let event = event.expect("invalid DeviceTree"); dbg!(event); } todo!() }