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> {
// 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);
}
};

View file

@ -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}"

View file

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

View file

@ -78,9 +78,16 @@ 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();
}