forked from koniifer/ableos
add in a Memory Service
Currently it fully ignores messages and only allocates blocks in 4096 byte chunks
This commit is contained in:
parent
7a2372d32a
commit
15515e6643
|
@ -70,6 +70,10 @@ pub fn handler(vm: &mut Vm) {
|
|||
Ok(()) => {}
|
||||
Err(err) => log::error!("Improper log format"),
|
||||
},
|
||||
2 => match memory_msg_handler(vm, mem_addr, length) {
|
||||
Ok(()) => {}
|
||||
Err(err) => log::error!("Improper log format"),
|
||||
},
|
||||
buffer_id => {
|
||||
let mut buffs = IPC_BUFFERS.lock();
|
||||
|
||||
|
@ -140,3 +144,14 @@ pub enum LogError {
|
|||
InvalidLogFormat,
|
||||
}
|
||||
use {alloc::vec, log::Record};
|
||||
|
||||
fn memory_msg_handler(vm: &mut Vm, mem_addr: u64, length: usize) -> Result<(), LogError> {
|
||||
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(())
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@ fn main(){
|
|||
std::Debug("XYZ");
|
||||
std::Trace("Trace Deez");
|
||||
|
||||
std::ipc_send(2, 0, 0);
|
||||
|
||||
tx();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue