2017-08-05 13:09:50 +00:00
|
|
|
#include <nx/HandleTableSizeEntry.h>
|
2017-07-07 07:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nx::HandleTableSizeEntry::HandleTableSizeEntry() :
|
|
|
|
mCap(kCapId),
|
|
|
|
mHandleTableSize(0)
|
|
|
|
{}
|
|
|
|
|
|
|
|
nx::HandleTableSizeEntry::HandleTableSizeEntry(const KernelCapability & kernel_cap) :
|
|
|
|
mCap(kCapId),
|
|
|
|
mHandleTableSize(0)
|
|
|
|
{
|
|
|
|
setKernelCapability(kernel_cap);
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
nx::HandleTableSizeEntry::HandleTableSizeEntry(uint16_t size) :
|
2017-07-07 07:09:03 +00:00
|
|
|
mCap(kCapId),
|
|
|
|
mHandleTableSize(0)
|
|
|
|
{
|
|
|
|
setHandleTableSize(size);
|
|
|
|
}
|
|
|
|
|
|
|
|
const nx::KernelCapability & nx::HandleTableSizeEntry::getKernelCapability() const
|
|
|
|
{
|
|
|
|
return mCap;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nx::HandleTableSizeEntry::setKernelCapability(const KernelCapability & kernel_cap)
|
|
|
|
{
|
|
|
|
if (kernel_cap.getType() != kCapId)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "KernelCapability is not type 'HandleTableSize'");
|
|
|
|
}
|
|
|
|
|
|
|
|
mCap = kernel_cap;
|
|
|
|
processCapField();
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint16_t nx::HandleTableSizeEntry::getHandleTableSize() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mHandleTableSize;
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void nx::HandleTableSizeEntry::setHandleTableSize(uint16_t size)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
if (size > kMaxHandleTableSize)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "Illegal HandleTableSize. (range: 0-1023 inclusive)");
|
|
|
|
}
|
|
|
|
|
|
|
|
mHandleTableSize = size;
|
|
|
|
updateCapField();
|
|
|
|
}
|