From a2bf48f56b12d589cf8caafc6e586e4bbf600bdd Mon Sep 17 00:00:00 2001 From: able Date: Thu, 25 May 2023 07:04:19 -0500 Subject: [PATCH] minor cleanups --- kernel/src/host_functions.rs | 4 ++-- kernel/src/kmain.rs | 32 +++++++++----------------------- kernel/src/logger.rs | 2 ++ kernel/sycall.md | 24 ------------------------ repbuild/src/main.rs | 1 + 5 files changed, 14 insertions(+), 49 deletions(-) delete mode 100644 kernel/sycall.md diff --git a/kernel/src/host_functions.rs b/kernel/src/host_functions.rs index 4bb3414..62b9799 100644 --- a/kernel/src/host_functions.rs +++ b/kernel/src/host_functions.rs @@ -1,11 +1,11 @@ -use {hbvm::engine::Engine}; +use hbvm::engine::Engine; use { + crate::ipc::message::Message, crossbeam_queue::{ArrayQueue, SegQueue}, log::trace, }; -use crate::{ipc::message::Message}; pub enum HostError { MemoryError, } diff --git a/kernel/src/kmain.rs b/kernel/src/kmain.rs index a1dd992..de97f2f 100644 --- a/kernel/src/kmain.rs +++ b/kernel/src/kmain.rs @@ -1,39 +1,27 @@ //! AbleOS Kernel Entrypoint -// use std::collections::HashMap; - use { - log::info, + crate::{alloc::string::ToString, arch::logging::SERIAL_CONSOLE, device_tree::DeviceTree}, + hbvm::engine::Engine, + log::{debug, info}, spin::{Lazy, Mutex}, }; -use hbvm::engine::Engine; - -use crate::{ - arch::logging::SERIAL_CONSOLE, - device_tree::DeviceTree, - // host_functions::read_device_tree, -}; - -use crate::alloc::string::ToString; - pub fn kmain(cmdline: &str, bootstrap: Option<&'static [u8]>) -> ! { - log::debug!("Entered kmain"); + 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:?}"); + 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 mut kcl = xml::XMLElement::new("Kernel Command Line"); + for (key, value) in kcmd.arguments { + kcl.set_attribute(key, value); } + info!("kernel command line object: {:?}", kcl); let bootstrap = bootstrap/*.expect("no bootstrap found")*/; match bootstrap { @@ -65,8 +53,6 @@ pub fn kmain(cmdline: &str, bootstrap: Option<&'static [u8]>) -> ! { sc.send(byte); } } - - // crate::arch::sloop() } pub static DEVICE_TREE: Lazy> = Lazy::new(|| { diff --git a/kernel/src/logger.rs b/kernel/src/logger.rs index c8ddfac..3b8cd3f 100644 --- a/kernel/src/logger.rs +++ b/kernel/src/logger.rs @@ -1,3 +1,5 @@ +// TODO: Add a logger api with logger levels and various outputs + use log::{Level, SetLoggerError}; pub fn init() -> Result<(), SetLoggerError> { diff --git a/kernel/sycall.md b/kernel/sycall.md deleted file mode 100644 index dac5fd8..0000000 --- a/kernel/sycall.md +++ /dev/null @@ -1,24 +0,0 @@ - - - -`create_object` -``` - params - i32 - start address of the string to use as the object name - i32 - length of string - returns - i64 Handle to the object -``` - -`read_object_attribute` -``` - params - i64 Handle to the object - i32 - start address of the string to use as the attribute name - i32 - end address of the string to use as the attribute name - returns -``` \ No newline at end of file diff --git a/repbuild/src/main.rs b/repbuild/src/main.rs index cb31167..51ca04d 100644 --- a/repbuild/src/main.rs +++ b/repbuild/src/main.rs @@ -8,6 +8,7 @@ fn main() -> Result<(), Error> { env_logger::init(); let mut args = std::env::args(); args.next(); + // TODO: work on adding in system.toml support match args.next().as_deref() { Some("build" | "b") => {