1
0
Fork 0
forked from AbleOS/ableos
ableos-idl/kernel/src/holeybytes/kernel_services/mem_serve.rs

42 lines
1.1 KiB
Rust
Raw Normal View History

2024-03-11 09:48:56 -05:00
use {
2024-03-22 03:58:59 -05:00
crate::holeybytes::{
ecah::LogError,
kernel_services::{block_read, mem_serve},
Vm,
},
2024-03-11 09:48:56 -05:00
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> {
2024-03-22 03:58:59 -05:00
let mut msg_vec = block_read(mem_addr, length);
2024-03-11 09:48:56 -05:00
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"),
// };