From 762b2aa3ae6100736ced015af236676192a9bbe3 Mon Sep 17 00:00:00 2001 From: able Date: Sun, 19 Nov 2023 18:15:03 -0600 Subject: [PATCH] working on logs --- kernel/src/holeybytes/ecah.rs | 15 +++++++-------- sysdata/limine.cfg | 16 ++++++++-------- sysdata/test-programs/ecall.rhai | 6 +++--- .../test-programs/limine_framebuffer_driver.rhai | 11 +++++++++-- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/kernel/src/holeybytes/ecah.rs b/kernel/src/holeybytes/ecah.rs index f25c0f8..cca6663 100644 --- a/kernel/src/holeybytes/ecah.rs +++ b/kernel/src/holeybytes/ecah.rs @@ -105,13 +105,13 @@ pub fn handler(vm: &mut Vm) { fn log_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogError> { // let message_length = 8 + 8 + 8; - // log::info!("Mem Addr {} length {}", mem_addr, length); + // log::info!("Mem Addr 0x{:x?} length {}", mem_addr, length); let mut msg_vec = vec![]; for x in 0..(length as isize) { let xyz = mem_addr as *const u8; let value = unsafe { xyz.offset(x).read() }; - // info!("{} - {:x?} - {}", value, value, value as char); + // info!("{} - 0x{:x?} - {}", value, value, value as char); msg_vec.push(value); } let log_level = msg_vec.pop().unwrap(); @@ -119,13 +119,12 @@ fn log_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogE // use LogLevel::*; let ll = match log_level { - 48 => error!("{}", strr), - 49 => warn!("{}", strr), - 50 => info!("{}", strr), - 51 => debug!("{}", strr), - 52 => trace!("{}", strr), + 0 | 48 => error!("{}", strr), + 1 | 49 => warn!("{}", strr), + 2 | 50 => info!("{}", strr), + 3 | 51 => debug!("{}", strr), + 4 | 52 => trace!("{}", strr), _ => { - // log::error!("Invalid log format"); return Err(LogError::InvalidLogFormat); } }; diff --git a/sysdata/limine.cfg b/sysdata/limine.cfg index 007c09c..8e5699f 100644 --- a/sysdata/limine.cfg +++ b/sysdata/limine.cfg @@ -18,17 +18,17 @@ TERM_BACKDROP=008080 # Setting a default resolution for the framebuffer RESOLUTION=1024x768x24 - # MODULE_PATH=boot:///failure.hbf - # MODULE_CMDLINE="" + MODULE_PATH=boot:///failure.hbf + MODULE_CMDLINE="" - # MODULE_PATH=boot:///ecall.hbf - # MODULE_CMDLINE="" + MODULE_PATH=boot:///ecall.hbf + MODULE_CMDLINE="" - # MODULE_PATH=boot:///main.hbf - # MODULE_CMDLINE="" + MODULE_PATH=boot:///main.hbf + MODULE_CMDLINE="" - # MODULE_PATH=boot:///vfs_test.hbf - # MODULE_CMDLINE="" + MODULE_PATH=boot:///vfs_test.hbf + MODULE_CMDLINE="" MODULE_PATH=boot:///limine_framebuffer_driver.hbf MODULE_CMDLINE="height=10 width=10 arch=${ARCH}" \ No newline at end of file diff --git a/sysdata/test-programs/ecall.rhai b/sysdata/test-programs/ecall.rhai index a6e287e..ca1d2fc 100644 --- a/sysdata/test-programs/ecall.rhai +++ b/sysdata/test-programs/ecall.rhai @@ -1,3 +1,3 @@ -li8 (r1, 2); -eca (); -tx (); +li64 (r1, 2); +eca (); +tx (); diff --git a/sysdata/test-programs/limine_framebuffer_driver.rhai b/sysdata/test-programs/limine_framebuffer_driver.rhai index e9348ef..bfd3969 100644 --- a/sysdata/test-programs/limine_framebuffer_driver.rhai +++ b/sysdata/test-programs/limine_framebuffer_driver.rhai @@ -78,10 +78,17 @@ fn main(){ cp(r3, r1); cp(r4, r2); + // log level + li8(r6, 2); + + add64(r5, r3, r4); + li64(r7, 1); + st(r6, r5, 0, 1); + add64(r4, r4, r7); + li64(r1, 3); li64(r2, 1); - // don't forget to set the log level - + eca(); } std::Info("Starting the limine framebuffer driver.");