nstool/lib/libhac/include/nn/hac/HandleTableSizeEntry.h

50 lines
1.3 KiB
C
Raw Normal View History

#pragma once
#include <string>
#include <fnd/types.h>
2018-08-07 07:17:51 +00:00
#include <nn/hac/KernelCapabilityEntry.h>
2018-08-07 07:17:51 +00:00
namespace nn
{
namespace hac
{
class HandleTableSizeEntry
{
public:
HandleTableSizeEntry();
HandleTableSizeEntry(const KernelCapabilityEntry& kernel_cap);
2018-03-22 05:26:22 +00:00
HandleTableSizeEntry(uint16_t size);
void operator=(const HandleTableSizeEntry& other);
bool operator==(const HandleTableSizeEntry& other) const;
bool operator!=(const HandleTableSizeEntry& other) const;
// kernel capability
const KernelCapabilityEntry& getKernelCapability() const;
void setKernelCapability(const KernelCapabilityEntry& kernel_cap);
// variables
2018-03-22 05:26:22 +00:00
uint16_t getHandleTableSize() const;
void setHandleTableSize(uint16_t size);
private:
const std::string kModuleName = "HANDLE_TABLE_SIZE_ENTRY";
static const kc::KernelCapId kCapId = kc::KC_HANDLE_TABLE_SIZE;
2018-03-22 05:26:22 +00:00
static const uint16_t kValBits = 10;
static const uint16_t kMaxHandleTableSize = BIT(kValBits) - 1;
KernelCapabilityEntry mCap;
2018-03-22 05:26:22 +00:00
uint16_t mHandleTableSize;
inline void updateCapField()
{
2018-03-22 05:26:22 +00:00
uint32_t field = mHandleTableSize & kMaxHandleTableSize;
mCap.setField(field);
}
inline void processCapField()
{
2018-03-22 05:26:22 +00:00
uint32_t field = mCap.getField();
mHandleTableSize = field & kMaxHandleTableSize;
}
};
2018-08-07 07:17:51 +00:00
}
}