2017-07-07 07:09:03 +00:00
|
|
|
#include "ThreadInfoEntry.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nx::ThreadInfoEntry::ThreadInfoEntry() :
|
|
|
|
mCap(kCapId),
|
|
|
|
mMinPriority(kDefaultPriority),
|
|
|
|
mMaxPriority(kDefaultPriority),
|
2017-07-17 08:21:39 +00:00
|
|
|
mMinCpuId(kDefaultCpuId),
|
|
|
|
mMaxCpuId(kDefaultCpuId)
|
2017-07-07 07:09:03 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
nx::ThreadInfoEntry::ThreadInfoEntry(const KernelCapability & kernel_cap) :
|
|
|
|
mCap(kCapId),
|
|
|
|
mMinPriority(kDefaultPriority),
|
|
|
|
mMaxPriority(kDefaultPriority),
|
2017-07-17 08:21:39 +00:00
|
|
|
mMinCpuId(kDefaultCpuId),
|
|
|
|
mMaxCpuId(kDefaultCpuId)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
setKernelCapability(kernel_cap);
|
|
|
|
}
|
|
|
|
|
|
|
|
nx::ThreadInfoEntry::ThreadInfoEntry(u8 min_priority, u8 max_priority, u8 min_core_number, u8 max_core_number) :
|
|
|
|
mCap(kCapId),
|
|
|
|
mMinPriority(kDefaultPriority),
|
|
|
|
mMaxPriority(kDefaultPriority),
|
2017-07-17 08:21:39 +00:00
|
|
|
mMinCpuId(kDefaultCpuId),
|
|
|
|
mMaxCpuId(kDefaultCpuId)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
setMinPriority(min_priority);
|
|
|
|
setMaxPriority(max_priority);
|
2017-07-17 08:21:39 +00:00
|
|
|
setMinCpuId(min_core_number);
|
|
|
|
setMaxCpuId(max_core_number);
|
2017-07-07 07:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const nx::KernelCapability & nx::ThreadInfoEntry::getKernelCapability() const
|
|
|
|
{
|
|
|
|
return mCap;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nx::ThreadInfoEntry::setKernelCapability(const KernelCapability & kernel_cap)
|
|
|
|
{
|
|
|
|
if (kernel_cap.getType() != kCapId)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "KernelCapability is not type 'ThreadInfo'");
|
|
|
|
}
|
|
|
|
|
|
|
|
mCap = kernel_cap;
|
|
|
|
processCapField();
|
|
|
|
}
|
|
|
|
|
|
|
|
u8 nx::ThreadInfoEntry::getMinPriority() const
|
|
|
|
{
|
|
|
|
return mMinPriority;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nx::ThreadInfoEntry::setMinPriority(u8 priority)
|
|
|
|
{
|
|
|
|
if (priority > kMaxVal)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "Illegal MinPriority (range 0-63)");
|
|
|
|
}
|
|
|
|
|
|
|
|
mMinPriority = priority;
|
|
|
|
updateCapField();
|
|
|
|
}
|
|
|
|
|
|
|
|
u8 nx::ThreadInfoEntry::getMaxPriority() const
|
|
|
|
{
|
|
|
|
return mMaxPriority;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nx::ThreadInfoEntry::setMaxPriority(u8 priority)
|
|
|
|
{
|
|
|
|
if (priority > kMaxVal)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "Illegal MaxPriority (range 0-63)");
|
|
|
|
}
|
|
|
|
|
|
|
|
mMaxPriority = priority;
|
|
|
|
updateCapField();
|
|
|
|
}
|
|
|
|
|
2017-07-17 08:21:39 +00:00
|
|
|
u8 nx::ThreadInfoEntry::getMinCpuId() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
2017-07-17 08:21:39 +00:00
|
|
|
return mMinCpuId;
|
2017-07-07 07:09:03 +00:00
|
|
|
}
|
|
|
|
|
2017-07-17 08:21:39 +00:00
|
|
|
void nx::ThreadInfoEntry::setMinCpuId(u8 core_num)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
if (core_num > kMaxVal)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "Illegal MinCoreNumber (range 0-63)");
|
|
|
|
}
|
|
|
|
|
2017-07-17 08:21:39 +00:00
|
|
|
mMinCpuId = core_num;
|
2017-07-07 07:09:03 +00:00
|
|
|
updateCapField();
|
|
|
|
}
|
|
|
|
|
2017-07-17 08:21:39 +00:00
|
|
|
u8 nx::ThreadInfoEntry::getMaxCpuId() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
2017-07-17 08:21:39 +00:00
|
|
|
return mMaxCpuId;
|
2017-07-07 07:09:03 +00:00
|
|
|
}
|
|
|
|
|
2017-07-17 08:21:39 +00:00
|
|
|
void nx::ThreadInfoEntry::setMaxCpuId(u8 core_num)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
if (core_num > kMaxVal)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "Illegal MaxCoreNumber (range 0-63)");
|
|
|
|
}
|
|
|
|
|
2017-07-17 08:21:39 +00:00
|
|
|
mMaxCpuId = core_num;
|
2017-07-07 07:09:03 +00:00
|
|
|
updateCapField();
|
|
|
|
}
|