diff --git a/ableos/Cargo.lock b/ableos/Cargo.lock index 0eb2927f..43c2c87c 100644 --- a/ableos/Cargo.lock +++ b/ableos/Cargo.lock @@ -28,6 +28,7 @@ version = "0.1.1" dependencies = [ "ab_glyph", "acpi", + "axel", "bootloader", "cpuio", "ext2", @@ -108,6 +109,17 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "axel" +version = "0.1.0" +source = "git+https://git.ablecorp.us/able/axel.git#2bd44d47d94158a85505581abbe526085ee62fb8" +dependencies = [ + "hashbrown 0.12.0", + "log", + "logos", + "versioning", +] + [[package]] name = "bare-metal" version = "1.0.0" diff --git a/ableos/Cargo.toml b/ableos/Cargo.toml index 702afe45..7c783dcf 100644 --- a/ableos/Cargo.toml +++ b/ableos/Cargo.toml @@ -57,6 +57,9 @@ rhai = "1.5" libwasm = {git="https://git.ablecorp.us:443/able/libwasm.git"} acpi = "4.1.0" +axel = { git = "https://git.ablecorp.us:443/able/axel.git" } + + [dependencies.logos] version = "0.12.0" default-features = false diff --git a/ableos/assets/kernel.toml b/ableos/assets/kernel.toml index e29e993f..f12e603f 100644 --- a/ableos/assets/kernel.toml +++ b/ableos/assets/kernel.toml @@ -5,6 +5,7 @@ user_processes = ["shell"] [logging] enabled = true level = "Trace" +log_to_serial = true [tests] run_tests = false diff --git a/ableos/src/boot_conf.rs b/ableos/src/boot_conf.rs index c48daf8b..f875eef9 100644 --- a/ableos/src/boot_conf.rs +++ b/ableos/src/boot_conf.rs @@ -46,6 +46,7 @@ impl KernelConfig { #[derive(Serialize, Debug, Deserialize)] pub struct LoggingConfig { pub enabled: bool, + pub log_to_serial: bool, pub level: LogLevel, } #[derive(Serialize, Debug, Deserialize)] diff --git a/ableos/src/devices/dev_vterm.rs b/ableos/src/devices/dev_vterm.rs index 40c348df..39909a1c 100644 --- a/ableos/src/devices/dev_vterm.rs +++ b/ableos/src/devices/dev_vterm.rs @@ -97,6 +97,7 @@ impl Style { } #[derive(Debug)] pub struct VTerm { + /// Internal ID of the vterm iid: u32, pub characters: [[VtermCharacter; VTERM_WIDTH as usize]; VTERM_HEIGHT as usize], /// The internal representation of the vterm diff --git a/ableos/src/logger.rs b/ableos/src/logger.rs index dfe539e2..cc4cbbae 100644 --- a/ableos/src/logger.rs +++ b/ableos/src/logger.rs @@ -1,7 +1,8 @@ -use core::sync::atomic::Ordering; - +use crate::boot_conf; +use crate::kmain::KERNEL_CONF; use crate::network::socket::{SimpleSock, Socket}; use crate::time::fetch_time; +use core::sync::atomic::Ordering; use kernel::TICK; use lliw::{Fg, Reset}; @@ -38,17 +39,18 @@ impl log::Log for SimpleLogger { ); // kprint!("{}", msg); // NOTE: This needs to be fixed before merge - - serial_println!( - "[{}{}{}][{}{}{}] {}", - color.0, - record.level(), - Fg::Reset, - Fg::Green, - time_float, - Reset, - record.args() - ); + if KERNEL_CONF.logging.log_to_serial { + serial_println!( + "[{}{}{}][{}{}{}] {}", + color.0, + record.level(), + Fg::Reset, + Fg::Green, + time_float, + Reset, + record.args() + ); + } let log_socket_id = SimpleSock::grab_socket("Logger".to_string()); match log_socket_id { diff --git a/ableos/src/rhai_shell/balloon.txt b/ableos/src/rhai_shell/balloon.txt index 0685083c..a44994c8 100644 --- a/ableos/src/rhai_shell/balloon.txt +++ b/ableos/src/rhai_shell/balloon.txt @@ -1,6 +1,6 @@ ,-""""-. OS: AbleOS - ,' _ `. Host: {} - / )_) \ Kernel: AKern-{}-v{} + ,'\ _ _`. Host: {} + / \)_)-)_)-\ Kernel: AKern-{}-v{} : : Uptime: {} \ / Packages: None \ / Shell: RhaiShell diff --git a/ableos/src/rhai_shell/mod.rs b/ableos/src/rhai_shell/mod.rs index 47b4034a..c93721be 100644 --- a/ableos/src/rhai_shell/mod.rs +++ b/ableos/src/rhai_shell/mod.rs @@ -23,6 +23,14 @@ pub fn shell() { Some('\u{0008}') => { buf.pop(); } + + Some('\u{0009}') => { + buf.push(' '); + buf.push(' '); + buf.push(' '); + buf.push(' '); + } + Some(chr) => buf.push(chr), None => (), } diff --git a/ableos/src/scratchpad.rs b/ableos/src/scratchpad.rs index f38b84c8..da2a5173 100644 --- a/ableos/src/scratchpad.rs +++ b/ableos/src/scratchpad.rs @@ -10,6 +10,20 @@ use crate::devices::Device::Vterm; /// Experimental scratchpad for testing. pub fn scratchpad() { + let axel_raw = " +kernel{ + vals= + time: 123 + fn| + print: (None) -> (None); + foo: (None) -> (Num); +} +"; + let axel = axel::parse(axel_raw.to_string()); + for node in axel { + info!("{:?}", node); + } + shell(); }