feat: add SavedContext::with_entry_and_stack, wire SpawnThread to preserve entry point and stack
This commit is contained in:
@@ -7,16 +7,18 @@ impl<P: Platform> Kernel<P> {
|
||||
pub(crate) fn handle_spawn_thread(
|
||||
&mut self,
|
||||
pid: types::id::ProcessId,
|
||||
_entry: types::address::EntryPoint,
|
||||
_stack: types::address::StackPointer,
|
||||
entry: types::address::EntryPoint,
|
||||
stack: types::address::StackPointer,
|
||||
) -> SyscallOutcome {
|
||||
use domain::scheduler::Scheduler;
|
||||
use domain::thread::SavedContext;
|
||||
|
||||
let priority = types::bounded::Priority::new(16)
|
||||
.unwrap_or_else(|| unreachable!());
|
||||
let time_slice = types::time::TimeSlice::new(100);
|
||||
let context = SavedContext::with_entry_and_stack(entry, stack);
|
||||
|
||||
let tid = match self.threads.spawn(pid, priority, time_slice, None) {
|
||||
let tid = match self.threads.spawn_with_context(pid, priority, time_slice, None, context) {
|
||||
Ok(t) => t,
|
||||
Err(e) => return SyscallOutcome::Complete(SyscallResult::Error(e)),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user