forked from Rativel/BurritOS
Add user_stack_size to Machine and use it for threads sp
This commit is contained in:
@@ -3,7 +3,7 @@ use std::{cell::RefCell, rc::Rc};
|
||||
use crate::{simulator::{machine::{ExceptionType, Machine}, error::{MachineOk, MachineError}}};
|
||||
use crate::kernel::synch::{Lock, Semaphore};
|
||||
|
||||
use super::{system::{System, self}, thread::Thread};
|
||||
use super::{system::System, thread::Thread};
|
||||
|
||||
/// The halt system call. Stops Burritos.
|
||||
pub const SC_SHUTDOWN: u8 = 0;
|
||||
@@ -282,7 +282,9 @@ fn sc_new_thread(machine: &mut Machine, system: &mut System) -> Result<MachineOk
|
||||
};
|
||||
let current_thread = current_thread.borrow_mut();
|
||||
if let Some(process) = current_thread.get_process_owner() {
|
||||
system.get_thread_manager().start_thread(n_thread, Rc::clone(&process), func as u64, current_thread.thread_context.int_registers[2] as u64 + machine.page_size, args);
|
||||
let sp_max = system.get_thread_manager().get_sp_max() + machine.user_stack_size;
|
||||
system.get_thread_manager().set_sp_max(sp_max);
|
||||
system.get_thread_manager().start_thread(n_thread, Rc::clone(&process), func as u64, sp_max, args);
|
||||
// TODO changé la valeur de sp quand on supportera les addresses virtuels
|
||||
machine.write_int_register(10, tid as i64);
|
||||
Ok(MachineOk::Ok)
|
||||
|
||||
Reference in New Issue
Block a user