diff --git a/lib/libnx/include/nx/AccessControlInfoBinary.h b/lib/libnx/include/nx/AccessControlInfoBinary.h index ea9596e..f16cc20 100644 --- a/lib/libnx/include/nx/AccessControlInfoBinary.h +++ b/lib/libnx/include/nx/AccessControlInfoBinary.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include namespace nx { @@ -36,8 +36,8 @@ namespace nx const nx::ServiceAccessControlBinary& getServiceAccessControl() const; void setServiceAccessControl(const ServiceAccessControlBinary& sac); - const nx::KcBinary& getKernelCapabilities() const; - void setKernelCapabilities(const KcBinary& kc); + const nx::KernelCapabilityBinary& getKernelCapabilities() const; + void setKernelCapabilities(const KernelCapabilityBinary& kc); private: const std::string kModuleName = "ACCESS_CONTROL_INFO_BINARY"; @@ -48,6 +48,6 @@ namespace nx uint64_t mProgramId; nx::FileSystemAccessControlBinary mFileSystemAccessControl; nx::ServiceAccessControlBinary mServiceAccessControl; - nx::KcBinary mKernelCapabilities; + nx::KernelCapabilityBinary mKernelCapabilities; }; } \ No newline at end of file diff --git a/lib/libnx/include/nx/AccessControlInfoDescBinary.h b/lib/libnx/include/nx/AccessControlInfoDescBinary.h index de4fbf0..53519a8 100644 --- a/lib/libnx/include/nx/AccessControlInfoDescBinary.h +++ b/lib/libnx/include/nx/AccessControlInfoDescBinary.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include namespace nx { @@ -69,8 +69,8 @@ namespace nx const nx::ServiceAccessControlBinary& getServiceAccessControl() const; void setServiceAccessControl(const ServiceAccessControlBinary& sac); - const nx::KcBinary& getKernelCapabilities() const; - void setKernelCapabilities(const KcBinary& kc); + const nx::KernelCapabilityBinary& getKernelCapabilities() const; + void setKernelCapabilities(const KernelCapabilityBinary& kc); private: const std::string kModuleName = "ACCESS_CONTROL_INFO_DESC_BINARY"; @@ -83,6 +83,6 @@ namespace nx sProgramIdRestrict mProgramIdRestrict; nx::FileSystemAccessControlBinary mFileSystemAccessControl; nx::ServiceAccessControlBinary mServiceAccessControl; - nx::KcBinary mKernelCapabilities; + nx::KernelCapabilityBinary mKernelCapabilities; }; } \ No newline at end of file diff --git a/lib/libnx/include/nx/HandleTableSizeEntry.h b/lib/libnx/include/nx/HandleTableSizeEntry.h index 0041f2d..18c92e8 100644 --- a/lib/libnx/include/nx/HandleTableSizeEntry.h +++ b/lib/libnx/include/nx/HandleTableSizeEntry.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include namespace nx { @@ -9,7 +9,7 @@ namespace nx { public: HandleTableSizeEntry(); - HandleTableSizeEntry(const KernelCapability& kernel_cap); + HandleTableSizeEntry(const KernelCapabilityEntry& kernel_cap); HandleTableSizeEntry(uint16_t size); void operator=(const HandleTableSizeEntry& other); @@ -17,19 +17,19 @@ namespace nx bool operator!=(const HandleTableSizeEntry& other) const; // kernel capability - const KernelCapability& getKernelCapability() const; - void setKernelCapability(const KernelCapability& kernel_cap); + const KernelCapabilityEntry& getKernelCapability() const; + void setKernelCapability(const KernelCapabilityEntry& kernel_cap); // variables uint16_t getHandleTableSize() const; void setHandleTableSize(uint16_t size); private: const std::string kModuleName = "HANDLE_TABLE_SIZE_ENTRY"; - static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_HANDLE_TABLE_SIZE; + static const kc::KernelCapId kCapId = kc::KC_HANDLE_TABLE_SIZE; static const uint16_t kValBits = 10; static const uint16_t kMaxHandleTableSize = BIT(kValBits) - 1; - KernelCapability mCap; + KernelCapabilityEntry mCap; uint16_t mHandleTableSize; inline void updateCapField() diff --git a/lib/libnx/include/nx/HandleTableSizeHandler.h b/lib/libnx/include/nx/HandleTableSizeHandler.h index e14a088..3094df8 100644 --- a/lib/libnx/include/nx/HandleTableSizeHandler.h +++ b/lib/libnx/include/nx/HandleTableSizeHandler.h @@ -15,8 +15,8 @@ namespace nx bool operator!=(const HandleTableSizeHandler& other) const; // kernel capabilty list in/out - void importKernelCapabilityList(const fnd::List& caps); - void exportKernelCapabilityList(fnd::List& caps) const; + void importKernelCapabilityList(const fnd::List& caps); + void exportKernelCapabilityList(fnd::List& caps) const; void clear(); bool isSet() const; diff --git a/lib/libnx/include/nx/IKernelCapabilityHandler.h b/lib/libnx/include/nx/IKernelCapabilityHandler.h index 40e2c57..ad117c4 100644 --- a/lib/libnx/include/nx/IKernelCapabilityHandler.h +++ b/lib/libnx/include/nx/IKernelCapabilityHandler.h @@ -1,15 +1,15 @@ #pragma once #include #include -#include +#include namespace nx { class IKernelCapabilityHandler { public: - virtual void importKernelCapabilityList(const fnd::List& caps) = 0; - virtual void exportKernelCapabilityList(fnd::List& caps) const = 0; + virtual void importKernelCapabilityList(const fnd::List& caps) = 0; + virtual void exportKernelCapabilityList(fnd::List& caps) const = 0; virtual void clear() = 0; virtual bool isSet() const = 0; }; diff --git a/lib/libnx/include/nx/InteruptEntry.h b/lib/libnx/include/nx/InteruptEntry.h index 24b3eac..7633281 100644 --- a/lib/libnx/include/nx/InteruptEntry.h +++ b/lib/libnx/include/nx/InteruptEntry.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include namespace nx { @@ -13,7 +13,7 @@ namespace nx static const uint32_t kInteruptNum = 2; InteruptEntry(); - InteruptEntry(const KernelCapability& kernel_cap); + InteruptEntry(const KernelCapabilityEntry& kernel_cap); InteruptEntry(uint32_t interupt0, uint32_t interupt1); void operator=(const InteruptEntry& other); @@ -21,8 +21,8 @@ namespace nx bool operator!=(const InteruptEntry& other) const; // kernel capability - const KernelCapability& getKernelCapability() const; - void setKernelCapability(const KernelCapability& kernel_cap); + const KernelCapabilityEntry& getKernelCapability() const; + void setKernelCapability(const KernelCapabilityEntry& kernel_cap); // variables uint32_t operator[](size_t index) const; @@ -32,9 +32,9 @@ namespace nx private: const std::string kModuleName = "INTERUPT_ENTRY"; - static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_ENABLE_INTERUPTS; + static const kc::KernelCapId kCapId = kc::KC_ENABLE_INTERUPTS; - KernelCapability mCap; + KernelCapabilityEntry mCap; uint32_t mInterupt[kInteruptNum]; inline void updateCapField() diff --git a/lib/libnx/include/nx/InteruptHandler.h b/lib/libnx/include/nx/InteruptHandler.h index 4e41f06..529886f 100644 --- a/lib/libnx/include/nx/InteruptHandler.h +++ b/lib/libnx/include/nx/InteruptHandler.h @@ -15,8 +15,8 @@ namespace nx bool operator!=(const InteruptHandler& other) const; // kernel capabilty list in/out - void importKernelCapabilityList(const fnd::List& caps); - void exportKernelCapabilityList(fnd::List& caps) const; + void importKernelCapabilityList(const fnd::List& caps); + void exportKernelCapabilityList(fnd::List& caps) const; void clear(); bool isSet() const; diff --git a/lib/libnx/include/nx/KernelCapability.h b/lib/libnx/include/nx/KernelCapability.h deleted file mode 100644 index f637046..0000000 --- a/lib/libnx/include/nx/KernelCapability.h +++ /dev/null @@ -1,62 +0,0 @@ -#pragma once -#include - -namespace nx -{ - class KernelCapability - { - public: - enum KernelCapId - { - KC_INVALID = 0, - KC_THREAD_INFO = 3, - KC_ENABLE_SYSTEM_CALLS = 4, - KC_MEMORY_MAP = 6, - KC_IO_MEMORY_MAP = 7, - KC_ENABLE_INTERUPTS = 11, - KC_MISC_PARAMS = 13, - KC_KERNEL_VERSION = 14, - KC_HANDLE_TABLE_SIZE = 15, - KC_MISC_FLAGS = 16 - }; - - KernelCapability(); - KernelCapability(KernelCapId type); - KernelCapability(KernelCapId type, uint32_t field); - - void operator=(const KernelCapability& other); - bool operator==(const KernelCapability& other) const; - bool operator!=(const KernelCapability& other) const; - - uint32_t getCap() const; - void setCap(uint32_t cap); - - KernelCapId getType() const; - void setType(KernelCapId type); - - uint32_t getField() const; - void setField(uint32_t field); - - private: - KernelCapId mType; - uint32_t mField; - - inline uint32_t getFieldShift() const { return mType + 1; } - inline uint32_t getFieldMask() const { return BIT(31 - mType) - 1; } - inline uint32_t getCapMask() const { return BIT(mType) - 1; } - inline KernelCapId getCapId(uint32_t cap) const - { - KernelCapId id = KC_INVALID; - for (byte_t tmp = 0; tmp < 31; tmp++) - { - if (((cap >> tmp) & 1) == 0) - { - id = (KernelCapId)tmp; - break; - } - } - return id; - } - }; -} - diff --git a/lib/libnx/include/nx/KcBinary.h b/lib/libnx/include/nx/KernelCapabilityBinary.h similarity index 85% rename from lib/libnx/include/nx/KcBinary.h rename to lib/libnx/include/nx/KernelCapabilityBinary.h index cab1261..d5369a3 100644 --- a/lib/libnx/include/nx/KcBinary.h +++ b/lib/libnx/include/nx/KernelCapabilityBinary.h @@ -14,16 +14,16 @@ namespace nx { - class KcBinary : + class KernelCapabilityBinary : public fnd::ISerialisable { public: - KcBinary(); - KcBinary(const KcBinary& other); + KernelCapabilityBinary(); + KernelCapabilityBinary(const KernelCapabilityBinary& other); - void operator=(const KcBinary& other); - bool operator==(const KcBinary& other) const; - bool operator!=(const KcBinary& other) const; + void operator=(const KernelCapabilityBinary& other); + bool operator==(const KernelCapabilityBinary& other) const; + bool operator!=(const KernelCapabilityBinary& other) const; // export/import binary void toBytes(); diff --git a/lib/libnx/include/nx/KernelCapabilityEntry.h b/lib/libnx/include/nx/KernelCapabilityEntry.h new file mode 100644 index 0000000..9be2761 --- /dev/null +++ b/lib/libnx/include/nx/KernelCapabilityEntry.h @@ -0,0 +1,50 @@ +#pragma once +#include +#include + +namespace nx +{ + class KernelCapabilityEntry + { + public: + + KernelCapabilityEntry(); + KernelCapabilityEntry(kc::KernelCapId type); + KernelCapabilityEntry(kc::KernelCapId type, uint32_t field); + + void operator=(const KernelCapabilityEntry& other); + bool operator==(const KernelCapabilityEntry& other) const; + bool operator!=(const KernelCapabilityEntry& other) const; + + uint32_t getCap() const; + void setCap(uint32_t cap); + + kc::KernelCapId getType() const; + void setType(kc::KernelCapId type); + + uint32_t getField() const; + void setField(uint32_t field); + + private: + kc::KernelCapId mType; + uint32_t mField; + + inline uint32_t getFieldShift() const { return mType + 1; } + inline uint32_t getFieldMask() const { return BIT(31 - mType) - 1; } + inline uint32_t getCapMask() const { return BIT(mType) - 1; } + inline kc::KernelCapId getCapId(uint32_t cap) const + { + kc::KernelCapId id = kc::KC_INVALID; + for (byte_t tmp = 0; tmp < 31; tmp++) + { + if (((cap >> tmp) & 1) == 0) + { + id = (kc::KernelCapId)tmp; + break; + } + } + return id; + } + }; +} + diff --git a/lib/libnx/include/nx/KernelVersionEntry.h b/lib/libnx/include/nx/KernelVersionEntry.h index 68ae61b..d0b339b 100644 --- a/lib/libnx/include/nx/KernelVersionEntry.h +++ b/lib/libnx/include/nx/KernelVersionEntry.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include namespace nx { @@ -9,7 +9,7 @@ namespace nx { public: KernelVersionEntry(); - KernelVersionEntry(const KernelCapability& kernel_cap); + KernelVersionEntry(const KernelCapabilityEntry& kernel_cap); KernelVersionEntry(uint16_t major, uint8_t minor); void operator=(const KernelVersionEntry& other); @@ -17,8 +17,8 @@ namespace nx bool operator!=(const KernelVersionEntry& other) const; // kernel capability - const KernelCapability& getKernelCapability() const; - void setKernelCapability(const KernelCapability& kernel_cap); + const KernelCapabilityEntry& getKernelCapability() const; + void setKernelCapability(const KernelCapabilityEntry& kernel_cap); // variables uint16_t getVerMajor() const; @@ -27,13 +27,13 @@ namespace nx void setVerMinor(uint8_t minor); private: const std::string kModuleName = "KERNEL_VERSION_ENTRY"; - static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_KERNEL_VERSION; + static const kc::KernelCapId kCapId = kc::KC_KERNEL_VERSION; 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; - KernelCapability mCap; + KernelCapabilityEntry mCap; uint16_t mVerMajor; uint8_t mVerMinor; diff --git a/lib/libnx/include/nx/KernelVersionHandler.h b/lib/libnx/include/nx/KernelVersionHandler.h index 851a5c6..be9cc2e 100644 --- a/lib/libnx/include/nx/KernelVersionHandler.h +++ b/lib/libnx/include/nx/KernelVersionHandler.h @@ -15,8 +15,8 @@ namespace nx bool operator!=(const KernelVersionHandler& other) const; // kernel capabilty list in/out - void importKernelCapabilityList(const fnd::List& caps); - void exportKernelCapabilityList(fnd::List& caps) const; + void importKernelCapabilityList(const fnd::List& caps); + void exportKernelCapabilityList(fnd::List& caps) const; void clear(); bool isSet() const; diff --git a/lib/libnx/include/nx/MemoryMappingHandler.h b/lib/libnx/include/nx/MemoryMappingHandler.h index d6fcef7..9b5e0d4 100644 --- a/lib/libnx/include/nx/MemoryMappingHandler.h +++ b/lib/libnx/include/nx/MemoryMappingHandler.h @@ -57,8 +57,8 @@ namespace nx bool operator!=(const MemoryMappingHandler& other) const; // kernel capabilty list in/out - void importKernelCapabilityList(const fnd::List& caps); - void exportKernelCapabilityList(fnd::List& caps) const; + void importKernelCapabilityList(const fnd::List& caps); + void exportKernelCapabilityList(fnd::List& caps) const; void clear(); bool isSet() const; diff --git a/lib/libnx/include/nx/MemoryPageEntry.h b/lib/libnx/include/nx/MemoryPageEntry.h index c73fa45..9fc4536 100644 --- a/lib/libnx/include/nx/MemoryPageEntry.h +++ b/lib/libnx/include/nx/MemoryPageEntry.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include namespace nx { @@ -9,7 +9,7 @@ namespace nx { public: MemoryPageEntry(); - MemoryPageEntry(const KernelCapability& kernel_cap); + MemoryPageEntry(const KernelCapabilityEntry& kernel_cap); MemoryPageEntry(uint32_t page); MemoryPageEntry(uint32_t page, bool flag); @@ -18,8 +18,8 @@ namespace nx bool operator!=(const MemoryPageEntry& other) const; // kernel capability - const KernelCapability& getKernelCapability() const; - void setKernelCapability(const KernelCapability& kernel_cap); + const KernelCapabilityEntry& getKernelCapability() const; + void setKernelCapability(const KernelCapabilityEntry& kernel_cap); // variables uint32_t getPage() const; @@ -34,7 +34,7 @@ namespace nx static const uint32_t kPageBits = 24; static const uint32_t kMaxPage = BIT(kPageBits) - 1; - KernelCapability mCap; + KernelCapabilityEntry mCap; uint32_t mPage; bool mFlag; bool mUseFlag; @@ -45,7 +45,7 @@ namespace nx field |= (uint32_t)(mPage & kMaxPage) << 0; field |= (uint32_t)(mFlag) << kPageBits; mCap.setField(field); - mCap.setType(mUseFlag ? KernelCapability::KC_MEMORY_MAP : KernelCapability::KC_IO_MEMORY_MAP); + mCap.setType(mUseFlag ? kc::KC_MEMORY_MAP : kc::KC_IO_MEMORY_MAP); } inline void processCapField() @@ -53,7 +53,7 @@ namespace nx uint32_t field = mCap.getField(); mPage = (field >> 0) & kMaxPage; mFlag = (field >> kPageBits); - mUseFlag = mCap.getType() == KernelCapability::KC_MEMORY_MAP; + mUseFlag = mCap.getType() == kc::KC_MEMORY_MAP; } }; diff --git a/lib/libnx/include/nx/MiscFlagsEntry.h b/lib/libnx/include/nx/MiscFlagsEntry.h index 3b1b3d9..34167e0 100644 --- a/lib/libnx/include/nx/MiscFlagsEntry.h +++ b/lib/libnx/include/nx/MiscFlagsEntry.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include namespace nx { @@ -9,7 +9,7 @@ namespace nx { public: MiscFlagsEntry(); - MiscFlagsEntry(const KernelCapability& kernel_cap); + MiscFlagsEntry(const KernelCapabilityEntry& kernel_cap); MiscFlagsEntry(uint32_t flags); void operator=(const MiscFlagsEntry& other); @@ -17,19 +17,19 @@ namespace nx bool operator!=(const MiscFlagsEntry& other) const; // kernel capability - const KernelCapability& getKernelCapability() const; - void setKernelCapability(const KernelCapability& kernel_cap); + const KernelCapabilityEntry& getKernelCapability() const; + void setKernelCapability(const KernelCapabilityEntry& kernel_cap); // variables uint32_t getFlags() const; void setFlags(uint32_t flags); private: const std::string kModuleName = "MISC_FLAG_ENTRY"; - static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_MISC_FLAGS; + static const kc::KernelCapId kCapId = kc::KC_MISC_FLAGS; static const uint32_t kValueBits = 15; static const uint32_t kMaxVal = BIT(kValueBits)-1; - KernelCapability mCap; + KernelCapabilityEntry mCap; uint32_t mFlags; inline void updateCapField() diff --git a/lib/libnx/include/nx/MiscFlagsHandler.h b/lib/libnx/include/nx/MiscFlagsHandler.h index 81c4adc..41d3bf9 100644 --- a/lib/libnx/include/nx/MiscFlagsHandler.h +++ b/lib/libnx/include/nx/MiscFlagsHandler.h @@ -35,8 +35,8 @@ namespace nx bool operator!=(const MiscFlagsHandler& other) const; // kernel capabilty list in/out - void importKernelCapabilityList(const fnd::List& caps); - void exportKernelCapabilityList(fnd::List& caps) const; + void importKernelCapabilityList(const fnd::List& caps); + void exportKernelCapabilityList(fnd::List& caps) const; void clear(); bool isSet() const; diff --git a/lib/libnx/include/nx/MiscParamsEntry.h b/lib/libnx/include/nx/MiscParamsEntry.h index 8e7c77c..04b5cc0 100644 --- a/lib/libnx/include/nx/MiscParamsEntry.h +++ b/lib/libnx/include/nx/MiscParamsEntry.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include namespace nx { @@ -9,7 +9,7 @@ namespace nx { public: MiscParamsEntry(); - MiscParamsEntry(const KernelCapability& kernel_cap); + MiscParamsEntry(const KernelCapabilityEntry& kernel_cap); MiscParamsEntry(byte_t program_type); void operator=(const MiscParamsEntry& other); @@ -17,19 +17,19 @@ namespace nx bool operator!=(const MiscParamsEntry& other) const; // kernel capability - const KernelCapability& getKernelCapability() const; - void setKernelCapability(const KernelCapability& kernel_cap); + const KernelCapabilityEntry& getKernelCapability() const; + void setKernelCapability(const KernelCapabilityEntry& kernel_cap); // variables byte_t getProgramType() const; void setProgramType(byte_t type); private: const std::string kModuleName = "MISC_PARAMS_ENTRY"; - static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_MISC_PARAMS; + static const kc::KernelCapId kCapId = kc::KC_MISC_PARAMS; static const byte_t kValBits = 3; static const byte_t kMaxProgramType = BIT(kValBits)-1; - KernelCapability mCap; + KernelCapabilityEntry mCap; byte_t mProgramType; inline void updateCapField() diff --git a/lib/libnx/include/nx/MiscParamsHandler.h b/lib/libnx/include/nx/MiscParamsHandler.h index a22afa5..b88b522 100644 --- a/lib/libnx/include/nx/MiscParamsHandler.h +++ b/lib/libnx/include/nx/MiscParamsHandler.h @@ -15,8 +15,8 @@ namespace nx bool operator!=(const MiscParamsHandler& other) const; // kernel capabilty list in/out - void importKernelCapabilityList(const fnd::List& caps); - void exportKernelCapabilityList(fnd::List& caps) const; + void importKernelCapabilityList(const fnd::List& caps); + void exportKernelCapabilityList(fnd::List& caps) const; void clear(); bool isSet() const; diff --git a/lib/libnx/include/nx/SystemCallEntry.h b/lib/libnx/include/nx/SystemCallEntry.h index 7b2007d..1a1ca64 100644 --- a/lib/libnx/include/nx/SystemCallEntry.h +++ b/lib/libnx/include/nx/SystemCallEntry.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include namespace nx { @@ -9,7 +9,7 @@ namespace nx { public: SystemCallEntry(); - SystemCallEntry(const KernelCapability& kernel_cap); + SystemCallEntry(const KernelCapabilityEntry& kernel_cap); SystemCallEntry(uint32_t upper_bits, uint32_t lower_bits); void operator=(const SystemCallEntry& other); @@ -17,8 +17,8 @@ namespace nx bool operator!=(const SystemCallEntry& other) const; // kernel capability - const KernelCapability& getKernelCapability() const; - void setKernelCapability(const KernelCapability& kernel_cap); + const KernelCapabilityEntry& getKernelCapability() const; + void setKernelCapability(const KernelCapabilityEntry& kernel_cap); // variables uint32_t getSystemCallUpperBits() const; @@ -28,13 +28,13 @@ namespace nx private: const std::string kModuleName = "SYSTEM_CALL_ENTRY"; - static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_ENABLE_SYSTEM_CALLS; + static const kc::KernelCapId kCapId = kc::KC_ENABLE_SYSTEM_CALLS; 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; - KernelCapability mCap; + KernelCapabilityEntry mCap; uint32_t mSystemCallUpper; uint32_t mSystemCallLower; diff --git a/lib/libnx/include/nx/SystemCallHandler.h b/lib/libnx/include/nx/SystemCallHandler.h index befa1ad..35ac45a 100644 --- a/lib/libnx/include/nx/SystemCallHandler.h +++ b/lib/libnx/include/nx/SystemCallHandler.h @@ -16,8 +16,8 @@ namespace nx bool operator!=(const SystemCallHandler& other) const; // kernel capabilty list in/out - void importKernelCapabilityList(const fnd::List& caps); - void exportKernelCapabilityList(fnd::List& caps) const; + void importKernelCapabilityList(const fnd::List& caps); + void exportKernelCapabilityList(fnd::List& caps) const; void clear(); bool isSet() const; diff --git a/lib/libnx/include/nx/ThreadInfoEntry.h b/lib/libnx/include/nx/ThreadInfoEntry.h index 0468337..ff0e062 100644 --- a/lib/libnx/include/nx/ThreadInfoEntry.h +++ b/lib/libnx/include/nx/ThreadInfoEntry.h @@ -1,7 +1,7 @@ #pragma once #include #include -#include +#include namespace nx { @@ -9,7 +9,7 @@ namespace nx { public: ThreadInfoEntry(); - ThreadInfoEntry(const KernelCapability& kernel_cap); + ThreadInfoEntry(const KernelCapabilityEntry& kernel_cap); ThreadInfoEntry(uint8_t min_priority, uint8_t max_priority, uint8_t min_cpu_id, uint8_t max_cpu_id); void operator=(const ThreadInfoEntry& other); @@ -17,8 +17,8 @@ namespace nx bool operator!=(const ThreadInfoEntry& other) const; // kernel capability - const KernelCapability& getKernelCapability() const; - void setKernelCapability(const KernelCapability& kernel_cap); + const KernelCapabilityEntry& getKernelCapability() const; + void setKernelCapability(const KernelCapabilityEntry& kernel_cap); // variables uint8_t getMinPriority() const; @@ -32,13 +32,13 @@ namespace nx private: const std::string kModuleName = "THREAD_INFO_ENTRY"; - static const KernelCapability::KernelCapId kCapId = KernelCapability::KC_THREAD_INFO; + static const kc::KernelCapId kCapId = kc::KC_THREAD_INFO; static const uint8_t kValBits = 6; static const uint8_t kMaxVal = BIT(kValBits)-1; static const uint8_t kDefaultPriority = 6; static const uint8_t kDefaultCpuId = 8; - KernelCapability mCap; + KernelCapabilityEntry mCap; uint8_t mMinPriority; uint8_t mMaxPriority; uint8_t mMinCpuId; diff --git a/lib/libnx/include/nx/ThreadInfoHandler.h b/lib/libnx/include/nx/ThreadInfoHandler.h index d544c2c..d2fd01c 100644 --- a/lib/libnx/include/nx/ThreadInfoHandler.h +++ b/lib/libnx/include/nx/ThreadInfoHandler.h @@ -15,8 +15,8 @@ namespace nx bool operator!=(const ThreadInfoHandler& other) const; // kernel capabilty list in/out - void importKernelCapabilityList(const fnd::List& caps); - void exportKernelCapabilityList(fnd::List& caps) const; + void importKernelCapabilityList(const fnd::List& caps); + void exportKernelCapabilityList(fnd::List& caps) const; void clear(); bool isSet() const; diff --git a/lib/libnx/include/nx/kc.h b/lib/libnx/include/nx/kc.h new file mode 100644 index 0000000..192c6de --- /dev/null +++ b/lib/libnx/include/nx/kc.h @@ -0,0 +1,24 @@ +#pragma once +#include +#include +#include + +namespace nx +{ + namespace kc + { + enum KernelCapId + { + KC_INVALID = 0, + KC_THREAD_INFO = 3, + KC_ENABLE_SYSTEM_CALLS = 4, + KC_MEMORY_MAP = 6, + KC_IO_MEMORY_MAP = 7, + KC_ENABLE_INTERUPTS = 11, + KC_MISC_PARAMS = 13, + KC_KERNEL_VERSION = 14, + KC_HANDLE_TABLE_SIZE = 15, + KC_MISC_FLAGS = 16 + }; + } +} \ No newline at end of file diff --git a/lib/libnx/source/AccessControlInfoBinary.cpp b/lib/libnx/source/AccessControlInfoBinary.cpp index 41e4ea9..0abad1a 100644 --- a/lib/libnx/source/AccessControlInfoBinary.cpp +++ b/lib/libnx/source/AccessControlInfoBinary.cpp @@ -161,12 +161,12 @@ void nx::AccessControlInfoBinary::setServiceAccessControl(const nx::ServiceAcces mServiceAccessControl = sac; } -const nx::KcBinary& nx::AccessControlInfoBinary::getKernelCapabilities() const +const nx::KernelCapabilityBinary& nx::AccessControlInfoBinary::getKernelCapabilities() const { return mKernelCapabilities; } -void nx::AccessControlInfoBinary::setKernelCapabilities(const nx::KcBinary& kc) +void nx::AccessControlInfoBinary::setKernelCapabilities(const nx::KernelCapabilityBinary& kc) { mKernelCapabilities = kc; } \ No newline at end of file diff --git a/lib/libnx/source/AccessControlInfoDescBinary.cpp b/lib/libnx/source/AccessControlInfoDescBinary.cpp index 0b07e0e..122d89c 100644 --- a/lib/libnx/source/AccessControlInfoDescBinary.cpp +++ b/lib/libnx/source/AccessControlInfoDescBinary.cpp @@ -239,12 +239,12 @@ void nx::AccessControlInfoDescBinary::setServiceAccessControl(const nx::ServiceA mServiceAccessControl = sac; } -const nx::KcBinary& nx::AccessControlInfoDescBinary::getKernelCapabilities() const +const nx::KernelCapabilityBinary& nx::AccessControlInfoDescBinary::getKernelCapabilities() const { return mKernelCapabilities; } -void nx::AccessControlInfoDescBinary::setKernelCapabilities(const nx::KcBinary& kc) +void nx::AccessControlInfoDescBinary::setKernelCapabilities(const nx::KernelCapabilityBinary& kc) { mKernelCapabilities = kc; } \ No newline at end of file diff --git a/lib/libnx/source/HandleTableSizeEntry.cpp b/lib/libnx/source/HandleTableSizeEntry.cpp index bfe475e..c01471c 100644 --- a/lib/libnx/source/HandleTableSizeEntry.cpp +++ b/lib/libnx/source/HandleTableSizeEntry.cpp @@ -5,7 +5,7 @@ nx::HandleTableSizeEntry::HandleTableSizeEntry() : mHandleTableSize(0) {} -nx::HandleTableSizeEntry::HandleTableSizeEntry(const KernelCapability & kernel_cap) : +nx::HandleTableSizeEntry::HandleTableSizeEntry(const KernelCapabilityEntry & kernel_cap) : mCap(kCapId), mHandleTableSize(0) { @@ -36,16 +36,16 @@ bool nx::HandleTableSizeEntry::operator!=(const HandleTableSizeEntry& other) con } -const nx::KernelCapability & nx::HandleTableSizeEntry::getKernelCapability() const +const nx::KernelCapabilityEntry & nx::HandleTableSizeEntry::getKernelCapability() const { return mCap; } -void nx::HandleTableSizeEntry::setKernelCapability(const KernelCapability & kernel_cap) +void nx::HandleTableSizeEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) { if (kernel_cap.getType() != kCapId) { - throw fnd::Exception(kModuleName, "KernelCapability is not type 'HandleTableSize'"); + throw fnd::Exception(kModuleName, "KernelCapabilityEntry is not type 'HandleTableSize'"); } mCap = kernel_cap; diff --git a/lib/libnx/source/HandleTableSizeHandler.cpp b/lib/libnx/source/HandleTableSizeHandler.cpp index b7d43ac..da1bda1 100644 --- a/lib/libnx/source/HandleTableSizeHandler.cpp +++ b/lib/libnx/source/HandleTableSizeHandler.cpp @@ -22,7 +22,7 @@ bool nx::HandleTableSizeHandler::operator!=(const HandleTableSizeHandler & other return !(*this == other); } -void nx::HandleTableSizeHandler::importKernelCapabilityList(const fnd::List& caps) +void nx::HandleTableSizeHandler::importKernelCapabilityList(const fnd::List& caps) { if (caps.size() > kMaxKernelCapNum) { @@ -36,7 +36,7 @@ void nx::HandleTableSizeHandler::importKernelCapabilityList(const fnd::List& caps) const +void nx::HandleTableSizeHandler::exportKernelCapabilityList(fnd::List& caps) const { if (isSet() == false) return; diff --git a/lib/libnx/source/InteruptEntry.cpp b/lib/libnx/source/InteruptEntry.cpp index 2f3892b..ef07c4f 100644 --- a/lib/libnx/source/InteruptEntry.cpp +++ b/lib/libnx/source/InteruptEntry.cpp @@ -7,7 +7,7 @@ nx::InteruptEntry::InteruptEntry() : } -nx::InteruptEntry::InteruptEntry(const KernelCapability & kernel_cap) : +nx::InteruptEntry::InteruptEntry(const KernelCapabilityEntry & kernel_cap) : mCap(kCapId), mInterupt{ 0,0 } { @@ -40,16 +40,16 @@ bool nx::InteruptEntry::operator!=(const InteruptEntry& other) const return !(*this == other); } -const nx::KernelCapability & nx::InteruptEntry::getKernelCapability() const +const nx::KernelCapabilityEntry & nx::InteruptEntry::getKernelCapability() const { return mCap; } -void nx::InteruptEntry::setKernelCapability(const KernelCapability & kernel_cap) +void nx::InteruptEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) { if (kernel_cap.getType() != kCapId) { - throw fnd::Exception(kModuleName, "KernelCapability is not type 'EnableInterupts'"); + throw fnd::Exception(kModuleName, "KernelCapabilityEntry is not type 'EnableInterupts'"); } mCap = kernel_cap; diff --git a/lib/libnx/source/InteruptHandler.cpp b/lib/libnx/source/InteruptHandler.cpp index 795405b..b2e95f1 100644 --- a/lib/libnx/source/InteruptHandler.cpp +++ b/lib/libnx/source/InteruptHandler.cpp @@ -22,7 +22,7 @@ bool nx::InteruptHandler::operator!=(const InteruptHandler & other) const return !(*this == other); } -void nx::InteruptHandler::importKernelCapabilityList(const fnd::List& caps) +void nx::InteruptHandler::importKernelCapabilityList(const fnd::List& caps) { if (caps.size() == 0) return; @@ -58,7 +58,7 @@ void nx::InteruptHandler::importKernelCapabilityList(const fnd::List& caps) const +void nx::InteruptHandler::exportKernelCapabilityList(fnd::List& caps) const { if (isSet() == false) return; diff --git a/lib/libnx/source/KernelCapability.cpp b/lib/libnx/source/KernelCapability.cpp deleted file mode 100644 index 575bdf1..0000000 --- a/lib/libnx/source/KernelCapability.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include - -nx::KernelCapability::KernelCapability() : - mType(KC_INVALID) -{} - -nx::KernelCapability::KernelCapability(KernelCapId type) : - mType(type), - mField(0) -{} - -nx::KernelCapability::KernelCapability(KernelCapId type, uint32_t field) : - mType(type), - mField(field) -{} - -void nx::KernelCapability::operator=(const KernelCapability & other) -{ - 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); -} - -uint32_t nx::KernelCapability::getCap() const -{ - return (mField & getFieldMask()) << getFieldShift() | getCapMask(); -} - -void nx::KernelCapability::setCap(uint32_t cap) -{ - mType = getCapId(cap); - mField = (cap >> getFieldShift()) & getFieldMask(); -} - -nx::KernelCapability::KernelCapId nx::KernelCapability::getType() const -{ - return mType; -} - -void nx::KernelCapability::setType(KernelCapId type) -{ - mType = type; -} - -uint32_t nx::KernelCapability::getField() const -{ - return mField & getFieldMask(); -} - -void nx::KernelCapability::setField(uint32_t field) -{ - mField = field; -} diff --git a/lib/libnx/source/KcBinary.cpp b/lib/libnx/source/KernelCapabilityBinary.cpp similarity index 54% rename from lib/libnx/source/KcBinary.cpp rename to lib/libnx/source/KernelCapabilityBinary.cpp index 88fc6c0..39f7425 100644 --- a/lib/libnx/source/KcBinary.cpp +++ b/lib/libnx/source/KernelCapabilityBinary.cpp @@ -1,14 +1,14 @@ -#include +#include -nx::KcBinary::KcBinary() +nx::KernelCapabilityBinary::KernelCapabilityBinary() {} -nx::KcBinary::KcBinary(const KcBinary & other) +nx::KernelCapabilityBinary::KernelCapabilityBinary(const KernelCapabilityBinary & other) { *this = other; } -void nx::KcBinary::operator=(const KcBinary & other) +void nx::KernelCapabilityBinary::operator=(const KernelCapabilityBinary & other) { clear(); mThreadInfo = other.mThreadInfo; @@ -21,7 +21,7 @@ void nx::KcBinary::operator=(const KcBinary & other) mMiscFlags = other.mMiscFlags; } -bool nx::KcBinary::operator==(const KcBinary & other) const +bool nx::KernelCapabilityBinary::operator==(const KernelCapabilityBinary & other) const { return (mThreadInfo == other.mThreadInfo) \ && (mSystemCalls == other.mSystemCalls) \ @@ -33,14 +33,14 @@ bool nx::KcBinary::operator==(const KcBinary & other) const && (mMiscFlags == other.mMiscFlags); } -bool nx::KcBinary::operator!=(const KcBinary & other) const +bool nx::KernelCapabilityBinary::operator!=(const KernelCapabilityBinary & other) const { return !(*this == other); } -void nx::KcBinary::toBytes() +void nx::KernelCapabilityBinary::toBytes() { - fnd::List caps; + fnd::List caps; // get kernel capabiliteis mThreadInfo.exportKernelCapabilityList(caps); @@ -63,57 +63,57 @@ void nx::KcBinary::toBytes() } } -void nx::KcBinary::fromBytes(const byte_t * data, size_t len) +void nx::KernelCapabilityBinary::fromBytes(const byte_t * data, size_t len) { if ((len % sizeof(uint32_t)) != 0) { - throw fnd::Exception(kModuleName, "KernelCapability list must be aligned to 4 bytes"); + throw fnd::Exception(kModuleName, "KernelCapabilityEntry list must be aligned to 4 bytes"); } - // save copy of KcBinary + // save copy of KernelCapabilityBinary mRawBinary.alloc(len); memcpy(mRawBinary.data(), data, len); - fnd::List threadInfoCaps; - fnd::List systemCallCaps; - fnd::List memoryMapCaps; - fnd::List interuptCaps; - fnd::List miscParamCaps; - fnd::List kernelVersionCaps; - fnd::List handleTableSizeCaps; - fnd::List miscFlagsCaps; + fnd::List threadInfoCaps; + fnd::List systemCallCaps; + fnd::List memoryMapCaps; + fnd::List interuptCaps; + fnd::List miscParamCaps; + fnd::List kernelVersionCaps; + fnd::List handleTableSizeCaps; + fnd::List miscFlagsCaps; const uint32_t* raw_caps = (const uint32_t*)mRawBinary.data(); size_t cap_num = mRawBinary.size() / sizeof(uint32_t); - KernelCapability cap; + KernelCapabilityEntry cap; for (size_t i = 0; i < cap_num; i++) { cap.setCap(le_word(raw_caps[i])); switch (cap.getType()) { - case (KernelCapability::KC_THREAD_INFO) : + case (kc::KC_THREAD_INFO) : threadInfoCaps.addElement(cap); break; - case (KernelCapability::KC_ENABLE_SYSTEM_CALLS): + case (kc::KC_ENABLE_SYSTEM_CALLS): systemCallCaps.addElement(cap); break; - case (KernelCapability::KC_MEMORY_MAP): - case (KernelCapability::KC_IO_MEMORY_MAP): + case (kc::KC_MEMORY_MAP): + case (kc::KC_IO_MEMORY_MAP): memoryMapCaps.addElement(cap); break; - case (KernelCapability::KC_ENABLE_INTERUPTS): + case (kc::KC_ENABLE_INTERUPTS): interuptCaps.addElement(cap); break; - case (KernelCapability::KC_MISC_PARAMS): + case (kc::KC_MISC_PARAMS): miscParamCaps.addElement(cap); break; - case (KernelCapability::KC_KERNEL_VERSION): + case (kc::KC_KERNEL_VERSION): kernelVersionCaps.addElement(cap); break; - case (KernelCapability::KC_HANDLE_TABLE_SIZE): + case (kc::KC_HANDLE_TABLE_SIZE): handleTableSizeCaps.addElement(cap); break; - case (KernelCapability::KC_MISC_FLAGS): + case (kc::KC_MISC_FLAGS): miscFlagsCaps.addElement(cap); break; default: @@ -131,12 +131,12 @@ void nx::KcBinary::fromBytes(const byte_t * data, size_t len) mMiscFlags.importKernelCapabilityList(miscFlagsCaps); } -const fnd::Vec& nx::KcBinary::getBytes() const +const fnd::Vec& nx::KernelCapabilityBinary::getBytes() const { return mRawBinary; } -void nx::KcBinary::clear() +void nx::KernelCapabilityBinary::clear() { mRawBinary.clear(); mThreadInfo.clear(); @@ -149,82 +149,82 @@ void nx::KcBinary::clear() mMiscFlags.clear(); } -const nx::ThreadInfoHandler & nx::KcBinary::getThreadInfo() const +const nx::ThreadInfoHandler & nx::KernelCapabilityBinary::getThreadInfo() const { return mThreadInfo; } -nx::ThreadInfoHandler & nx::KcBinary::getThreadInfo() +nx::ThreadInfoHandler & nx::KernelCapabilityBinary::getThreadInfo() { return mThreadInfo; } -const nx::SystemCallHandler & nx::KcBinary::getSystemCalls() const +const nx::SystemCallHandler & nx::KernelCapabilityBinary::getSystemCalls() const { return mSystemCalls; } -nx::SystemCallHandler & nx::KcBinary::getSystemCalls() +nx::SystemCallHandler & nx::KernelCapabilityBinary::getSystemCalls() { return mSystemCalls; } -const nx::MemoryMappingHandler & nx::KcBinary::getMemoryMaps() const +const nx::MemoryMappingHandler & nx::KernelCapabilityBinary::getMemoryMaps() const { return mMemoryMap; } -nx::MemoryMappingHandler & nx::KcBinary::getMemoryMaps() +nx::MemoryMappingHandler & nx::KernelCapabilityBinary::getMemoryMaps() { return mMemoryMap; } -const nx::InteruptHandler & nx::KcBinary::getInterupts() const +const nx::InteruptHandler & nx::KernelCapabilityBinary::getInterupts() const { return mInterupts; } -nx::InteruptHandler & nx::KcBinary::getInterupts() +nx::InteruptHandler & nx::KernelCapabilityBinary::getInterupts() { return mInterupts; } -const nx::MiscParamsHandler & nx::KcBinary::getMiscParams() const +const nx::MiscParamsHandler & nx::KernelCapabilityBinary::getMiscParams() const { return mMiscParams; } -nx::MiscParamsHandler & nx::KcBinary::getMiscParams() +nx::MiscParamsHandler & nx::KernelCapabilityBinary::getMiscParams() { return mMiscParams; } -const nx::KernelVersionHandler & nx::KcBinary::getKernelVersion() const +const nx::KernelVersionHandler & nx::KernelCapabilityBinary::getKernelVersion() const { return mKernelVersion; } -nx::KernelVersionHandler & nx::KcBinary::getKernelVersion() +nx::KernelVersionHandler & nx::KernelCapabilityBinary::getKernelVersion() { return mKernelVersion; } -const nx::HandleTableSizeHandler & nx::KcBinary::getHandleTableSize() const +const nx::HandleTableSizeHandler & nx::KernelCapabilityBinary::getHandleTableSize() const { return mHandleTableSize; } -nx::HandleTableSizeHandler & nx::KcBinary::getHandleTableSize() +nx::HandleTableSizeHandler & nx::KernelCapabilityBinary::getHandleTableSize() { return mHandleTableSize; } -const nx::MiscFlagsHandler & nx::KcBinary::getMiscFlags() const +const nx::MiscFlagsHandler & nx::KernelCapabilityBinary::getMiscFlags() const { return mMiscFlags; } -nx::MiscFlagsHandler & nx::KcBinary::getMiscFlags() +nx::MiscFlagsHandler & nx::KernelCapabilityBinary::getMiscFlags() { return mMiscFlags; } \ No newline at end of file diff --git a/lib/libnx/source/KernelCapabilityEntry.cpp b/lib/libnx/source/KernelCapabilityEntry.cpp new file mode 100644 index 0000000..cbca030 --- /dev/null +++ b/lib/libnx/source/KernelCapabilityEntry.cpp @@ -0,0 +1,63 @@ +#include + +nx::KernelCapabilityEntry::KernelCapabilityEntry() : + mType(kc::KC_INVALID) +{} + +nx::KernelCapabilityEntry::KernelCapabilityEntry(kc::KernelCapId type) : + mType(type), + mField(0) +{} + +nx::KernelCapabilityEntry::KernelCapabilityEntry(kc::KernelCapId type, uint32_t field) : + mType(type), + mField(field) +{} + +void nx::KernelCapabilityEntry::operator=(const KernelCapabilityEntry & other) +{ + mType = other.mType; + mField = other.mField; +} + +bool nx::KernelCapabilityEntry::operator==(const KernelCapabilityEntry & other) const +{ + return (mType == other.mType) \ + && (mField == other.mField); +} + +bool nx::KernelCapabilityEntry::operator!=(const KernelCapabilityEntry & other) const +{ + return !operator==(other); +} + +uint32_t nx::KernelCapabilityEntry::getCap() const +{ + return (mField & getFieldMask()) << getFieldShift() | getCapMask(); +} + +void nx::KernelCapabilityEntry::setCap(uint32_t cap) +{ + mType = getCapId(cap); + mField = (cap >> getFieldShift()) & getFieldMask(); +} + +nx::kc::KernelCapId nx::KernelCapabilityEntry::getType() const +{ + return mType; +} + +void nx::KernelCapabilityEntry::setType(kc::KernelCapId type) +{ + mType = type; +} + +uint32_t nx::KernelCapabilityEntry::getField() const +{ + return mField & getFieldMask(); +} + +void nx::KernelCapabilityEntry::setField(uint32_t field) +{ + mField = field; +} diff --git a/lib/libnx/source/KernelVersionEntry.cpp b/lib/libnx/source/KernelVersionEntry.cpp index 6c73e73..efd07ab 100644 --- a/lib/libnx/source/KernelVersionEntry.cpp +++ b/lib/libnx/source/KernelVersionEntry.cpp @@ -6,7 +6,7 @@ nx::KernelVersionEntry::KernelVersionEntry() : mVerMinor(0) {} -nx::KernelVersionEntry::KernelVersionEntry(const KernelCapability & kernel_cap) : +nx::KernelVersionEntry::KernelVersionEntry(const KernelCapabilityEntry & kernel_cap) : mCap(kCapId), mVerMajor(0), mVerMinor(0) @@ -41,16 +41,16 @@ bool nx::KernelVersionEntry::operator!=(const KernelVersionEntry& other) const return !(*this == other); } -const nx::KernelCapability & nx::KernelVersionEntry::getKernelCapability() const +const nx::KernelCapabilityEntry & nx::KernelVersionEntry::getKernelCapability() const { return mCap; } -void nx::KernelVersionEntry::setKernelCapability(const KernelCapability & kernel_cap) +void nx::KernelVersionEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) { if (kernel_cap.getType() != kCapId) { - throw fnd::Exception(kModuleName, "KernelCapability is not type 'KernelVersion'"); + throw fnd::Exception(kModuleName, "KernelCapabilityEntry is not type 'KernelVersion'"); } mCap = kernel_cap; diff --git a/lib/libnx/source/KernelVersionHandler.cpp b/lib/libnx/source/KernelVersionHandler.cpp index e06029b..ee3e960 100644 --- a/lib/libnx/source/KernelVersionHandler.cpp +++ b/lib/libnx/source/KernelVersionHandler.cpp @@ -22,7 +22,7 @@ bool nx::KernelVersionHandler::operator!=(const KernelVersionHandler & other) co return !(*this == other); } -void nx::KernelVersionHandler::importKernelCapabilityList(const fnd::List& caps) +void nx::KernelVersionHandler::importKernelCapabilityList(const fnd::List& caps) { if (caps.size() > kMaxKernelCapNum) { @@ -37,7 +37,7 @@ void nx::KernelVersionHandler::importKernelCapabilityList(const fnd::List& caps) const +void nx::KernelVersionHandler::exportKernelCapabilityList(fnd::List& caps) const { if (isSet() == false) return; diff --git a/lib/libnx/source/MemoryMappingHandler.cpp b/lib/libnx/source/MemoryMappingHandler.cpp index 7ec44a6..4810f1b 100644 --- a/lib/libnx/source/MemoryMappingHandler.cpp +++ b/lib/libnx/source/MemoryMappingHandler.cpp @@ -24,7 +24,7 @@ bool nx::MemoryMappingHandler::operator!=(const MemoryMappingHandler & other) co return !(*this == other); } -void nx::MemoryMappingHandler::importKernelCapabilityList(const fnd::List& caps) +void nx::MemoryMappingHandler::importKernelCapabilityList(const fnd::List& caps) { if (caps.size() == 0) return; @@ -87,7 +87,7 @@ void nx::MemoryMappingHandler::importKernelCapabilityList(const fnd::List& caps) const +void nx::MemoryMappingHandler::exportKernelCapabilityList(fnd::List& caps) const { if (isSet() == false) return; diff --git a/lib/libnx/source/MemoryPageEntry.cpp b/lib/libnx/source/MemoryPageEntry.cpp index 88bb8d8..3b068e6 100644 --- a/lib/libnx/source/MemoryPageEntry.cpp +++ b/lib/libnx/source/MemoryPageEntry.cpp @@ -1,14 +1,14 @@ #include nx::MemoryPageEntry::MemoryPageEntry() : - mCap(KernelCapability::KC_INVALID), + mCap(kc::KC_INVALID), mPage(0), mFlag(false), mUseFlag(false) {} -nx::MemoryPageEntry::MemoryPageEntry(const KernelCapability & kernel_cap) : - mCap(KernelCapability::KC_INVALID), +nx::MemoryPageEntry::MemoryPageEntry(const KernelCapabilityEntry & kernel_cap) : + mCap(kc::KC_INVALID), mPage(0), mFlag(false), mUseFlag(false) @@ -17,7 +17,7 @@ nx::MemoryPageEntry::MemoryPageEntry(const KernelCapability & kernel_cap) : } nx::MemoryPageEntry::MemoryPageEntry(uint32_t page) : - mCap(KernelCapability::KC_INVALID), + mCap(kc::KC_INVALID), mPage(0), mFlag(false), mUseFlag(false) @@ -26,7 +26,7 @@ nx::MemoryPageEntry::MemoryPageEntry(uint32_t page) : } nx::MemoryPageEntry::MemoryPageEntry(uint32_t page, bool flag) : - mCap(KernelCapability::KC_INVALID), + mCap(kc::KC_INVALID), mPage(0), mFlag(false), mUseFlag(true) @@ -55,16 +55,16 @@ bool nx::MemoryPageEntry::operator!=(const MemoryPageEntry& other) const return !(*this == other); } -const nx::KernelCapability & nx::MemoryPageEntry::getKernelCapability() const +const nx::KernelCapabilityEntry & nx::MemoryPageEntry::getKernelCapability() const { return mCap; } -void nx::MemoryPageEntry::setKernelCapability(const KernelCapability & kernel_cap) +void nx::MemoryPageEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) { - if (kernel_cap.getType() != KernelCapability::KC_MEMORY_MAP && kernel_cap.getType() != KernelCapability::KC_IO_MEMORY_MAP) + if (kernel_cap.getType() != kc::KC_MEMORY_MAP && kernel_cap.getType() != kc::KC_IO_MEMORY_MAP) { - throw fnd::Exception(kModuleName, "KernelCapability is not type 'MemoryMap' or 'IOMemoryMap"); + throw fnd::Exception(kModuleName, "KernelCapabilityEntry is not type 'MemoryMap' or 'IOMemoryMap"); } mCap = kernel_cap; diff --git a/lib/libnx/source/MiscFlagsEntry.cpp b/lib/libnx/source/MiscFlagsEntry.cpp index cb38d79..f0ac787 100644 --- a/lib/libnx/source/MiscFlagsEntry.cpp +++ b/lib/libnx/source/MiscFlagsEntry.cpp @@ -5,7 +5,7 @@ nx::MiscFlagsEntry::MiscFlagsEntry() : mFlags(0) {} -nx::MiscFlagsEntry::MiscFlagsEntry(const KernelCapability & kernel_cap) : +nx::MiscFlagsEntry::MiscFlagsEntry(const KernelCapabilityEntry & kernel_cap) : mCap(kCapId), mFlags(0) { @@ -35,16 +35,16 @@ bool nx::MiscFlagsEntry::operator!=(const MiscFlagsEntry& other) const return !(*this == other); } -const nx::KernelCapability & nx::MiscFlagsEntry::getKernelCapability() const +const nx::KernelCapabilityEntry & nx::MiscFlagsEntry::getKernelCapability() const { return mCap; } -void nx::MiscFlagsEntry::setKernelCapability(const KernelCapability & kernel_cap) +void nx::MiscFlagsEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) { if (kernel_cap.getType() != kCapId) { - throw fnd::Exception(kModuleName, "KernelCapability is not type 'MiscFlags'"); + throw fnd::Exception(kModuleName, "KernelCapabilityEntry is not type 'MiscFlags'"); } mCap = kernel_cap; diff --git a/lib/libnx/source/MiscFlagsHandler.cpp b/lib/libnx/source/MiscFlagsHandler.cpp index 6291950..d608b4b 100644 --- a/lib/libnx/source/MiscFlagsHandler.cpp +++ b/lib/libnx/source/MiscFlagsHandler.cpp @@ -21,7 +21,7 @@ bool nx::MiscFlagsHandler::operator!=(const MiscFlagsHandler & other) const return !(*this == other); } -void nx::MiscFlagsHandler::importKernelCapabilityList(const fnd::List& caps) +void nx::MiscFlagsHandler::importKernelCapabilityList(const fnd::List& caps) { if (caps.size() > kMaxKernelCapNum) { @@ -46,7 +46,7 @@ void nx::MiscFlagsHandler::importKernelCapabilityList(const fnd::List& caps) const +void nx::MiscFlagsHandler::exportKernelCapabilityList(fnd::List& caps) const { if (isSet() == false) return; diff --git a/lib/libnx/source/MiscParamsEntry.cpp b/lib/libnx/source/MiscParamsEntry.cpp index a0bcc6a..28af0df 100644 --- a/lib/libnx/source/MiscParamsEntry.cpp +++ b/lib/libnx/source/MiscParamsEntry.cpp @@ -5,7 +5,7 @@ nx::MiscParamsEntry::MiscParamsEntry() : mProgramType(0) {} -nx::MiscParamsEntry::MiscParamsEntry(const KernelCapability & kernel_cap) : +nx::MiscParamsEntry::MiscParamsEntry(const KernelCapabilityEntry & kernel_cap) : mCap(kCapId), mProgramType(0) { @@ -35,16 +35,16 @@ bool nx::MiscParamsEntry::operator!=(const MiscParamsEntry& other) const return !(*this == other); } -const nx::KernelCapability & nx::MiscParamsEntry::getKernelCapability() const +const nx::KernelCapabilityEntry & nx::MiscParamsEntry::getKernelCapability() const { return mCap; } -void nx::MiscParamsEntry::setKernelCapability(const KernelCapability & kernel_cap) +void nx::MiscParamsEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) { if (kernel_cap.getType() != kCapId) { - throw fnd::Exception(kModuleName, "KernelCapability is not type 'ThreadInfo'"); + throw fnd::Exception(kModuleName, "KernelCapabilityEntry is not type 'ThreadInfo'"); } mCap = kernel_cap; diff --git a/lib/libnx/source/MiscParamsHandler.cpp b/lib/libnx/source/MiscParamsHandler.cpp index 7975448..3d59650 100644 --- a/lib/libnx/source/MiscParamsHandler.cpp +++ b/lib/libnx/source/MiscParamsHandler.cpp @@ -22,7 +22,7 @@ bool nx::MiscParamsHandler::operator!=(const MiscParamsHandler & other) const return !(*this == other); } -void nx::MiscParamsHandler::importKernelCapabilityList(const fnd::List& caps) +void nx::MiscParamsHandler::importKernelCapabilityList(const fnd::List& caps) { if (caps.size() > kMaxKernelCapNum) { @@ -37,7 +37,7 @@ void nx::MiscParamsHandler::importKernelCapabilityList(const fnd::List& caps) const +void nx::MiscParamsHandler::exportKernelCapabilityList(fnd::List& caps) const { if (isSet() == false) return; diff --git a/lib/libnx/source/SystemCallEntry.cpp b/lib/libnx/source/SystemCallEntry.cpp index 683bc31..bf4a764 100644 --- a/lib/libnx/source/SystemCallEntry.cpp +++ b/lib/libnx/source/SystemCallEntry.cpp @@ -8,7 +8,7 @@ nx::SystemCallEntry::SystemCallEntry() : } -nx::SystemCallEntry::SystemCallEntry(const KernelCapability & kernel_cap) : +nx::SystemCallEntry::SystemCallEntry(const KernelCapabilityEntry & kernel_cap) : mCap(kCapId), mSystemCallUpper(0), mSystemCallLower(0) @@ -43,16 +43,16 @@ bool nx::SystemCallEntry::operator!=(const SystemCallEntry& other) const return !(*this == other); } -const nx::KernelCapability & nx::SystemCallEntry::getKernelCapability() const +const nx::KernelCapabilityEntry & nx::SystemCallEntry::getKernelCapability() const { return mCap; } -void nx::SystemCallEntry::setKernelCapability(const KernelCapability & kernel_cap) +void nx::SystemCallEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) { if (kernel_cap.getType() != kCapId) { - throw fnd::Exception(kModuleName, "KernelCapability is not type 'EnableSystemCalls'"); + throw fnd::Exception(kModuleName, "KernelCapabilityEntry is not type 'EnableSystemCalls'"); } mCap = kernel_cap; diff --git a/lib/libnx/source/SystemCallHandler.cpp b/lib/libnx/source/SystemCallHandler.cpp index c0a7237..da6d677 100644 --- a/lib/libnx/source/SystemCallHandler.cpp +++ b/lib/libnx/source/SystemCallHandler.cpp @@ -23,7 +23,7 @@ bool nx::SystemCallHandler::operator!=(const SystemCallHandler & other) const return !(*this == other); } -void nx::SystemCallHandler::importKernelCapabilityList(const fnd::List& caps) +void nx::SystemCallHandler::importKernelCapabilityList(const fnd::List& caps) { if (caps.size() == 0) return; @@ -49,7 +49,7 @@ void nx::SystemCallHandler::importKernelCapabilityList(const fnd::List& caps) const +void nx::SystemCallHandler::exportKernelCapabilityList(fnd::List& caps) const { if (isSet() == false) return; diff --git a/lib/libnx/source/ThreadInfoEntry.cpp b/lib/libnx/source/ThreadInfoEntry.cpp index 146611a..00cd7c8 100644 --- a/lib/libnx/source/ThreadInfoEntry.cpp +++ b/lib/libnx/source/ThreadInfoEntry.cpp @@ -8,7 +8,7 @@ nx::ThreadInfoEntry::ThreadInfoEntry() : mMaxCpuId(kDefaultCpuId) {} -nx::ThreadInfoEntry::ThreadInfoEntry(const KernelCapability & kernel_cap) : +nx::ThreadInfoEntry::ThreadInfoEntry(const KernelCapabilityEntry & kernel_cap) : mCap(kCapId), mMinPriority(kDefaultPriority), mMaxPriority(kDefaultPriority), @@ -53,16 +53,16 @@ bool nx::ThreadInfoEntry::operator!=(const ThreadInfoEntry& other) const return !(*this == other); } -const nx::KernelCapability & nx::ThreadInfoEntry::getKernelCapability() const +const nx::KernelCapabilityEntry & nx::ThreadInfoEntry::getKernelCapability() const { return mCap; } -void nx::ThreadInfoEntry::setKernelCapability(const KernelCapability & kernel_cap) +void nx::ThreadInfoEntry::setKernelCapability(const KernelCapabilityEntry & kernel_cap) { if (kernel_cap.getType() != kCapId) { - throw fnd::Exception(kModuleName, "KernelCapability is not type 'ThreadInfo'"); + throw fnd::Exception(kModuleName, "KernelCapabilityEntry is not type 'ThreadInfo'"); } mCap = kernel_cap; diff --git a/lib/libnx/source/ThreadInfoHandler.cpp b/lib/libnx/source/ThreadInfoHandler.cpp index d4926dc..da906db 100644 --- a/lib/libnx/source/ThreadInfoHandler.cpp +++ b/lib/libnx/source/ThreadInfoHandler.cpp @@ -22,7 +22,7 @@ bool nx::ThreadInfoHandler::operator!=(const ThreadInfoHandler & other) const return !(*this == other); } -void nx::ThreadInfoHandler::importKernelCapabilityList(const fnd::List& caps) +void nx::ThreadInfoHandler::importKernelCapabilityList(const fnd::List& caps) { if (caps.size() > kMaxKernelCapNum) { @@ -36,7 +36,7 @@ void nx::ThreadInfoHandler::importKernelCapabilityList(const fnd::List& caps) const +void nx::ThreadInfoHandler::exportKernelCapabilityList(fnd::List& caps) const { if (isSet() == false) return; diff --git a/programs/nstool/source/NpdmProcess.cpp b/programs/nstool/source/NpdmProcess.cpp index 5e26b77..3d26e17 100644 --- a/programs/nstool/source/NpdmProcess.cpp +++ b/programs/nstool/source/NpdmProcess.cpp @@ -628,7 +628,7 @@ void NpdmProcess::displaySac(const nx::ServiceAccessControlBinary& sac) } } -void NpdmProcess::displayKernelCap(const nx::KcBinary& kern) +void NpdmProcess::displayKernelCap(const nx::KernelCapabilityBinary& kern) { printf("[Kernel Capabilities]\n"); if (kern.getThreadInfo().isSet()) diff --git a/programs/nstool/source/NpdmProcess.h b/programs/nstool/source/NpdmProcess.h index d0ab52a..8c24d01 100644 --- a/programs/nstool/source/NpdmProcess.h +++ b/programs/nstool/source/NpdmProcess.h @@ -40,5 +40,5 @@ private: void displayAciDescHdr(const nx::AccessControlInfoDescBinary& aci); void displayFac(const nx::FileSystemAccessControlBinary& fac); void displaySac(const nx::ServiceAccessControlBinary& sac); - void displayKernelCap(const nx::KcBinary& kern); + void displayKernelCap(const nx::KernelCapabilityBinary& kern); }; \ No newline at end of file