kernel: Rename 'default' CPU core to 'ideal' core

This makes the naming more closely match its meaning. It's just a
preferred core, not a required default core. This also makes the usages
of this term consistent across the thread and process implementations.
merge-requests/60/head
Lioncash 2018-12-27 21:14:59 +07:00
parent 771431f625
commit f80bc712ea
5 changed files with 23 additions and 23 deletions

@ -93,7 +93,7 @@ ResultCode Process::ClearSignalState() {
ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata) { ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata) {
program_id = metadata.GetTitleID(); program_id = metadata.GetTitleID();
ideal_processor = metadata.GetMainThreadCore(); ideal_core = metadata.GetMainThreadCore();
is_64bit_process = metadata.Is64BitProgram(); is_64bit_process = metadata.Is64BitProgram();
vm_manager.Reset(metadata.GetAddressSpaceType()); vm_manager.Reset(metadata.GetAddressSpaceType());

@ -168,9 +168,9 @@ public:
/// Gets the resource limit descriptor for this process /// Gets the resource limit descriptor for this process
SharedPtr<ResourceLimit> GetResourceLimit() const; SharedPtr<ResourceLimit> GetResourceLimit() const;
/// Gets the default CPU ID for this process /// Gets the ideal CPU core ID for this process
u8 GetDefaultProcessorID() const { u8 GetIdealCore() const {
return ideal_processor; return ideal_core;
} }
/// Gets the bitmask of allowed CPUs that this process' threads can run on. /// Gets the bitmask of allowed CPUs that this process' threads can run on.
@ -287,8 +287,8 @@ private:
/// Resource limit descriptor for this process /// Resource limit descriptor for this process
SharedPtr<ResourceLimit> resource_limit; SharedPtr<ResourceLimit> resource_limit;
/// The default CPU for this process, threads are scheduled on this cpu by default. /// The ideal CPU core for this process, threads are scheduled on this core by default.
u8 ideal_processor = 0; u8 ideal_core = 0;
u32 is_virtual_address_memory_enabled = 0; u32 is_virtual_address_memory_enabled = 0;
/// The Thread Local Storage area is allocated as processes create threads, /// The Thread Local Storage area is allocated as processes create threads,

@ -1220,10 +1220,10 @@ static ResultCode CreateThread(Handle* out_handle, VAddr entry_point, u64 arg, V
auto* const current_process = Core::CurrentProcess(); auto* const current_process = Core::CurrentProcess();
if (processor_id == THREADPROCESSORID_DEFAULT) { if (processor_id == THREADPROCESSORID_IDEAL) {
// Set the target CPU to the one specified in the process' exheader. // Set the target CPU to the one specified by the process.
processor_id = current_process->GetDefaultProcessorID(); processor_id = current_process->GetIdealCore();
ASSERT(processor_id != THREADPROCESSORID_DEFAULT); ASSERT(processor_id != THREADPROCESSORID_IDEAL);
} }
switch (processor_id) { switch (processor_id) {
@ -1632,13 +1632,13 @@ static ResultCode SetThreadCoreMask(Handle thread_handle, u32 core, u64 mask) {
return ERR_INVALID_HANDLE; return ERR_INVALID_HANDLE;
} }
if (core == static_cast<u32>(THREADPROCESSORID_DEFAULT)) { if (core == static_cast<u32>(THREADPROCESSORID_IDEAL)) {
const u8 default_processor_id = thread->GetOwnerProcess()->GetDefaultProcessorID(); const u8 ideal_cpu_core = thread->GetOwnerProcess()->GetIdealCore();
ASSERT(default_processor_id != static_cast<u8>(THREADPROCESSORID_DEFAULT)); ASSERT(ideal_cpu_core != static_cast<u8>(THREADPROCESSORID_IDEAL));
// Set the target CPU to the one specified in the process' exheader. // Set the target CPU to the ideal core specified by the process.
core = default_processor_id; core = ideal_cpu_core;
mask = 1ULL << core; mask = 1ULL << core;
} }

@ -30,12 +30,12 @@ enum ThreadPriority : u32 {
}; };
enum ThreadProcessorId : s32 { enum ThreadProcessorId : s32 {
THREADPROCESSORID_DEFAULT = -2, ///< Run thread on default core specified by exheader THREADPROCESSORID_IDEAL = -2, ///< Run thread on the ideal core specified by the process.
THREADPROCESSORID_0 = 0, ///< Run thread on core 0 THREADPROCESSORID_0 = 0, ///< Run thread on core 0
THREADPROCESSORID_1 = 1, ///< Run thread on core 1 THREADPROCESSORID_1 = 1, ///< Run thread on core 1
THREADPROCESSORID_2 = 2, ///< Run thread on core 2 THREADPROCESSORID_2 = 2, ///< Run thread on core 2
THREADPROCESSORID_3 = 3, ///< Run thread on core 3 THREADPROCESSORID_3 = 3, ///< Run thread on core 3
THREADPROCESSORID_MAX = 4, ///< Processor ID must be less than this THREADPROCESSORID_MAX = 4, ///< Processor ID must be less than this
/// Allowed CPU mask /// Allowed CPU mask
THREADPROCESSORID_DEFAULT_MASK = (1 << THREADPROCESSORID_0) | (1 << THREADPROCESSORID_1) | THREADPROCESSORID_DEFAULT_MASK = (1 << THREADPROCESSORID_0) | (1 << THREADPROCESSORID_1) |

@ -293,8 +293,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
QString processor; QString processor;
switch (thread.GetProcessorID()) { switch (thread.GetProcessorID()) {
case Kernel::ThreadProcessorId::THREADPROCESSORID_DEFAULT: case Kernel::ThreadProcessorId::THREADPROCESSORID_IDEAL:
processor = tr("default"); processor = tr("ideal");
break; break;
case Kernel::ThreadProcessorId::THREADPROCESSORID_0: case Kernel::ThreadProcessorId::THREADPROCESSORID_0:
case Kernel::ThreadProcessorId::THREADPROCESSORID_1: case Kernel::ThreadProcessorId::THREADPROCESSORID_1: