use { crate::holeybytes::{ ecah::LogError, kernel_services::{block_read, mem_serve}, Vm, }, log::info, }; pub enum MemoryServiceError { InvalidMemoryFormat, } fn alloc_page(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), MemoryServiceError> { let mut val = alloc::vec::Vec::new(); for _ in 0..4096 { val.push(0); } info!("Block address: {:?}", val.as_ptr()); vm.registers[1] = hbvm::value::Value(val.as_ptr() as u64); vm.registers[2] = hbvm::value::Value(4096); Ok(()) } pub fn memory_msg_handler( vm: &mut Vm, mem_addr: u64, length: usize, ) -> Result<(), MemoryServiceError> { let mut msg_vec = block_read(mem_addr, length); Ok(()) } // match memory_msg_handler(vm, mem_addr, length) { // Ok(()) => { // let free_chunks = allocator::get_free_chunks_count(); // debug!("Free chunk count: {}", free_chunks); // } // Err(err) => log::error!("Improper log format"), // };