//! AbleOS Kernel Entrypoint // use std::collections::HashMap; use { alloc::vec::Vec, log::{info, trace}, spin::{Lazy, Mutex}, }; use crate::{arch, device_tree::DeviceTree, schedule::Scheduler}; use crate::alloc::string::ToString; pub fn kmain(cmdline: &str, bootstrap: Option<&'static [u8]>) -> ! { log::debug!("Entered kmain"); let mut cmdline = cmdline.to_string(); cmdline.pop(); cmdline.remove(0); let kcmd = clparse::Arguments::parse(cmdline.to_string()).unwrap(); log::info!("Cmdline: {kcmd:?}"); if kcmd.arguments.get("baka") == Some(&"true".to_string()) { let _ = crate::arch::log(format_args!(include_str!("../data/⑨. バカ"))); } if kcmd.arguments.get("foobles") == Some(&"true".to_string()) { let _ = crate::arch::log(format_args!("foobles\n\r")); } let bootstrap = bootstrap/*.expect("no bootstrap found")*/; match bootstrap { Some(bootstrap_mod) => {} None => { info!("No bootstrap module loaded.") } } let mut dt = DEVICE_TREE.lock(); info!("Device Tree {}", &dt); crate::arch::sloop() } pub const SCHEDULER: Lazy> = Lazy::new(|| { let mut sch = Scheduler::new(); Mutex::new(sch) }); pub static DEVICE_TREE: Lazy> = Lazy::new(|| { let mut dt = DeviceTree::new(); Mutex::new(dt) });