diff --git a/src/kernel/exception.rs b/src/kernel/exception.rs index 4009d8a..749a9bc 100644 --- a/src/kernel/exception.rs +++ b/src/kernel/exception.rs @@ -174,7 +174,7 @@ fn syscall(machine: &mut Machine, system: &mut System) -> Result sc_p(machine, system), SC_V => sc_v(machine, system), SC_SEM_CREATE => sc_sem_create(machine, system), - SC_SEM_DESTROY => todo!(), + SC_SEM_DESTROY => sc_sem_remove(machine, system), SC_LOCK_CREATE => todo!(), SC_LOCK_DESTROY => todo!(), SC_LOCK_ACQUIRE => todo!(), @@ -221,6 +221,12 @@ fn sc_sem_create(machine: &mut Machine, system: &mut System) -> Result Result{ + let id = machine.read_int_register(10) as i32; + system.get_thread_manager().get_obj_addrs().remove_semaphore(id); + Ok(MachineOk::Ok) +} + fn sc_new_thread(machine: &mut Machine, system: &mut System) -> Result { // Get the address of the string for the name of the thread let name_addr = machine.read_int_register(10) as usize;