2017-07-07 07:09:03 +00:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <fnd/types.h>
|
|
|
|
#include <nx/KernelCapability.h>
|
|
|
|
|
|
|
|
namespace nx
|
|
|
|
{
|
|
|
|
class KernelVersionEntry
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
KernelVersionEntry();
|
|
|
|
KernelVersionEntry(const KernelCapability& kernel_cap);
|
2018-03-22 05:26:22 +00:00
|
|
|
KernelVersionEntry(uint16_t major, uint8_t minor);
|
2017-07-07 07:09:03 +00:00
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
void operator=(const KernelVersionEntry& other);
|
|
|
|
bool operator==(const KernelVersionEntry& other) const;
|
|
|
|
bool operator!=(const KernelVersionEntry& other) const;
|
|
|
|
|
2017-07-07 07:09:03 +00:00
|
|
|
// kernel capability
|
|
|
|
const KernelCapability& getKernelCapability() const;
|
|
|
|
void setKernelCapability(const KernelCapability& kernel_cap);
|
|
|
|
|
|
|
|
// variables
|
2018-03-22 05:26:22 +00:00
|
|
|
uint16_t getVerMajor() const;
|
|
|
|
void setVerMajor(uint16_t major);
|
|
|
|
uint8_t getVerMinor() const;
|
|
|
|
void setVerMinor(uint8_t minor);
|
2017-07-07 07:09:03 +00:00
|
|
|
private:
|
|
|
|
const std::string kModuleName = "KERNEL_VERSION_ENTRY";
|
|
|
|
static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_KERNEL_VERSION;
|
2018-03-22 05:26:22 +00:00
|
|
|
static const uint32_t kVerMajorBits = 13;
|
|
|
|
static const uint32_t kVerMajorMax = BIT(kVerMajorBits) - 1;
|
|
|
|
static const uint32_t kVerMinorBits = 4;
|
|
|
|
static const uint32_t kVerMinorMax = BIT(kVerMinorBits) - 1;
|
2017-07-07 07:09:03 +00:00
|
|
|
|
|
|
|
KernelCapability mCap;
|
2018-03-22 05:26:22 +00:00
|
|
|
uint16_t mVerMajor;
|
|
|
|
uint8_t mVerMinor;
|
2017-07-07 07:09:03 +00:00
|
|
|
|
|
|
|
inline void updateCapField()
|
|
|
|
{
|
2018-03-22 05:26:22 +00:00
|
|
|
uint32_t field = 0;
|
|
|
|
field |= (uint32_t)(mVerMinor & kVerMinorMax) << 0;
|
|
|
|
field |= (uint32_t)(mVerMajor & kVerMajorMax) << kVerMinorBits;
|
2017-07-07 07:09:03 +00:00
|
|
|
mCap.setField(field);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void processCapField()
|
|
|
|
{
|
2018-03-22 05:26:22 +00:00
|
|
|
uint32_t field = mCap.getField();
|
2017-07-07 07:09:03 +00:00
|
|
|
mVerMinor = (field >> 0) & kVerMinorMax;
|
|
|
|
mVerMajor = (field >> kVerMinorBits) & kVerMajorMax;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|