From c419926a4cba8622d2e88e8633a3bd428e0998d2 Mon Sep 17 00:00:00 2001 From: Samy Solhi Date: Wed, 12 Apr 2023 23:00:12 +0200 Subject: [PATCH] added sc_sem_remove --- src/kernel/exception.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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;