From 586c077002d6eb6820bc8caf9afac5928967007f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Rativel?= Date: Wed, 5 Apr 2023 16:09:26 +0200 Subject: [PATCH] fixed get_string_param --- src/kernel/exception.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/kernel/exception.rs b/src/kernel/exception.rs index 1c2e1d5..dad9c1c 100644 --- a/src/kernel/exception.rs +++ b/src/kernel/exception.rs @@ -176,6 +176,11 @@ fn syscall(machine: &mut Machine, system: &mut System) -> Result usize{ i + 1 } -fn get_string_param(addr: i64, maxlen: i64, machine: &Machine) -> Vec{ - let mut dest = Vec::with_capacity(maxlen as usize); +fn get_string_param(addr: i64, maxlen: usize, machine: &Machine) -> Vec{ + let mut dest = Vec::with_capacity(maxlen); - let mut i = 0; + let mut i: usize = 0; let mut c = 1; while c != 0 && i < maxlen { - c = machine.read_memory(1, (addr + i) as usize); + c = machine.read_memory(1, addr as usize + i); //dest.push(c as char); - dest[i] = c as char; + dest[i] = c as u8 as char; i += 1; }