From 6bf591a3137da701543d4bf50f761a589781b2ec Mon Sep 17 00:00:00 2001 From: Able Date: Sat, 26 Mar 2022 06:35:33 -0500 Subject: [PATCH] incorperate axel --- ableos/Cargo.lock | 12 ++++++++++++ ableos/Cargo.toml | 3 +++ ableos/assets/kernel.toml | 1 + ableos/src/boot_conf.rs | 1 + ableos/src/devices/dev_vterm.rs | 1 + ableos/src/logger.rs | 28 +++++++++++++++------------- ableos/src/rhai_shell/balloon.txt | 4 ++-- ableos/src/rhai_shell/mod.rs | 8 ++++++++ ableos/src/scratchpad.rs | 14 ++++++++++++++ 9 files changed, 57 insertions(+), 15 deletions(-) diff --git a/ableos/Cargo.lock b/ableos/Cargo.lock index 0eb2927..43c2c87 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 702afe4..7c783dc 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 e29e993..f12e603 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 c48daf8..f875eef 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 40c348d..39909a1 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 dfe539e..cc4cbba 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 0685083..a44994c 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 47b4034..c93721b 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 f38b84c..da2a517 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(); }