diff --git a/src/kernel/exception.rs b/src/kernel/exception.rs index 749a9bc..89f7cdb 100644 --- a/src/kernel/exception.rs +++ b/src/kernel/exception.rs @@ -1,7 +1,7 @@ use std::{cell::RefCell, rc::Rc}; use crate::{simulator::{machine::{ExceptionType, Machine}, error::{MachineOk, MachineError}}}; -use crate::kernel::synch::Semaphore; +use crate::kernel::synch::{Lock, Semaphore}; use super::{system::System, thread::Thread}; @@ -215,7 +215,8 @@ fn sc_sem_create(machine: &mut Machine, system: &mut System) -> Result Err(format!("Initial_count < 0"))?, false => { - system.get_thread_manager().get_obj_addrs().add_semaphore(Semaphore::new(initial_count)); + let id = system.get_thread_manager().get_obj_addrs().add_semaphore(Semaphore::new(initial_count)); + machine.write_int_register(10, id as i64); Ok(MachineOk::Ok) } }