2017-07-07 07:09:03 +00:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <fnd/types.h>
|
2018-08-07 07:17:51 +00:00
|
|
|
#include <nn/hac/KernelCapabilityEntry.h>
|
2017-07-07 07:09:03 +00:00
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
namespace nn
|
|
|
|
{
|
|
|
|
namespace hac
|
2017-07-07 07:09:03 +00:00
|
|
|
{
|
|
|
|
class SystemCallEntry
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SystemCallEntry();
|
2018-06-29 04:24:39 +00:00
|
|
|
SystemCallEntry(const KernelCapabilityEntry& kernel_cap);
|
2018-03-22 05:26:22 +00:00
|
|
|
SystemCallEntry(uint32_t upper_bits, uint32_t lower_bits);
|
2017-07-07 07:09:03 +00:00
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
void operator=(const SystemCallEntry& other);
|
|
|
|
bool operator==(const SystemCallEntry& other) const;
|
|
|
|
bool operator!=(const SystemCallEntry& other) const;
|
|
|
|
|
2017-07-07 07:09:03 +00:00
|
|
|
// kernel capability
|
2018-06-29 04:24:39 +00:00
|
|
|
const KernelCapabilityEntry& getKernelCapability() const;
|
|
|
|
void setKernelCapability(const KernelCapabilityEntry& kernel_cap);
|
2017-07-07 07:09:03 +00:00
|
|
|
|
|
|
|
// variables
|
2018-03-22 05:26:22 +00:00
|
|
|
uint32_t getSystemCallUpperBits() const;
|
|
|
|
void setSystemCallUpperBits(uint32_t upper_bits);
|
|
|
|
uint32_t getSystemCallLowerBits() const;
|
|
|
|
void setSystemCallLowerBits(uint32_t lower_bits);
|
2017-07-07 07:09:03 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const std::string kModuleName = "SYSTEM_CALL_ENTRY";
|
2018-06-29 04:24:39 +00:00
|
|
|
static const kc::KernelCapId kCapId = kc::KC_ENABLE_SYSTEM_CALLS;
|
2018-03-22 05:26:22 +00:00
|
|
|
static const uint32_t kSysCallUpperBits = 3;
|
|
|
|
static const uint32_t kSysCallLowerBits = 24;
|
|
|
|
static const uint32_t kSysCallUpperMax = BIT(kSysCallUpperBits) - 1;
|
|
|
|
static const uint32_t kSysCallLowerMax = BIT(kSysCallLowerBits) - 1;
|
2017-07-07 07:09:03 +00:00
|
|
|
|
2018-06-29 04:24:39 +00:00
|
|
|
KernelCapabilityEntry mCap;
|
2018-03-22 05:26:22 +00:00
|
|
|
uint32_t mSystemCallUpper;
|
|
|
|
uint32_t mSystemCallLower;
|
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)(mSystemCallLower & kSysCallLowerMax) << 0;
|
|
|
|
field |= (uint32_t)(mSystemCallUpper & kSysCallUpperMax) << kSysCallLowerBits;
|
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
|
|
|
mSystemCallLower = (field >> 0) & kSysCallLowerMax;
|
|
|
|
mSystemCallUpper = (field >> kSysCallLowerBits) & kSysCallUpperMax;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2018-08-07 07:17:51 +00:00
|
|
|
}
|