diff --git a/kernel/src/holeybytes/ecah.rs b/kernel/src/holeybytes/ecah.rs index ab0b1ff86..c75f51420 100644 --- a/kernel/src/holeybytes/ecah.rs +++ b/kernel/src/holeybytes/ecah.rs @@ -18,12 +18,12 @@ use { }; pub fn handler(vm: &mut Vm) { - let r1 = vm.registers[1].cast::(); + let ecall_number = vm.registers[2].cast::(); - // debug!("Ecall number {:?}", r1); + // debug!("Ecall number {:?}", ecall_number); // trace!("Register dump: {:?}", vm.registers); - match r1 { + match ecall_number { 0 => { // TODO: explode computer // hello world ecall @@ -34,7 +34,7 @@ pub fn handler(vm: &mut Vm) { 1 => { // Make buffer - let bounded = match vm.registers[2].cast::() { + let bounded = match vm.registers[3].cast::() { 0 => false, 1 => true, _ => { @@ -42,7 +42,7 @@ pub fn handler(vm: &mut Vm) { } }; - let length = vm.registers[3].cast::(); + let length = vm.registers[4].cast::(); let mut buffs = IPC_BUFFERS.lock(); let abc; @@ -65,13 +65,9 @@ pub fn handler(vm: &mut Vm) { } 3 => { // Send a message to a buffer - let r2 = vm.registers[2].cast::(); - let r3 = vm.registers[3].cast::(); - let r4 = vm.registers[4].cast::(); - - let buffer_id = r2; - let mem_addr = r3; - let length = r4 as usize; + let buffer_id = vm.registers[3].cast::(); + let mem_addr = vm.registers[4].cast::(); + let length = vm.registers[5].cast::() as usize; trace!("IPC address: {:?}", mem_addr); use alloc::vec::Vec; @@ -119,12 +115,12 @@ pub fn handler(vm: &mut Vm) { } } 4 => { - let r2 = vm.registers[2].cast::(); + let buffer_id = vm.registers[3].cast::(); let mut buffs = IPC_BUFFERS.lock(); - let mut buff = buffs.get_mut(&r2).unwrap(); + let mut buff = buffs.get_mut(&buffer_id).unwrap(); let msg = buff.pop(); - info!("Recieve {:?} from Buffer({})", msg, r2); + info!("Recieve {:?} from Buffer({})", msg, buffer_id); } 5 => { #[cfg(target_arch = "x86_64")] @@ -141,7 +137,7 @@ pub fn handler(vm: &mut Vm) { } // 5 _ => { - log::error!("Syscall unknown {:?}{:?}", r1, vm.registers); + log::error!("Syscall unknown {:?}{:?}", ecall_number, vm.registers); } } }