//! AbleOS Kernel Entrypoint // use std::collections::HashMap; use log::{info, trace}; use spin::{Lazy, Mutex}; use crate::arch::{hardware_random_u64, sloop}; use crate::handle::Handle; use crate::schedule::Scheduler; use crate::{interp, task}; 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")); // } let bootstrap = bootstrap/*.expect("no bootstrap found")*/; match bootstrap { Some(bootstrap_mod) => {} None => { info!("No bootstrap module loaded.") } } // use xml::XMLElement; // let kcmd = XMLElement::new("cmdline"); // let hnd = Handle::new(); // kcmd.set_attribute("") // OBJECTS.lock().insert(hnd, kcmd); // let abc = interp::wasm(); // trace!("{:?}", abc); let sch = SCHEDULER; let mut sch = sch.lock(); let wc = interp::build_wasm_context(alloc::vec::Vec::new()).unwrap(); sch.schedule(wc, crate::schedule::ContextWake::None); sch.run(); // crate::arch::sloop() } pub const OBJECTS: Lazy>> = Lazy::new(|| { let mut obj: HashMap = HashMap::new(); Mutex::new(obj) }); use hashbrown::HashMap; pub const SCHEDULER: Lazy> = Lazy::new(|| { let mut sch = Scheduler::new(); Mutex::new(sch) });