2018-08-07 07:17:51 +00:00
|
|
|
#include <nn/hac/SystemCallEntry.h>
|
2017-07-07 07:09:03 +00:00
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
nn::hac::SystemCallEntry::SystemCallEntry() :
|
2017-07-07 07:09:03 +00:00
|
|
|
mCap(kCapId),
|
|
|
|
mSystemCallUpper(0),
|
|
|
|
mSystemCallLower(0)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
nn::hac::SystemCallEntry::SystemCallEntry(const KernelCapabilityEntry & kernel_cap) :
|
2017-07-07 07:09:03 +00:00
|
|
|
mCap(kCapId),
|
|
|
|
mSystemCallUpper(0),
|
|
|
|
mSystemCallLower(0)
|
|
|
|
{
|
|
|
|
setKernelCapability(kernel_cap);
|
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
nn::hac::SystemCallEntry::SystemCallEntry(uint32_t upper_bits, uint32_t lower_bits) :
|
2017-07-07 07:09:03 +00:00
|
|
|
mCap(kCapId),
|
|
|
|
mSystemCallUpper(0),
|
|
|
|
mSystemCallLower(0)
|
|
|
|
{
|
|
|
|
setSystemCallUpperBits(upper_bits);
|
|
|
|
setSystemCallLowerBits(lower_bits);
|
|
|
|
}
|
2018-06-24 15:01:16 +00:00
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
void nn::hac::SystemCallEntry::operator=(const SystemCallEntry& other)
|
2018-06-24 15:01:16 +00:00
|
|
|
{
|
|
|
|
mSystemCallUpper = other.mSystemCallUpper;
|
|
|
|
mSystemCallLower = other.mSystemCallLower;
|
|
|
|
updateCapField();
|
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
bool nn::hac::SystemCallEntry::operator==(const SystemCallEntry& other) const
|
2018-06-24 15:01:16 +00:00
|
|
|
{
|
|
|
|
return (mSystemCallUpper == other.mSystemCallUpper) \
|
|
|
|
&& (mSystemCallLower == other.mSystemCallLower);
|
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
bool nn::hac::SystemCallEntry::operator!=(const SystemCallEntry& other) const
|
2018-06-24 15:01:16 +00:00
|
|
|
{
|
|
|
|
return !(*this == other);
|
|
|
|
}
|
2017-07-07 07:09:03 +00:00
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
const nn::hac::KernelCapabilityEntry & nn::hac::SystemCallEntry::getKernelCapability() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mCap;
|
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
void nn::hac::SystemCallEntry::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 'EnableSystemCalls'");
|
2017-07-07 07:09:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mCap = kernel_cap;
|
|
|
|
processCapField();
|
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
uint32_t nn::hac::SystemCallEntry::getSystemCallUpperBits() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mSystemCallUpper;
|
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
void nn::hac::SystemCallEntry::setSystemCallUpperBits(uint32_t upper_bits)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
if (upper_bits > kSysCallUpperMax)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "Illegal SystemCall upper bits.");
|
|
|
|
}
|
|
|
|
|
|
|
|
mSystemCallUpper = upper_bits;
|
|
|
|
updateCapField();
|
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
uint32_t nn::hac::SystemCallEntry::getSystemCallLowerBits() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mSystemCallLower;
|
|
|
|
}
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
void nn::hac::SystemCallEntry::setSystemCallLowerBits(uint32_t lower_bits)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
if (lower_bits > kSysCallLowerMax)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "Illegal SystemCall upper bits.");
|
|
|
|
}
|
|
|
|
|
|
|
|
mSystemCallLower = lower_bits;
|
|
|
|
updateCapField();
|
|
|
|
}
|