2017-08-05 13:09:50 +00:00
|
|
|
#include <nx/KernelCapability.h>
|
2017-07-07 07:09:03 +00:00
|
|
|
|
|
|
|
using namespace nx;
|
|
|
|
|
|
|
|
KernelCapability::KernelCapability() :
|
|
|
|
mType(KC_INVALID)
|
|
|
|
{}
|
|
|
|
|
|
|
|
KernelCapability::KernelCapability(KernelCapId type) :
|
|
|
|
mType(type),
|
|
|
|
mField(0)
|
|
|
|
{}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
KernelCapability::KernelCapability(KernelCapId type, uint32_t field) :
|
2017-07-07 07:09:03 +00:00
|
|
|
mType(type),
|
|
|
|
mField(field)
|
|
|
|
{}
|
|
|
|
|
|
|
|
const KernelCapability & nx::KernelCapability::operator=(const KernelCapability & other)
|
|
|
|
{
|
|
|
|
mType = other.mType;
|
|
|
|
mField = other.mField;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
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-03-22 05:26:22 +00:00
|
|
|
uint32_t KernelCapability::getCap() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return (mField & getFieldMask()) << getFieldShift() | getCapMask();
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void KernelCapability::setCap(uint32_t cap)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
mType = getCapId(cap);
|
|
|
|
mField = (cap >> getFieldShift()) & getFieldMask();
|
|
|
|
}
|
|
|
|
|
|
|
|
KernelCapability::KernelCapId KernelCapability::getType() const
|
|
|
|
{
|
|
|
|
return mType;
|
|
|
|
}
|
|
|
|
|
|
|
|
void KernelCapability::setType(KernelCapId type)
|
|
|
|
{
|
|
|
|
mType = type;
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
uint32_t KernelCapability::getField() const
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
return mField & getFieldMask();
|
|
|
|
}
|
|
|
|
|
2018-03-22 05:26:22 +00:00
|
|
|
void KernelCapability::setField(uint32_t field)
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
mField = field;
|
|
|
|
}
|