1
0
Fork 0
forked from AbleOS/ableos

working on logs

This commit is contained in:
able 2023-11-19 18:15:03 -06:00
parent fe6cccc70d
commit 762b2aa3ae
4 changed files with 27 additions and 21 deletions

View file

@ -105,13 +105,13 @@ pub fn handler(vm: &mut Vm) {
fn log_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogError> { fn log_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogError> {
// let message_length = 8 + 8 + 8; // 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![]; let mut msg_vec = vec![];
for x in 0..(length as isize) { for x in 0..(length as isize) {
let xyz = mem_addr as *const u8; let xyz = mem_addr as *const u8;
let value = unsafe { xyz.offset(x).read() }; 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); msg_vec.push(value);
} }
let log_level = msg_vec.pop().unwrap(); 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::*; // use LogLevel::*;
let ll = match log_level { let ll = match log_level {
48 => error!("{}", strr), 0 | 48 => error!("{}", strr),
49 => warn!("{}", strr), 1 | 49 => warn!("{}", strr),
50 => info!("{}", strr), 2 | 50 => info!("{}", strr),
51 => debug!("{}", strr), 3 | 51 => debug!("{}", strr),
52 => trace!("{}", strr), 4 | 52 => trace!("{}", strr),
_ => { _ => {
// log::error!("Invalid log format");
return Err(LogError::InvalidLogFormat); return Err(LogError::InvalidLogFormat);
} }
}; };

View file

@ -18,17 +18,17 @@ TERM_BACKDROP=008080
# Setting a default resolution for the framebuffer # Setting a default resolution for the framebuffer
RESOLUTION=1024x768x24 RESOLUTION=1024x768x24
# MODULE_PATH=boot:///failure.hbf MODULE_PATH=boot:///failure.hbf
# MODULE_CMDLINE="" MODULE_CMDLINE=""
# MODULE_PATH=boot:///ecall.hbf MODULE_PATH=boot:///ecall.hbf
# MODULE_CMDLINE="" MODULE_CMDLINE=""
# MODULE_PATH=boot:///main.hbf MODULE_PATH=boot:///main.hbf
# MODULE_CMDLINE="" MODULE_CMDLINE=""
# MODULE_PATH=boot:///vfs_test.hbf MODULE_PATH=boot:///vfs_test.hbf
# MODULE_CMDLINE="" MODULE_CMDLINE=""
MODULE_PATH=boot:///limine_framebuffer_driver.hbf MODULE_PATH=boot:///limine_framebuffer_driver.hbf
MODULE_CMDLINE="height=10 width=10 arch=${ARCH}" MODULE_CMDLINE="height=10 width=10 arch=${ARCH}"

View file

@ -1,3 +1,3 @@
li8 (r1, 2); li64 (r1, 2);
eca (); eca ();
tx (); tx ();

View file

@ -78,9 +78,16 @@ fn main(){
cp(r3, r1); cp(r3, r1);
cp(r4, r2); 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(r1, 3);
li64(r2, 1); li64(r2, 1);
// don't forget to set the log level
eca(); eca();
} }