diff --git a/src/kernel/exception.rs b/src/kernel/exception.rs index b020f6e..bb99263 100644 --- a/src/kernel/exception.rs +++ b/src/kernel/exception.rs @@ -105,7 +105,13 @@ fn syscall(machine: &mut Machine, system: &mut System) -> Result todo!(), SC_P => todo!(), SC_V => todo!(), - SC_SEM_CREATE => todo!(), + SC_SEM_CREATE => { + let addr_name = machine.read_int_register(10); + let initial_count = machine.read_int_register((11)); + let size = get_length_param(addr_name as usize, machine); + Ok(MachineOk::Ok) + + }, SC_SEM_DESTROY => todo!(), SC_LOCK_CREATE => todo!(), SC_LOCK_DESTROY => todo!(), @@ -129,6 +135,17 @@ fn syscall(machine: &mut Machine, system: &mut System) -> Result usize{ + let mut i = 0; + let mut c = 1; + while c!= 0 { + c = machine.read_memory(1, addr + i); + i+=1; + + } + i + 1 +} + #[cfg(test)] mod test { use crate::kernel::exception::{SC_SHUTDOWN, SC_WRITE};