2017-08-05 13:09:50 +00:00
|
|
|
#include <nx/SystemCallEntry.h>
|
2017-07-07 07:09:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nx::SystemCallEntry::SystemCallEntry() :
|
|
|
|
mCap(kCapId),
|
|
|
|
mSystemCallUpper(0),
|
|
|
|
mSystemCallLower(0)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
nx::SystemCallEntry::SystemCallEntry(const KernelCapability & kernel_cap) :
|
|
|
|
mCap(kCapId),
|
|
|
|
mSystemCallUpper(0),
|
|
|
|
mSystemCallLower(0)
|
|
|
|
{
|
|
|
|
setKernelCapability(kernel_cap);
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
nx::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);
|
|
|
|
}
|
|
|
|
|
|
|
|
const nx::KernelCapability & nx::SystemCallEntry::getKernelCapability() const
|
|
|
|
{
|
|
|
|
return mCap;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nx::SystemCallEntry::setKernelCapability(const KernelCapability & kernel_cap)
|
|
|
|
{
|
|
|
|
if (kernel_cap.getType() != kCapId)
|
|
|
|
{
|
|
|
|
throw fnd::Exception(kModuleName, "KernelCapability is not type 'EnableSystemCalls'");
|
|
|
|
}
|
|
|
|
|
|
|
|
mCap = kernel_cap;
|
|
|
|
processCapField();
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint32_t nx::SystemCallEntry::getSystemCallUpperBits() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mSystemCallUpper;
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void nx::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-03-22 05:26:22 +00:00
|
|
|
uint32_t nx::SystemCallEntry::getSystemCallLowerBits() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mSystemCallLower;
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void nx::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();
|
|
|
|
}
|