citra-emu
/
citra
Archived
1
0
Fork 0

Merge pull request #3084 from Subv/thread_default_cpu

Kernel/Thread: Use the process' ideal CPU when specifying the Default CPU on CreateThread.
This commit is contained in:
Sebastian Valle 2017-11-08 14:38:50 -05:00 committed by GitHub
commit 908dbf4230
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 19 deletions

View File

@ -736,11 +736,22 @@ static ResultCode CreateThread(Kernel::Handle* out_handle, u32 priority, u32 ent
return Kernel::ERR_NOT_AUTHORIZED;
}
if (processor_id == THREADPROCESSORID_DEFAULT) {
// Set the target CPU to the one specified in the process' exheader.
processor_id = Kernel::g_current_process->ideal_processor;
ASSERT(processor_id != THREADPROCESSORID_DEFAULT);
}
switch (processor_id) {
case THREADPROCESSORID_ALL:
case THREADPROCESSORID_DEFAULT:
case THREADPROCESSORID_0:
break;
case THREADPROCESSORID_ALL:
LOG_INFO(Kernel_SVC,
"Newly created thread is allowed to be run in any Core, unimplemented.");
break;
case THREADPROCESSORID_1:
LOG_ERROR(Kernel_SVC,
"Newly created thread must run in the SysCore (Core1), unimplemented.");
break;
default:
// TODO(bunnei): Implement support for other processor IDs
@ -748,23 +759,6 @@ static ResultCode CreateThread(Kernel::Handle* out_handle, u32 priority, u32 ent
break;
}
if (processor_id == THREADPROCESSORID_ALL) {
LOG_INFO(Kernel_SVC,
"Newly created thread is allowed to be run in any Core, unimplemented.");
}
if (processor_id == THREADPROCESSORID_DEFAULT &&
Kernel::g_current_process->ideal_processor == THREADPROCESSORID_1) {
LOG_WARNING(
Kernel_SVC,
"Newly created thread is allowed to be run in the SysCore (Core1), unimplemented.");
}
if (processor_id == THREADPROCESSORID_1) {
LOG_ERROR(Kernel_SVC,
"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,
Kernel::g_current_process));