Kernel/Thread: Allow specifying which process a thread belongs to when creating it.

Don't automatically assume that Thread::Create will only be called when the parent process is currently scheduled. This assumption will be broken when applets or system modules are loaded.
This commit is contained in:
Subv 2017-09-26 17:40:49 -05:00
parent a8d2f5787f
commit 3165466b66
4 changed files with 22 additions and 17 deletions

View file

@ -656,8 +656,9 @@ static ResultCode CreateThread(Kernel::Handle* out_handle, u32 priority, u32 ent
"Newly created thread must run in the SysCore (Core1), unimplemented.");
}
CASCADE_RESULT(SharedPtr<Thread> thread, Kernel::Thread::Create(name, entry_point, priority,
arg, processor_id, stack_top));
CASCADE_RESULT(SharedPtr<Thread> thread,
Kernel::Thread::Create(name, entry_point, priority, arg, processor_id, stack_top,
Kernel::g_current_process));
thread->context.fpscr =
FPSCR_DEFAULT_NAN | FPSCR_FLUSH_TO_ZERO | FPSCR_ROUND_TOZERO; // 0x03C00000