forked from koniifer/ableos
Patch| Logging repaired
This commit is contained in:
parent
4b6dae5fd1
commit
d2638b1fb4
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -6,5 +6,3 @@ shadeable/target
|
|||
qprofiler
|
||||
userland/*/target
|
||||
kernel/target
|
||||
|
||||
kernel/target
|
|
@ -1,5 +1,6 @@
|
|||
[build]
|
||||
target = "riscv64gc-unknown-none-elf"
|
||||
# target = "riscv64gc-unknown-none-elf"
|
||||
target = "json_targets/x86_64-ableos.json"
|
||||
|
||||
[unstable]
|
||||
build-std = ["core", "compiler_builtins", "alloc"]
|
||||
|
|
44
ableos/Cargo.lock
generated
44
ableos/Cargo.lock
generated
|
@ -34,7 +34,7 @@ dependencies = [
|
|||
"externc-libm",
|
||||
"facepalm",
|
||||
"genfs",
|
||||
"hashbrown 0.11.2",
|
||||
"hashbrown 0.7.2",
|
||||
"kernel",
|
||||
"lazy_static",
|
||||
"libwasm",
|
||||
|
@ -56,6 +56,7 @@ dependencies = [
|
|||
"toml",
|
||||
"uart_16550",
|
||||
"unicode-width",
|
||||
"vga",
|
||||
"volatile 0.2.7",
|
||||
"wasmi",
|
||||
"watson",
|
||||
|
@ -143,6 +144,21 @@ version = "1.0.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "conquer-once"
|
||||
version = "0.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7c6d3a9775a69f6d1fe2cc888999b67ed30257d3da4d2af91984e722f2ec918a"
|
||||
dependencies = [
|
||||
"conquer-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "conquer-util"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e763eef8846b13b380f37dfecda401770b0ca4e56e95170237bd7c25c7db3582"
|
||||
|
||||
[[package]]
|
||||
name = "const-random"
|
||||
version = "0.1.13"
|
||||
|
@ -223,6 +239,12 @@ version = "1.0.7"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
|
||||
|
||||
[[package]]
|
||||
name = "font8x8"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "875488b8711a968268c7cf5d139578713097ca4635a76044e8fe8eedf831d07e"
|
||||
|
||||
[[package]]
|
||||
name = "genfs"
|
||||
version = "0.1.4"
|
||||
|
@ -250,12 +272,6 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.11.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e"
|
||||
|
||||
[[package]]
|
||||
name = "hashbrown"
|
||||
version = "0.12.0"
|
||||
|
@ -788,6 +804,20 @@ name = "versioning"
|
|||
version = "0.1.2"
|
||||
source = "git+https://git.ablecorp.us/able/versioning#ef472283e6e7a2e395ee56434087b3a6fad53ff2"
|
||||
|
||||
[[package]]
|
||||
name = "vga"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "67cbcb7bfff998d176ffb8f2c3dfd6cb0fe62740e36dee6c64fc3928c01001bf"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"conquer-once",
|
||||
"font8x8",
|
||||
"num-traits",
|
||||
"spinning_top",
|
||||
"x86_64",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "volatile"
|
||||
version = "0.2.7"
|
||||
|
|
|
@ -93,11 +93,16 @@ features = ["derive", "alloc"]
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
[dependencies.hashbrown]
|
||||
version = "0.11.2"
|
||||
version = "0.7.2"
|
||||
default-features = false
|
||||
features = ["inline-more"]
|
||||
|
||||
|
||||
|
||||
|
||||
[dependencies.rkyv]
|
||||
version = "0.7.29"
|
||||
default-features = false
|
||||
|
@ -159,3 +164,4 @@ uart_16550 = "0.2.0"
|
|||
volatile = "0.2.6"
|
||||
x86_64 = "*"
|
||||
pc-beeper = {git = "https://github.com/AbleOS/pc-beeper"}
|
||||
vga = "*"
|
||||
|
|
|
@ -3,7 +3,7 @@ system_processes = []
|
|||
user_processes = ["shell"]
|
||||
|
||||
[logging]
|
||||
enabled = false
|
||||
enabled = true
|
||||
level = "Trace"
|
||||
|
||||
[tests]
|
||||
|
|
|
@ -144,11 +144,11 @@ macro_rules! sprint
|
|||
macro_rules! sprintln
|
||||
{
|
||||
() => ({
|
||||
print!("\r\n")
|
||||
sprint!("\r\n")
|
||||
});
|
||||
|
||||
($fmt:expr) => (print!(concat!($fmt, "\r\n")));
|
||||
($fmt:expr) => (sprint!(concat!($fmt, "\r\n")));
|
||||
($fmt:expr, $($args:tt)+) => ({
|
||||
print!(concat!($fmt, "\r\n"), $($args)+)
|
||||
sprint!(concat!($fmt, "\r\n"), $($args)+)
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// #![allow(clippy::print_literal)]
|
||||
use crate::{logger, SCHEDULER};
|
||||
use crate::{logger, scheduler::SCHEDULER, serial_println};
|
||||
|
||||
use super::{gdt, interrupts};
|
||||
|
||||
|
@ -13,7 +13,9 @@ pub fn init() {
|
|||
|
||||
let result = logger::init();
|
||||
match result {
|
||||
Ok(_) => {}
|
||||
Ok(_) => {
|
||||
serial_println!("Logger initialized");
|
||||
}
|
||||
Err(err) => error!("{}", err),
|
||||
}
|
||||
gdt::init();
|
||||
|
|
|
@ -57,5 +57,6 @@ pub struct TestsConfig {
|
|||
|
||||
#[derive(Serialize, Debug, Deserialize)]
|
||||
pub struct BootConfig {
|
||||
pub processes: Vec<String>,
|
||||
pub system_processes: Vec<String>,
|
||||
pub user_processes: Vec<String>,
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
// TODO improve tokenizer/parser
|
||||
|
||||
pub fn colorify(eval: &str) {
|
||||
let y = eval.split("$");
|
||||
for z in y {
|
||||
|
|
|
@ -8,14 +8,8 @@
|
|||
use {
|
||||
crate::{
|
||||
arch::{init, sloop},
|
||||
|
||||
relib::network::socket::{SimpleSock, Socket},
|
||||
// scheduler::SCHEDULER,
|
||||
// VgaBuffer,
|
||||
// SCREEN_BUFFER,
|
||||
scratchpad,
|
||||
// SCHEDULER,
|
||||
SCREEN_BUFFER,
|
||||
},
|
||||
facepalm::start_facepalm,
|
||||
lazy_static::lazy_static,
|
||||
|
@ -36,89 +30,18 @@ pub fn kernel_main() -> ! {
|
|||
} else {
|
||||
log::set_max_level(log::LevelFilter::Off);
|
||||
}
|
||||
|
||||
let mut scheduler = SCHEDULER.lock();
|
||||
/*
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
use crate::scheduler::Priority::*;
|
||||
let mut process_1 = scheduler.new_process(High);
|
||||
process_1.capabilities.files = FileAccess::Some(vec![PathRep {
|
||||
location: FileLocations::Home,
|
||||
file_name: "test".to_string(),
|
||||
}]);
|
||||
process_1.capabilities.files = FileAccess::Some(vec![]);
|
||||
scheduler.add_process(process_1);
|
||||
for ref_process in &scheduler.list {
|
||||
trace!("{:?}", ref_process);
|
||||
}
|
||||
drop(scheduler);
|
||||
|
||||
|
||||
|
||||
*/
|
||||
// use crate::proto_filetable::file::FileLocations;
|
||||
|
||||
/*
|
||||
if false {
|
||||
let mut sock_print_id = SimpleSock::new();
|
||||
sock_print_id.register_protocol("Screen Printer".to_string());
|
||||
sock_print_id.write(format!("🐑").into());
|
||||
|
||||
let mut mode = SCREEN_BUFFER.lock();
|
||||
|
||||
mode.force_redraw();
|
||||
for current in (*String::from_utf8_lossy(&sock_print_id.peek().unwrap())).chars() {
|
||||
// mode.draw_char(0, 0, current, from_vga_16(Color16::Red));
|
||||
}
|
||||
// mode.copy_to_buffer();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
*/
|
||||
/*
|
||||
// TODO: create a scratchpad module
|
||||
if false {
|
||||
// Currently not implemented
|
||||
let acpi_handler = AcpiStruct {};
|
||||
let mut table;
|
||||
unsafe {
|
||||
table = AcpiTables::search_for_rsdp_bios(acpi_handler);
|
||||
}
|
||||
}
|
||||
|
||||
=======
|
||||
mode.copy_to_buffer();
|
||||
}
|
||||
|
||||
start_facepalm();
|
||||
scratchpad();
|
||||
>>>>>>> master
|
||||
|
||||
*/
|
||||
// start_facepalm();
|
||||
// scratchpad();
|
||||
|
||||
/*
|
||||
if false {
|
||||
// disable();
|
||||
let mut mode = SCREEN_BUFFER.lock();
|
||||
mode.force_redraw();
|
||||
|
||||
// mode.copy_to_buffer();
|
||||
mode.clear();
|
||||
|
||||
mode.draw_char(0, 0, 'v', 0xff00ffff);
|
||||
|
||||
// mode.copy_to_buffer();
|
||||
drop(mode);
|
||||
// enable()
|
||||
// sloop::halt();
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
scratchpad();
|
||||
|
||||
sloop()
|
||||
}
|
||||
|
@ -176,4 +99,10 @@ impl acpi::AcpiHandler for AcpiStruct {
|
|||
|
||||
use kernel::KERNEL_VERSION;
|
||||
|
||||
use crate::{boot_conf::KernelConfig, scheduler::SCHEDULER, systeminfo::RELEASE_TYPE};
|
||||
use crate::{
|
||||
boot_conf::KernelConfig,
|
||||
kprint,
|
||||
scheduler::{capabilities::FileAccess, SCHEDULER},
|
||||
serial_print, serial_println,
|
||||
systeminfo::RELEASE_TYPE,
|
||||
};
|
||||
|
|
|
@ -87,11 +87,9 @@ 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 tests;
|
||||
// pub use tests::*;
|
||||
|
||||
pub mod scratchpad;
|
||||
pub use scratchpad::*;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use core::sync::atomic::Ordering;
|
||||
|
||||
use crate::network::socket::{SimpleSock, Socket};
|
||||
// use crate::serial_println;
|
||||
use crate::{kprint, serial_println};
|
||||
|
||||
use kernel::TICK;
|
||||
use lliw::{Fg, Reset};
|
||||
|
@ -19,8 +19,9 @@ impl log::Log for SimpleLogger {
|
|||
fn log(&self, record: &Record) {
|
||||
if self.enabled(record.metadata()) {
|
||||
let color;
|
||||
disable();
|
||||
let time = TICK.load(Ordering::Relaxed) as f64;
|
||||
|
||||
enable();
|
||||
let time_float = time;
|
||||
|
||||
match record.level() {
|
||||
|
@ -37,9 +38,10 @@ impl log::Log for SimpleLogger {
|
|||
time_float,
|
||||
record.args()
|
||||
);
|
||||
|
||||
// kprint!("{}", msg);
|
||||
// NOTE: This needs to be fixed before merge
|
||||
println!(
|
||||
|
||||
serial_println!(
|
||||
"[{}{}{}][{}{}{}] {}",
|
||||
color.0,
|
||||
record.level(),
|
||||
|
@ -64,6 +66,7 @@ impl log::Log for SimpleLogger {
|
|||
}
|
||||
|
||||
use log::{LevelFilter, SetLoggerError};
|
||||
use x86_64::instructions::interrupts::{disable, enable};
|
||||
|
||||
static LOGGER: SimpleLogger = SimpleLogger;
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
use acpi::AcpiTables;
|
||||
|
||||
use crate::rhai_shell::rhai_shell;
|
||||
use crate::{kprintln, rhai_shell::rhai_shell, serial_println};
|
||||
|
||||
/// Experimental scratchpad for testing.
|
||||
pub fn scratchpad() {
|
||||
pci_fun();
|
||||
// pci_fun();
|
||||
|
||||
rhai_shell();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue