2017-08-05 13:09:50 +00:00
|
|
|
#include <nx/KernelCapability.h>
|
2017-07-07 07:09:03 +00:00
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
nx::KernelCapability::KernelCapability() :
|
2017-07-07 07:09:03 +00:00
|
|
|
mType(KC_INVALID)
|
|
|
|
{}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
nx::KernelCapability::KernelCapability(KernelCapId type) :
|
2017-07-07 07:09:03 +00:00
|
|
|
mType(type),
|
|
|
|
mField(0)
|
|
|
|
{}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
nx::KernelCapability::KernelCapability(KernelCapId type, uint32_t field) :
|
2017-07-07 07:09:03 +00:00
|
|
|
mType(type),
|
|
|
|
mField(field)
|
|
|
|
{}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
void nx::KernelCapability::operator=(const KernelCapability & other)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
mType = other.mType;
|
|
|
|
mField = other.mField;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool nx::KernelCapability::operator==(const KernelCapability & other) const
|
|
|
|
{
|
|
|
|
return (mType == other.mType) \
|
|
|
|
&& (mField == other.mField);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool nx::KernelCapability::operator!=(const KernelCapability & other) const
|
|
|
|
{
|
|
|
|
return !operator==(other);
|
|
|
|
}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
uint32_t nx::KernelCapability::getCap() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return (mField & getFieldMask()) << getFieldShift() | getCapMask();
|
|
|
|
}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
void nx::KernelCapability::setCap(uint32_t cap)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
mType = getCapId(cap);
|
|
|
|
mField = (cap >> getFieldShift()) & getFieldMask();
|
|
|
|
}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
nx::KernelCapability::KernelCapId nx::KernelCapability::getType() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mType;
|
|
|
|
}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
void nx::KernelCapability::setType(KernelCapId type)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
mType = type;
|
|
|
|
}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
uint32_t nx::KernelCapability::getField() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mField & getFieldMask();
|
|
|
|
}
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
void nx::KernelCapability::setField(uint32_t field)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
mField = field;
|
|
|
|
}
|