merge work

This commit is contained in:
Able 2022-03-11 14:18:07 -06:00
parent a857253314
commit 0c1169adab
8 changed files with 43 additions and 32 deletions

1
.gitignore vendored
View file

@ -5,5 +5,6 @@ facepalm/target
shadeable/target shadeable/target
qprofiler qprofiler
userland/*/target userland/*/target
kernel/target
kernel/target kernel/target

View file

@ -133,7 +133,7 @@ impl Write for Uart {
// / RUST MACROS // / RUST MACROS
// /////////////////////////////////// // ///////////////////////////////////
#[macro_export] #[macro_export]
macro_rules! print macro_rules! sprint
{ {
($($args:tt)+) => ({ ($($args:tt)+) => ({
use core::fmt::Write; use core::fmt::Write;
@ -141,7 +141,7 @@ macro_rules! print
}); });
} }
#[macro_export] #[macro_export]
macro_rules! println macro_rules! sprintln
{ {
() => ({ () => ({
print!("\r\n") print!("\r\n")

View file

@ -4,58 +4,58 @@ pub fn colorify(eval: &str) {
for z in y { for z in y {
match z { match z {
"BLACK" => { "BLACK" => {
set_vga_color(Color::Black, Color::Black); // set_vga_color(Color::Black, Color::Black);
} }
"RED" => { "RED" => {
set_vga_color(Color::Red, Color::Black); // set_vga_color(Color::Red, Color::Black);
} }
"GREEN" => { "GREEN" => {
set_vga_color(Color::Green, Color::Black); // set_vga_color(Color::Green, Color::Black);
} }
"BLUE" => { "BLUE" => {
set_vga_color(Color::Blue, Color::Black); // set_vga_color(Color::Blue, Color::Black);
} }
"CYAN" => { "CYAN" => {
set_vga_color(Color::Cyan, Color::Black); // set_vga_color(Color::Cyan, Color::Black);
} }
"MAGENTA" => { "MAGENTA" => {
set_vga_color(Color::Magenta, Color::Black); // set_vga_color(Color::Magenta, Color::Black);
} }
"BROWN" => { "BROWN" => {
set_vga_color(Color::Brown, Color::Black); // set_vga_color(Color::Brown, Color::Black);
} }
"LIGHTGRAY" => { "LIGHTGRAY" => {
set_vga_color(Color::LightGray, Color::Black); // set_vga_color(Color::LightGray, Color::Black);
} }
"DARKGRAY" => { "DARKGRAY" => {
set_vga_color(Color::DarkGray, Color::Black); // set_vga_color(Color::DarkGray, Color::Black);
} }
"LIGHTBLUE" => { "LIGHTBLUE" => {
set_vga_color(Color::LightBlue, Color::Black); // set_vga_color(Color::LightBlue, Color::Black);
} }
"LIGHTGREEN" => { "LIGHTGREEN" => {
set_vga_color(Color::LightGreen, Color::Black); // set_vga_color(Color::LightGreen, Color::Black);
} }
"LIGHTCYAN" => { "LIGHTCYAN" => {
set_vga_color(Color::LightCyan, Color::Black); // set_vga_color(Color::LightCyan, Color::Black);
} }
"LIGHTRED" => { "LIGHTRED" => {
set_vga_color(Color::LightRed, Color::Black); // set_vga_color(Color::LightRed, Color::Black);
} }
"PINK" => { "PINK" => {
set_vga_color(Color::Pink, Color::Black); // set_vga_color(Color::Pink, Color::Black);
} }
"YELLOW" => { "YELLOW" => {
set_vga_color(Color::Yellow, Color::Black); // set_vga_color(Color::Yellow, Color::Black);
} }
"WHITE" => { "WHITE" => {
set_vga_color(Color::White, Color::Black); // set_vga_color(Color::White, Color::Black);
} }
"RESET" => { "RESET" => {
set_vga_color(Color::White, Color::Black); // set_vga_color(Color::White, Color::Black);
} }
elk => { elk => {
kprint!("{}", elk); // kprint!("{}", elk);
} }
} }
} }
@ -85,13 +85,13 @@ pub fn colorify_2(eval: &str) {
use Token::*; use Token::*;
match token { match token {
Red => { Red => {
set_vga_color(Color::Red, Color::Black); // set_vga_color(Color::Red, Color::Black);
} }
Reset => { Reset => {
set_vga_color(Color::White, Color::Black); // set_vga_color(Color::White, Color::Black);
} }
Text(text) => { Text(text) => {
kprint!("{}", text); // kprint!("{}", text);
} }
err => { err => {
error!("Error parsing {:?}", err); error!("Error parsing {:?}", err);
@ -101,7 +101,7 @@ pub fn colorify_2(eval: &str) {
} }
use logos::Lexer; use logos::Lexer;
use crate::kprint; // use crate::kprint;
fn parse_text(lex: &mut Lexer<Token>) -> Option<String> { fn parse_text(lex: &mut Lexer<Token>) -> Option<String> {
let slice = lex.slice(); let slice = lex.slice();
Some(String::from(slice)) Some(String::from(slice))

View file

@ -126,7 +126,7 @@ impl ScreenBuffer {
// TODO force clear // TODO force clear
pub fn force_redraw(&mut self) { 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 /// Draw a glyph on the screen at the given position

View file

@ -132,7 +132,7 @@ pub fn cpu_socket_startup() {
} }
pub fn log_version_data() { pub fn log_version_data() {
info!("{} v{}", RELEASE_TYPE, KERNEL_VERSION); info!("{} v{:?}", RELEASE_TYPE, KERNEL_VERSION);
info!( info!(
"Brand String: ", "Brand String: ",
// master().unwrap().brand_string().unwrap() // 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};

View file

@ -34,10 +34,12 @@ pub mod arch;
#[macro_use] #[macro_use]
pub mod print; pub mod print;
pub mod devices; pub mod devices;
pub mod port_io;
pub mod rhai_shell; pub mod rhai_shell;
pub mod wasm_jumploader; pub mod wasm_jumploader;
#[cfg(target_arch = "x86_64")]
pub mod port_io;
#[macro_use] #[macro_use]
pub extern crate log; pub extern crate log;
@ -85,8 +87,10 @@ pub use virtio::*;
// pub mod alias_table; // pub mod alias_table;
// pub use alias_table::*; // pub use alias_table::*;
#[cfg(target_arch = "x86_64")]
pub mod tests; pub mod tests;
#[cfg(target_arch = "x86_64")]
pub use tests::*; pub use tests::*;
pub mod scratchpad; pub mod scratchpad;

View file

@ -1,7 +1,7 @@
use core::sync::atomic::Ordering; use core::sync::atomic::Ordering;
use crate::network::socket::{SimpleSock, Socket}; use crate::network::socket::{SimpleSock, Socket};
use crate::serial_println; // use crate::serial_println;
use kernel::TICK; use kernel::TICK;
use lliw::{Fg, Reset}; use lliw::{Fg, Reset};
@ -37,7 +37,9 @@ impl log::Log for SimpleLogger {
time_float, time_float,
record.args() record.args()
); );
serial_println!(
// NOTE: This needs to be fixed before merge
println!(
"[{}{}{}][{}{}{}] {}", "[{}{}{}][{}{}{}] {}",
color.0, color.0,
record.level(), record.level(),

View file

@ -35,9 +35,9 @@ impl Externals for HostExternals {
GET_TIME_INDEX => { GET_TIME_INDEX => {
use core::sync::atomic::Ordering::*; use core::sync::atomic::Ordering::*;
x86_64::instructions::interrupts::disable(); // x86_64::instructions::interrupts::disable();
let tick_time = kernel::TICK.load(Relaxed); 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()); let ret = RuntimeValue::I64(tick_time.try_into().unwrap());
Ok(Some(ret)) Ok(Some(ret))