From 0c1169adab9c5f2922857bfaa8e4a092824842e7 Mon Sep 17 00:00:00 2001 From: Able Date: Fri, 11 Mar 2022 14:18:07 -0600 Subject: [PATCH] merge work --- .gitignore | 1 + ableos/src/arch/riscv/drivers/uart.rs | 4 +- ableos/src/experiments/absi.rs | 44 ++++++++++---------- ableos/src/graphics/mod.rs | 2 +- ableos/src/kmain.rs | 6 ++- ableos/src/lib.rs | 8 +++- ableos/src/logger.rs | 6 ++- ableos/src/wasm_jumploader/host_functions.rs | 4 +- 8 files changed, 43 insertions(+), 32 deletions(-) diff --git a/.gitignore b/.gitignore index 08e88087..be265782 100644 --- a/.gitignore +++ b/.gitignore @@ -5,5 +5,6 @@ facepalm/target shadeable/target qprofiler userland/*/target +kernel/target kernel/target \ No newline at end of file diff --git a/ableos/src/arch/riscv/drivers/uart.rs b/ableos/src/arch/riscv/drivers/uart.rs index 1951beef..bff60171 100644 --- a/ableos/src/arch/riscv/drivers/uart.rs +++ b/ableos/src/arch/riscv/drivers/uart.rs @@ -133,7 +133,7 @@ impl Write for Uart { // / RUST MACROS // /////////////////////////////////// #[macro_export] -macro_rules! print +macro_rules! sprint { ($($args:tt)+) => ({ use core::fmt::Write; @@ -141,7 +141,7 @@ macro_rules! print }); } #[macro_export] -macro_rules! println +macro_rules! sprintln { () => ({ print!("\r\n") diff --git a/ableos/src/experiments/absi.rs b/ableos/src/experiments/absi.rs index aae1bee4..ccad9d74 100644 --- a/ableos/src/experiments/absi.rs +++ b/ableos/src/experiments/absi.rs @@ -4,58 +4,58 @@ pub fn colorify(eval: &str) { for z in y { match z { "BLACK" => { - set_vga_color(Color::Black, Color::Black); + // set_vga_color(Color::Black, Color::Black); } "RED" => { - set_vga_color(Color::Red, Color::Black); + // set_vga_color(Color::Red, Color::Black); } "GREEN" => { - set_vga_color(Color::Green, Color::Black); + // set_vga_color(Color::Green, Color::Black); } "BLUE" => { - set_vga_color(Color::Blue, Color::Black); + // set_vga_color(Color::Blue, Color::Black); } "CYAN" => { - set_vga_color(Color::Cyan, Color::Black); + // set_vga_color(Color::Cyan, Color::Black); } "MAGENTA" => { - set_vga_color(Color::Magenta, Color::Black); + // set_vga_color(Color::Magenta, Color::Black); } "BROWN" => { - set_vga_color(Color::Brown, Color::Black); + // set_vga_color(Color::Brown, Color::Black); } "LIGHTGRAY" => { - set_vga_color(Color::LightGray, Color::Black); + // set_vga_color(Color::LightGray, Color::Black); } "DARKGRAY" => { - set_vga_color(Color::DarkGray, Color::Black); + // set_vga_color(Color::DarkGray, Color::Black); } "LIGHTBLUE" => { - set_vga_color(Color::LightBlue, Color::Black); + // set_vga_color(Color::LightBlue, Color::Black); } "LIGHTGREEN" => { - set_vga_color(Color::LightGreen, Color::Black); + // set_vga_color(Color::LightGreen, Color::Black); } "LIGHTCYAN" => { - set_vga_color(Color::LightCyan, Color::Black); + // set_vga_color(Color::LightCyan, Color::Black); } "LIGHTRED" => { - set_vga_color(Color::LightRed, Color::Black); + // set_vga_color(Color::LightRed, Color::Black); } "PINK" => { - set_vga_color(Color::Pink, Color::Black); + // set_vga_color(Color::Pink, Color::Black); } "YELLOW" => { - set_vga_color(Color::Yellow, Color::Black); + // set_vga_color(Color::Yellow, Color::Black); } "WHITE" => { - set_vga_color(Color::White, Color::Black); + // set_vga_color(Color::White, Color::Black); } "RESET" => { - set_vga_color(Color::White, Color::Black); + // set_vga_color(Color::White, Color::Black); } elk => { - kprint!("{}", elk); + // kprint!("{}", elk); } } } @@ -85,13 +85,13 @@ pub fn colorify_2(eval: &str) { use Token::*; match token { Red => { - set_vga_color(Color::Red, Color::Black); + // set_vga_color(Color::Red, Color::Black); } Reset => { - set_vga_color(Color::White, Color::Black); + // set_vga_color(Color::White, Color::Black); } Text(text) => { - kprint!("{}", text); + // kprint!("{}", text); } err => { error!("Error parsing {:?}", err); @@ -101,7 +101,7 @@ pub fn colorify_2(eval: &str) { } use logos::Lexer; -use crate::kprint; +// use crate::kprint; fn parse_text(lex: &mut Lexer) -> Option { let slice = lex.slice(); Some(String::from(slice)) diff --git a/ableos/src/graphics/mod.rs b/ableos/src/graphics/mod.rs index 2e487b85..e4f7b52f 100644 --- a/ableos/src/graphics/mod.rs +++ b/ableos/src/graphics/mod.rs @@ -126,7 +126,7 @@ impl ScreenBuffer { // TODO force clear pub fn force_redraw(&mut self) { - VGAE.lock().clear_screen(vga::colors::Color16::Black); + // VGAE.lock().clear_screen(vga::colors::Color16::Black); } /// Draw a glyph on the screen at the given position diff --git a/ableos/src/kmain.rs b/ableos/src/kmain.rs index 7e148edc..bd742e44 100644 --- a/ableos/src/kmain.rs +++ b/ableos/src/kmain.rs @@ -132,7 +132,7 @@ pub fn cpu_socket_startup() { } pub fn log_version_data() { - info!("{} v{}", RELEASE_TYPE, KERNEL_VERSION); + info!("{} v{:?}", RELEASE_TYPE, KERNEL_VERSION); info!( "Brand String: ", // master().unwrap().brand_string().unwrap() @@ -173,3 +173,7 @@ impl acpi::AcpiHandler for AcpiStruct { } } */ + +use kernel::KERNEL_VERSION; + +use crate::{boot_conf::KernelConfig, scheduler::SCHEDULER, systeminfo::RELEASE_TYPE}; diff --git a/ableos/src/lib.rs b/ableos/src/lib.rs index 27adca8b..f5f33468 100644 --- a/ableos/src/lib.rs +++ b/ableos/src/lib.rs @@ -34,10 +34,12 @@ pub mod arch; #[macro_use] pub mod print; pub mod devices; -pub mod port_io; pub mod rhai_shell; pub mod wasm_jumploader; +#[cfg(target_arch = "x86_64")] +pub mod port_io; + #[macro_use] pub extern crate log; @@ -85,8 +87,10 @@ pub use virtio::*; // pub mod alias_table; // pub use alias_table::*; - +#[cfg(target_arch = "x86_64")] pub mod tests; + +#[cfg(target_arch = "x86_64")] pub use tests::*; pub mod scratchpad; diff --git a/ableos/src/logger.rs b/ableos/src/logger.rs index 0b5cfdbc..ad3fea3c 100644 --- a/ableos/src/logger.rs +++ b/ableos/src/logger.rs @@ -1,7 +1,7 @@ use core::sync::atomic::Ordering; use crate::network::socket::{SimpleSock, Socket}; -use crate::serial_println; +// use crate::serial_println; use kernel::TICK; use lliw::{Fg, Reset}; @@ -37,7 +37,9 @@ impl log::Log for SimpleLogger { time_float, record.args() ); - serial_println!( + + // NOTE: This needs to be fixed before merge + println!( "[{}{}{}][{}{}{}] {}", color.0, record.level(), diff --git a/ableos/src/wasm_jumploader/host_functions.rs b/ableos/src/wasm_jumploader/host_functions.rs index 52140c33..6e45addb 100644 --- a/ableos/src/wasm_jumploader/host_functions.rs +++ b/ableos/src/wasm_jumploader/host_functions.rs @@ -35,9 +35,9 @@ impl Externals for HostExternals { GET_TIME_INDEX => { use core::sync::atomic::Ordering::*; - x86_64::instructions::interrupts::disable(); + // x86_64::instructions::interrupts::disable(); let tick_time = kernel::TICK.load(Relaxed); - x86_64::instructions::interrupts::enable(); + // x86_64::instructions::interrupts::enable(); let ret = RuntimeValue::I64(tick_time.try_into().unwrap()); Ok(Some(ret))