diff --git a/libraries/libvapours/include/vapours/reg.hpp b/libraries/libvapours/include/vapours/reg.hpp index c112908e1..cfb4eefab 100644 --- a/libraries/libvapours/include/vapours/reg.hpp +++ b/libraries/libvapours/include/vapours/reg.hpp @@ -18,6 +18,9 @@ namespace ams::reg { + template + concept UnsignedNonConstIntegral = std::unsigned_integral && !std::is_const::value; + using BitsValue = std::tuple; using BitsMask = std::tuple; @@ -48,128 +51,128 @@ namespace ams::reg { return (EncodeValue(values) | ...); } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE void Write(volatile IntType *reg, std::type_identity_t val) { *reg = val; } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE void Write(volatile IntType ®, std::type_identity_t val) { reg = val; } ALWAYS_INLINE void Write(uintptr_t reg, u32 val) { Write(reinterpret_cast(reg), val); } - template requires std::unsigned_integral && ((sizeof...(Values) > 0) && (std::is_same::value && ...)) + template requires UnsignedNonConstIntegral && ((sizeof...(Values) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE void Write(volatile IntType *reg, const Values... values) { return Write(reg, static_cast((EncodeValue(values) | ...))); } - template requires std::unsigned_integral && ((sizeof...(Values) > 0) && (std::is_same::value && ...)) + template requires UnsignedNonConstIntegral && ((sizeof...(Values) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE void Write(volatile IntType ®, const Values... values) { return Write(reg, static_cast((EncodeValue(values) | ...))); } template requires ((sizeof...(Values) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE void Write(uintptr_t reg, const Values... values) { return Write(reg, (EncodeValue(values) | ...)); } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE IntType Read(volatile IntType *reg) { return *reg; } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE IntType Read(volatile IntType ®) { return reg; } ALWAYS_INLINE u32 Read(uintptr_t reg) { return Read(reinterpret_cast(reg)); } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE IntType Read(volatile IntType *reg, std::type_identity_t mask) { return *reg & mask; } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE IntType Read(volatile IntType ®, std::type_identity_t mask) { return reg & mask; } ALWAYS_INLINE u32 Read(uintptr_t reg, u32 mask) { return Read(reinterpret_cast(reg), mask); } - template requires std::unsigned_integral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) + template requires UnsignedNonConstIntegral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE IntType Read(volatile IntType *reg, const Masks... masks) { return Read(reg, static_cast((EncodeMask(masks) | ...))); } - template requires std::unsigned_integral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) + template requires UnsignedNonConstIntegral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE IntType Read(volatile IntType ®, const Masks... masks) { return Read(reg, static_cast((EncodeMask(masks) | ...))); } template requires ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE u32 Read(uintptr_t reg, const Masks... masks) { return Read(reg, (EncodeMask(masks) | ...)); } - template requires std::unsigned_integral && ((sizeof...(Values) > 0) && (std::is_same::value && ...)) + template requires UnsignedNonConstIntegral && ((sizeof...(Values) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE bool HasValue(volatile IntType *reg, const Values... values) { return Read(reg, static_cast((EncodeMask(values) | ...))) == static_cast(Encode(values...)); } - template requires std::unsigned_integral && ((sizeof...(Values) > 0) && (std::is_same::value && ...)) + template requires UnsignedNonConstIntegral && ((sizeof...(Values) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE bool HasValue(volatile IntType ®, const Values... values) { return Read(reg, static_cast((EncodeMask(values) | ...))) == static_cast(Encode(values...)); } template requires ((sizeof...(Values) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE bool HasValue(uintptr_t reg, const Values... values) { return Read(reg, (EncodeMask(values) | ...)) == Encode(values...); } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE IntType GetValue(volatile IntType *reg, const BitsMask mask) { return Read(reg, mask) >> GetOffset(mask); } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE IntType GetValue(volatile IntType ®, const BitsMask mask) { return Read(reg, mask) >> GetOffset(mask); } ALWAYS_INLINE u32 GetValue(uintptr_t reg, const BitsMask mask) { return Read(reg, mask) >> GetOffset(mask); } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE void ReadWrite(volatile IntType *reg, std::type_identity_t val, std::type_identity_t mask) { *reg = (*reg & (~mask)) | (val & mask); } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE void ReadWrite(volatile IntType ®, std::type_identity_t val, std::type_identity_t mask) { reg = ( reg & (~mask)) | (val & mask); } ALWAYS_INLINE void ReadWrite(uintptr_t reg, u32 val, u32 mask) { ReadWrite(reinterpret_cast(reg), val, mask); } - template requires std::unsigned_integral && ((sizeof...(Values) > 0) && (std::is_same::value && ...)) + template requires UnsignedNonConstIntegral && ((sizeof...(Values) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE void ReadWrite(volatile IntType *reg, const Values... values) { return ReadWrite(reg, static_cast((EncodeValue(values) | ...)), static_cast((EncodeMask(values) | ...))); } - template requires std::unsigned_integral && ((sizeof...(Values) > 0) && (std::is_same::value && ...)) + template requires UnsignedNonConstIntegral && ((sizeof...(Values) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE void ReadWrite(volatile IntType ®, const Values... values) { return ReadWrite(reg, static_cast((EncodeValue(values) | ...)), static_cast((EncodeMask(values) | ...))); } template requires ((sizeof...(Values) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE void ReadWrite(uintptr_t reg, const Values... values) { return ReadWrite(reg, (EncodeValue(values) | ...), (EncodeMask(values) | ...)); } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE void SetBits(volatile IntType *reg, std::type_identity_t mask) { *reg = *reg | mask; } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE void SetBits(volatile IntType ®, std::type_identity_t mask) { reg = reg | mask; } ALWAYS_INLINE void SetBits(uintptr_t reg, u32 mask) { SetBits(reinterpret_cast(reg), mask); } - template requires std::unsigned_integral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) + template requires UnsignedNonConstIntegral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE void SetBits(volatile IntType *reg, const Masks... masks) { return SetBits(reg, static_cast((EncodeMask(masks) | ...))); } - template requires std::unsigned_integral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) + template requires UnsignedNonConstIntegral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE void SetBits(volatile IntType ®, const Masks... masks) { return SetBits(reg, static_cast((EncodeMask(masks) | ...))); } template requires ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE void SetBits(uintptr_t reg, const Masks... masks) { return SetBits(reg, (EncodeMask(masks) | ...)); } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE void ClearBits(volatile IntType *reg, std::type_identity_t mask) { *reg = *reg & ~mask; } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE void ClearBits(volatile IntType ®, std::type_identity_t mask) { reg = reg & ~mask; } ALWAYS_INLINE void ClearBits(uintptr_t reg, u32 mask) { ClearBits(reinterpret_cast(reg), mask); } - template requires std::unsigned_integral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) + template requires UnsignedNonConstIntegral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE void ClearBits(volatile IntType *reg, const Masks... masks) { return ClearBits(reg, static_cast((EncodeMask(masks) | ...))); } - template requires std::unsigned_integral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) + template requires UnsignedNonConstIntegral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE void ClearBits(volatile IntType ®, const Masks... masks) { return ClearBits(reg, static_cast((EncodeMask(masks) | ...))); } template requires ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE void ClearBits(uintptr_t reg, const Masks... masks) { return ClearBits(reg, (EncodeMask(masks) | ...)); } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE void MaskBits(volatile IntType *reg, std::type_identity_t mask) { *reg = *reg & mask; } - template requires std::unsigned_integral + template requires UnsignedNonConstIntegral ALWAYS_INLINE void MaskBits(volatile IntType ®, std::type_identity_t mask) { reg = reg & mask; } ALWAYS_INLINE void MaskBits(uintptr_t reg, u32 mask) { MaskBits(reinterpret_cast(reg), mask); } - template requires std::unsigned_integral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) + template requires UnsignedNonConstIntegral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE void MaskBits(volatile IntType *reg, const Masks... masks) { return MaskBits(reg, static_cast((EncodeMask(masks) | ...))); } - template requires std::unsigned_integral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) + template requires UnsignedNonConstIntegral && ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) ALWAYS_INLINE void MaskBits(volatile IntType ®, const Masks... masks) { return MaskBits(reg, static_cast((EncodeMask(masks) | ...))); } template requires ((sizeof...(Masks) > 0) && (std::is_same::value && ...)) diff --git a/libraries/libvapours/source/dd/dd_io_mapping.cpp b/libraries/libvapours/source/dd/dd_io_mapping.cpp index 3ece3e2c4..e0ab35799 100644 --- a/libraries/libvapours/source/dd/dd_io_mapping.cpp +++ b/libraries/libvapours/source/dd/dd_io_mapping.cpp @@ -86,7 +86,7 @@ namespace ams::dd { #elif defined(ATMOSPHERE_IS_STRATOSPHERE) u32 out_val; - R_ABORT_UNLESS(svc::ReadWriteRegister(std::addressof(val), phys_addr, 0xFFFFFFFF, value)); + R_ABORT_UNLESS(svc::ReadWriteRegister(std::addressof(out_val), phys_addr, 0xFFFFFFFF, value)); AMS_UNUSED(out_val); #else