mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
Threads: Added enum values for the Switch's 4 cpu cores and implemented svcGetInfo(AllowedCpuIdBitmask)
This commit is contained in:
parent
188feba457
commit
7ad20154fc
5 changed files with 28 additions and 16 deletions
|
@ -205,14 +205,11 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
|
|||
case ThreadProcessorId::THREADPROCESSORID_DEFAULT:
|
||||
processor = tr("default");
|
||||
break;
|
||||
case ThreadProcessorId::THREADPROCESSORID_ALL:
|
||||
processor = tr("all");
|
||||
break;
|
||||
case ThreadProcessorId::THREADPROCESSORID_0:
|
||||
processor = tr("AppCore");
|
||||
break;
|
||||
case ThreadProcessorId::THREADPROCESSORID_1:
|
||||
processor = tr("SysCore");
|
||||
case ThreadProcessorId::THREADPROCESSORID_2:
|
||||
case ThreadProcessorId::THREADPROCESSORID_3:
|
||||
processor = tr("core %1").arg(thread.processor_id);
|
||||
break;
|
||||
default:
|
||||
processor = tr("Unknown processor %1").arg(thread.processor_id);
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "common/bit_field.h"
|
||||
#include "common/common_types.h"
|
||||
#include "core/hle/kernel/kernel.h"
|
||||
#include "core/hle/kernel/thread.h"
|
||||
#include "core/hle/kernel/vm_manager.h"
|
||||
|
||||
namespace Kernel {
|
||||
|
@ -127,6 +128,9 @@ public:
|
|||
u16 kernel_version = 0;
|
||||
/// The default CPU for this process, threads are scheduled on this cpu by default.
|
||||
u8 ideal_processor = 0;
|
||||
/// Bitmask of allowed CPUs that this process' threads can run on. TODO(Subv): Actually parse
|
||||
/// this value from the process header.
|
||||
u32 allowed_processor_mask = THREADPROCESSORID_DEFAULT_MASK;
|
||||
/// Current status of the process
|
||||
ProcessStatus status;
|
||||
|
||||
|
|
|
@ -296,8 +296,14 @@ static ResultCode GetInfo(u64* result, u64 info_id, u64 handle, u64 info_sub_id)
|
|||
LOG_TRACE(Kernel_SVC, "called info_id=0x%X, info_sub_id=0x%X, handle=0x%08X", info_id,
|
||||
info_sub_id, handle);
|
||||
|
||||
ASSERT(handle == 0 || handle == CurrentProcess);
|
||||
|
||||
auto& vm_manager = g_current_process->vm_manager;
|
||||
|
||||
switch (static_cast<GetInfoType>(info_id)) {
|
||||
case GetInfoType::AllowedCpuIdBitmask:
|
||||
*result = g_current_process->allowed_processor_mask;
|
||||
break;
|
||||
case GetInfoType::TotalMemoryUsage:
|
||||
*result = vm_manager.GetTotalMemoryUsage();
|
||||
break;
|
||||
|
@ -455,16 +461,15 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V
|
|||
switch (processor_id) {
|
||||
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:
|
||||
case THREADPROCESSORID_2:
|
||||
case THREADPROCESSORID_3:
|
||||
// TODO(bunnei): Implement support for other processor IDs
|
||||
LOG_ERROR(Kernel_SVC,
|
||||
"Newly created thread must run in the SysCore (Core1), unimplemented.");
|
||||
"Newly created thread must run in another thread (%u), unimplemented.",
|
||||
processor_id);
|
||||
break;
|
||||
default:
|
||||
// TODO(bunnei): Implement support for other processor IDs
|
||||
ASSERT_MSG(false, "Unsupported thread processor ID: %d", processor_id);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ struct PageInfo {
|
|||
/// Values accepted by svcGetInfo
|
||||
enum class GetInfoType : u64 {
|
||||
// 1.0.0+
|
||||
AllowedCpuIdBitmask = 0,
|
||||
TotalMemoryUsage = 6,
|
||||
TotalHeapUsage = 7,
|
||||
RandomEntropy = 11,
|
||||
|
|
|
@ -24,10 +24,15 @@ enum ThreadPriority : u32 {
|
|||
|
||||
enum ThreadProcessorId : s32 {
|
||||
THREADPROCESSORID_DEFAULT = -2, ///< Run thread on default core specified by exheader
|
||||
THREADPROCESSORID_ALL = -1, ///< Run thread on either core
|
||||
THREADPROCESSORID_0 = 0, ///< Run thread on core 0 (AppCore)
|
||||
THREADPROCESSORID_1 = 1, ///< Run thread on core 1 (SysCore)
|
||||
THREADPROCESSORID_MAX = 2, ///< Processor ID must be less than this
|
||||
THREADPROCESSORID_0 = 0, ///< Run thread on core 0
|
||||
THREADPROCESSORID_1 = 1, ///< Run thread on core 1
|
||||
THREADPROCESSORID_2 = 2, ///< Run thread on core 2
|
||||
THREADPROCESSORID_3 = 3, ///< Run thread on core 3
|
||||
THREADPROCESSORID_MAX = 4, ///< Processor ID must be less than this
|
||||
|
||||
/// Allowed CPU mask
|
||||
THREADPROCESSORID_DEFAULT_MASK = (1 << THREADPROCESSORID_0) | (1 << THREADPROCESSORID_1) |
|
||||
(1 << THREADPROCESSORID_2) | (1 << THREADPROCESSORID_3)
|
||||
};
|
||||
|
||||
enum ThreadStatus {
|
||||
|
|
Loading…
Reference in a new issue