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)
|
|
|
|
{}
|
|
|
|
|
2018-06-29 04:24:39 +00:00
|
|
|
nx::HandleTableSizeEntry::HandleTableSizeEntry(const KernelCapabilityEntry & kernel_cap) :
|
2017-07-07 07:09:03 +00:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
void nx::HandleTableSizeEntry::operator=(const HandleTableSizeEntry& other)
|
|
|
|
{
|
|
|
|
mHandleTableSize = other.mHandleTableSize;
|
|
|
|
updateCapField();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool nx::HandleTableSizeEntry::operator==(const HandleTableSizeEntry& other) const
|
|
|
|
{
|
|
|
|
return (mHandleTableSize == other.mHandleTableSize);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool nx::HandleTableSizeEntry::operator!=(const HandleTableSizeEntry& other) const
|
|
|
|
{
|
|
|
|
return !(*this == other);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-29 04:24:39 +00:00
|
|
|
const nx::KernelCapabilityEntry & nx::HandleTableSizeEntry::getKernelCapability() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mCap;
|
|
|
|
}
|
|
|
|
|
2018-06-29 04:24:39 +00:00
|
|
|
void nx::HandleTableSizeEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
if (kernel_cap.getType() != kCapId)
|
|
|
|
{
|
2018-06-29 04:24:39 +00:00
|
|
|
throw fnd::Exception(kModuleName, "KernelCapabilityEntry is not type 'HandleTableSize'");
|
2017-07-07 07:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|