print exit code when using debug machine, add matmult

This commit is contained in:
Quentin Legot
2023-05-09 23:16:16 +02:00
parent 15a04fb9da
commit 98fe63f487
4 changed files with 65 additions and 4 deletions

View File

@ -138,7 +138,8 @@ fn syscall(machine: &mut Machine, system: &mut System) -> Result<MachineOk, Mach
Some(th) => th.clone(),
None => Err("Current thread is None")?
};
system.get_thread_manager().thread_finish(machine, th);
let code = machine.read_int_register(10);
system.get_thread_manager().thread_finish(machine, th, code);
Ok(MachineOk::Ok)
},
SC_EXEC => todo!(),

View File

@ -248,10 +248,10 @@ impl ThreadManager {
}
/// Finish the execution of the thread and prepare its deallocation
pub fn thread_finish(&mut self, machine: &mut Machine, thread: ThreadRef) {
pub fn thread_finish(&mut self, machine: &mut Machine, thread: ThreadRef, exit_code: i64) {
let old_status = machine.interrupt.set_status(InterruptStatus::InterruptOff);
assert!(self.g_alive.remove(Rc::clone(&thread)));
self.debug(format!("Finishing thread {}", thread.borrow().get_name()));
self.debug(format!("Finishing thread {} with code {}", thread.borrow().get_name(), exit_code));
// g_objets_addrs->removeObject(self.thread) // a ajouté plus tard
for (_, el) in thread.borrow().join_thread.iter().enumerate() {
self.ready_to_run(Rc::clone(&el));