forked from AbleOS/ableos
minor cleanups
This commit is contained in:
parent
5af29efe17
commit
a2bf48f56b
|
@ -1,11 +1,11 @@
|
||||||
use {hbvm::engine::Engine};
|
use hbvm::engine::Engine;
|
||||||
|
|
||||||
use {
|
use {
|
||||||
|
crate::ipc::message::Message,
|
||||||
crossbeam_queue::{ArrayQueue, SegQueue},
|
crossbeam_queue::{ArrayQueue, SegQueue},
|
||||||
log::trace,
|
log::trace,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{ipc::message::Message};
|
|
||||||
pub enum HostError {
|
pub enum HostError {
|
||||||
MemoryError,
|
MemoryError,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +1,27 @@
|
||||||
//! AbleOS Kernel Entrypoint
|
//! AbleOS Kernel Entrypoint
|
||||||
|
|
||||||
// use std::collections::HashMap;
|
|
||||||
|
|
||||||
use {
|
use {
|
||||||
log::info,
|
crate::{alloc::string::ToString, arch::logging::SERIAL_CONSOLE, device_tree::DeviceTree},
|
||||||
|
hbvm::engine::Engine,
|
||||||
|
log::{debug, info},
|
||||||
spin::{Lazy, Mutex},
|
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]>) -> ! {
|
pub fn kmain(cmdline: &str, bootstrap: Option<&'static [u8]>) -> ! {
|
||||||
log::debug!("Entered kmain");
|
debug!("Entered kmain");
|
||||||
|
|
||||||
let mut cmdline = cmdline.to_string();
|
let mut cmdline = cmdline.to_string();
|
||||||
cmdline.pop();
|
cmdline.pop();
|
||||||
cmdline.remove(0);
|
cmdline.remove(0);
|
||||||
|
|
||||||
let kcmd = clparse::Arguments::parse(cmdline.to_string()).unwrap();
|
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 mut kcl = xml::XMLElement::new("Kernel Command Line");
|
||||||
let _ = crate::arch::log(format_args!(include_str!("../data/⑨. バカ")));
|
for (key, value) in kcmd.arguments {
|
||||||
}
|
kcl.set_attribute(key, value);
|
||||||
|
|
||||||
if kcmd.arguments.get("foobles") == Some(&"true".to_string()) {
|
|
||||||
let _ = crate::arch::log(format_args!("foobles\n\r"));
|
|
||||||
}
|
}
|
||||||
|
info!("kernel command line object: {:?}", kcl);
|
||||||
|
|
||||||
let bootstrap = bootstrap/*.expect("no bootstrap found")*/;
|
let bootstrap = bootstrap/*.expect("no bootstrap found")*/;
|
||||||
match bootstrap {
|
match bootstrap {
|
||||||
|
@ -65,8 +53,6 @@ pub fn kmain(cmdline: &str, bootstrap: Option<&'static [u8]>) -> ! {
|
||||||
sc.send(byte);
|
sc.send(byte);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// crate::arch::sloop()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub static DEVICE_TREE: Lazy<Mutex<DeviceTree>> = Lazy::new(|| {
|
pub static DEVICE_TREE: Lazy<Mutex<DeviceTree>> = Lazy::new(|| {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// TODO: Add a logger api with logger levels and various outputs
|
||||||
|
|
||||||
use log::{Level, SetLoggerError};
|
use log::{Level, SetLoggerError};
|
||||||
|
|
||||||
pub fn init() -> Result<(), SetLoggerError> {
|
pub fn init() -> Result<(), SetLoggerError> {
|
||||||
|
|
|
@ -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
|
|
||||||
```
|
|
|
@ -8,6 +8,7 @@ fn main() -> Result<(), Error> {
|
||||||
env_logger::init();
|
env_logger::init();
|
||||||
let mut args = std::env::args();
|
let mut args = std::env::args();
|
||||||
args.next();
|
args.next();
|
||||||
|
// TODO: work on adding in system.toml support
|
||||||
|
|
||||||
match args.next().as_deref() {
|
match args.next().as_deref() {
|
||||||
Some("build" | "b") => {
|
Some("build" | "b") => {
|
||||||
|
|
Loading…
Reference in a new issue