diff options
| author | 2021-03-20 00:36:19 -0700 | |
|---|---|---|
| committer | 2021-03-21 14:45:03 -0700 | |
| commit | 80688362cf90055cfdee8bcd5a5c0cfd2c57b67f (patch) | |
| tree | 756d5936fd7d01b6a183e78aed6b295f7c8ec167 /src | |
| parent | hle: kernel: board: k_system_control: Extend to include memory region sizes. (diff) | |
| download | yuzu-80688362cf90055cfdee8bcd5a5c0cfd2c57b67f.tar.gz yuzu-80688362cf90055cfdee8bcd5a5c0cfd2c57b67f.tar.xz yuzu-80688362cf90055cfdee8bcd5a5c0cfd2c57b67f.zip | |
hle: kernel: k_memory_region: Refactor to simplify code.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/k_memory_region.h | 42 | ||||
| -rw-r--r-- | src/core/hle/kernel/k_memory_region_type.h | 130 |
2 files changed, 89 insertions, 83 deletions
diff --git a/src/core/hle/kernel/k_memory_region.h b/src/core/hle/kernel/k_memory_region.h index afa89011c..1d4fcde6f 100644 --- a/src/core/hle/kernel/k_memory_region.h +++ b/src/core/hle/kernel/k_memory_region.h | |||
| @@ -24,7 +24,7 @@ public: | |||
| 24 | : address(address_), last_address(last_address_), pair_address(pair_address_), | 24 | : address(address_), last_address(last_address_), pair_address(pair_address_), |
| 25 | attributes(attributes_), type_id(type_id_) {} | 25 | attributes(attributes_), type_id(type_id_) {} |
| 26 | constexpr KMemoryRegion(u64 address_, u64 last_address_, u32 attributes_, u32 type_id_) | 26 | constexpr KMemoryRegion(u64 address_, u64 last_address_, u32 attributes_, u32 type_id_) |
| 27 | : KMemoryRegion(address_, last_address_, std::numeric_limits<uintptr_t>::max(), attributes_, | 27 | : KMemoryRegion(address_, last_address_, std::numeric_limits<u64>::max(), attributes_, |
| 28 | type_id_) {} | 28 | type_id_) {} |
| 29 | 29 | ||
| 30 | static constexpr int Compare(const KMemoryRegion& lhs, const KMemoryRegion& rhs) { | 30 | static constexpr int Compare(const KMemoryRegion& lhs, const KMemoryRegion& rhs) { |
| @@ -37,6 +37,16 @@ public: | |||
| 37 | } | 37 | } |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | private: | ||
| 41 | constexpr void Reset(u64 a, u64 la, u64 p, u32 r, u32 t) { | ||
| 42 | address = a; | ||
| 43 | pair_address = p; | ||
| 44 | last_address = la; | ||
| 45 | attributes = r; | ||
| 46 | type_id = t; | ||
| 47 | } | ||
| 48 | |||
| 49 | public: | ||
| 40 | constexpr u64 GetAddress() const { | 50 | constexpr u64 GetAddress() const { |
| 41 | return address; | 51 | return address; |
| 42 | } | 52 | } |
| @@ -50,11 +60,11 @@ public: | |||
| 50 | } | 60 | } |
| 51 | 61 | ||
| 52 | constexpr u64 GetEndAddress() const { | 62 | constexpr u64 GetEndAddress() const { |
| 53 | return GetLastAddress() + 1; | 63 | return this->GetLastAddress() + 1; |
| 54 | } | 64 | } |
| 55 | 65 | ||
| 56 | constexpr std::size_t GetSize() const { | 66 | constexpr size_t GetSize() const { |
| 57 | return GetEndAddress() - GetAddress(); | 67 | return this->GetEndAddress() - this->GetAddress(); |
| 58 | } | 68 | } |
| 59 | 69 | ||
| 60 | constexpr u32 GetAttributes() const { | 70 | constexpr u32 GetAttributes() const { |
| @@ -70,7 +80,7 @@ public: | |||
| 70 | type_id = type; | 80 | type_id = type; |
| 71 | } | 81 | } |
| 72 | 82 | ||
| 73 | constexpr bool Contains(uintptr_t address) const { | 83 | constexpr bool Contains(u64 address) const { |
| 74 | ASSERT(this->GetEndAddress() != 0); | 84 | ASSERT(this->GetEndAddress() != 0); |
| 75 | return this->GetAddress() <= address && address <= this->GetLastAddress(); | 85 | return this->GetAddress() <= address && address <= this->GetLastAddress(); |
| 76 | } | 86 | } |
| @@ -80,7 +90,7 @@ public: | |||
| 80 | } | 90 | } |
| 81 | 91 | ||
| 82 | constexpr bool HasTypeAttribute(KMemoryRegionAttr attr) const { | 92 | constexpr bool HasTypeAttribute(KMemoryRegionAttr attr) const { |
| 83 | return (this->GetType() | static_cast<u32>(attr)) == this->GetType(); | 93 | return (this->GetType() | attr) == this->GetType(); |
| 84 | } | 94 | } |
| 85 | 95 | ||
| 86 | constexpr bool CanDerive(u32 type) const { | 96 | constexpr bool CanDerive(u32 type) const { |
| @@ -92,12 +102,12 @@ public: | |||
| 92 | } | 102 | } |
| 93 | 103 | ||
| 94 | constexpr void SetTypeAttribute(KMemoryRegionAttr attr) { | 104 | constexpr void SetTypeAttribute(KMemoryRegionAttr attr) { |
| 95 | type_id |= static_cast<u32>(attr); | 105 | type_id |= attr; |
| 96 | } | 106 | } |
| 97 | 107 | ||
| 98 | private: | 108 | private: |
| 99 | const u64 address{}; | 109 | u64 address{}; |
| 100 | const u64 last_address{}; | 110 | u64 last_address{}; |
| 101 | u64 pair_address{}; | 111 | u64 pair_address{}; |
| 102 | u32 attributes{}; | 112 | u32 attributes{}; |
| 103 | u32 type_id{}; | 113 | u32 type_id{}; |
| @@ -166,9 +176,9 @@ public: | |||
| 166 | } | 176 | } |
| 167 | } | 177 | } |
| 168 | 178 | ||
| 169 | const KMemoryRegion* FindByType(u32 type_id) const { | 179 | const KMemoryRegion* FindByType(KMemoryRegionType type_id) const { |
| 170 | for (auto it = this->cbegin(); it != this->cend(); ++it) { | 180 | for (auto it = this->cbegin(); it != this->cend(); ++it) { |
| 171 | if (it->GetType() == type_id) { | 181 | if (it->GetType() == static_cast<u32>(type_id)) { |
| 172 | return std::addressof(*it); | 182 | return std::addressof(*it); |
| 173 | } | 183 | } |
| 174 | } | 184 | } |
| @@ -184,7 +194,7 @@ public: | |||
| 184 | return nullptr; | 194 | return nullptr; |
| 185 | } | 195 | } |
| 186 | 196 | ||
| 187 | const KMemoryRegion* FindFirstDerived(u32 type_id) const { | 197 | const KMemoryRegion* FindFirstDerived(KMemoryRegionType type_id) const { |
| 188 | for (auto it = this->cbegin(); it != this->cend(); it++) { | 198 | for (auto it = this->cbegin(); it != this->cend(); it++) { |
| 189 | if (it->IsDerivedFrom(type_id)) { | 199 | if (it->IsDerivedFrom(type_id)) { |
| 190 | return std::addressof(*it); | 200 | return std::addressof(*it); |
| @@ -193,7 +203,7 @@ public: | |||
| 193 | return nullptr; | 203 | return nullptr; |
| 194 | } | 204 | } |
| 195 | 205 | ||
| 196 | const KMemoryRegion* FindLastDerived(u32 type_id) const { | 206 | const KMemoryRegion* FindLastDerived(KMemoryRegionType type_id) const { |
| 197 | const KMemoryRegion* region = nullptr; | 207 | const KMemoryRegion* region = nullptr; |
| 198 | for (auto it = this->begin(); it != this->end(); it++) { | 208 | for (auto it = this->begin(); it != this->end(); it++) { |
| 199 | if (it->IsDerivedFrom(type_id)) { | 209 | if (it->IsDerivedFrom(type_id)) { |
| @@ -203,7 +213,7 @@ public: | |||
| 203 | return region; | 213 | return region; |
| 204 | } | 214 | } |
| 205 | 215 | ||
| 206 | DerivedRegionExtents GetDerivedRegionExtents(u32 type_id) const { | 216 | DerivedRegionExtents GetDerivedRegionExtents(KMemoryRegionType type_id) const { |
| 207 | DerivedRegionExtents extents; | 217 | DerivedRegionExtents extents; |
| 208 | 218 | ||
| 209 | ASSERT(extents.first_region == nullptr); | 219 | ASSERT(extents.first_region == nullptr); |
| @@ -224,6 +234,10 @@ public: | |||
| 224 | return extents; | 234 | return extents; |
| 225 | } | 235 | } |
| 226 | 236 | ||
| 237 | DerivedRegionExtents GetDerivedRegionExtents(KMemoryRegionAttr type_id) const { | ||
| 238 | return GetDerivedRegionExtents(static_cast<KMemoryRegionType>(type_id)); | ||
| 239 | } | ||
| 240 | |||
| 227 | public: | 241 | public: |
| 228 | void InsertDirectly(u64 address, u64 last_address, u32 attr = 0, u32 type_id = 0); | 242 | void InsertDirectly(u64 address, u64 last_address, u32 attr = 0, u32 type_id = 0); |
| 229 | bool Insert(u64 address, size_t size, u32 type_id, u32 new_attr = 0, u32 old_attr = 0); | 243 | bool Insert(u64 address, size_t size, u32 type_id, u32 new_attr = 0, u32 old_attr = 0); |
diff --git a/src/core/hle/kernel/k_memory_region_type.h b/src/core/hle/kernel/k_memory_region_type.h index 243e2fd3d..d83e80793 100644 --- a/src/core/hle/kernel/k_memory_region_type.h +++ b/src/core/hle/kernel/k_memory_region_type.h | |||
| @@ -8,17 +8,20 @@ | |||
| 8 | #include "common/common_funcs.h" | 8 | #include "common/common_funcs.h" |
| 9 | #include "common/common_types.h" | 9 | #include "common/common_types.h" |
| 10 | 10 | ||
| 11 | #define ARCH_ARM64 | ||
| 12 | #define BOARD_NINTENDO_NX | ||
| 13 | |||
| 11 | namespace Kernel { | 14 | namespace Kernel { |
| 12 | 15 | ||
| 13 | enum class KMemoryRegionType : u32 {}; | 16 | enum KMemoryRegionType : u32 {}; |
| 14 | 17 | ||
| 15 | enum class KMemoryRegionAttr : typename std::underlying_type<KMemoryRegionType>::type { | 18 | enum KMemoryRegionAttr : typename std::underlying_type<KMemoryRegionType>::type { |
| 16 | CarveoutProtected = 0x04000000, | 19 | KMemoryRegionAttr_CarveoutProtected = 0x04000000, |
| 17 | DidKernelMap = 0x08000000, | 20 | KMemoryRegionAttr_DidKernelMap = 0x08000000, |
| 18 | ShouldKernelMap = 0x10000000, | 21 | KMemoryRegionAttr_ShouldKernelMap = 0x10000000, |
| 19 | UserReadOnly = 0x20000000, | 22 | KMemoryRegionAttr_UserReadOnly = 0x20000000, |
| 20 | NoUserMap = 0x40000000, | 23 | KMemoryRegionAttr_NoUserMap = 0x40000000, |
| 21 | LinearMapped = 0x80000000, | 24 | KMemoryRegionAttr_LinearMapped = 0x80000000, |
| 22 | }; | 25 | }; |
| 23 | DECLARE_ENUM_FLAG_OPERATORS(KMemoryRegionAttr); | 26 | DECLARE_ENUM_FLAG_OPERATORS(KMemoryRegionAttr); |
| 24 | 27 | ||
| @@ -150,17 +153,15 @@ static_assert(KMemoryRegionType_Dram.GetValue() == 0x2); | |||
| 150 | 153 | ||
| 151 | constexpr auto KMemoryRegionType_DramKernelBase = | 154 | constexpr auto KMemoryRegionType_DramKernelBase = |
| 152 | KMemoryRegionType_Dram.DeriveSparse(0, 3, 0) | 155 | KMemoryRegionType_Dram.DeriveSparse(0, 3, 0) |
| 153 | .SetAttribute(KMemoryRegionAttr::NoUserMap) | 156 | .SetAttribute(KMemoryRegionAttr_NoUserMap) |
| 154 | .SetAttribute(KMemoryRegionAttr::CarveoutProtected); | 157 | .SetAttribute(KMemoryRegionAttr_CarveoutProtected); |
| 155 | constexpr auto KMemoryRegionType_DramReservedBase = KMemoryRegionType_Dram.DeriveSparse(0, 3, 1); | 158 | constexpr auto KMemoryRegionType_DramReservedBase = KMemoryRegionType_Dram.DeriveSparse(0, 3, 1); |
| 156 | constexpr auto KMemoryRegionType_DramHeapBase = | 159 | constexpr auto KMemoryRegionType_DramHeapBase = |
| 157 | KMemoryRegionType_Dram.DeriveSparse(0, 3, 2).SetAttribute(KMemoryRegionAttr::LinearMapped); | 160 | KMemoryRegionType_Dram.DeriveSparse(0, 3, 2).SetAttribute(KMemoryRegionAttr_LinearMapped); |
| 158 | static_assert(static_cast<KMemoryRegionAttr>(KMemoryRegionType_DramKernelBase.GetValue()) == | 161 | static_assert(KMemoryRegionType_DramKernelBase.GetValue() == |
| 159 | (static_cast<KMemoryRegionAttr>(0xE) | KMemoryRegionAttr::CarveoutProtected | | 162 | (0xE | KMemoryRegionAttr_CarveoutProtected | KMemoryRegionAttr_NoUserMap)); |
| 160 | KMemoryRegionAttr::NoUserMap)); | ||
| 161 | static_assert(KMemoryRegionType_DramReservedBase.GetValue() == (0x16)); | 163 | static_assert(KMemoryRegionType_DramReservedBase.GetValue() == (0x16)); |
| 162 | static_assert(static_cast<KMemoryRegionAttr>(KMemoryRegionType_DramHeapBase.GetValue()) == | 164 | static_assert(KMemoryRegionType_DramHeapBase.GetValue() == (0x26 | KMemoryRegionAttr_LinearMapped)); |
| 163 | (static_cast<KMemoryRegionAttr>(0x26) | KMemoryRegionAttr::LinearMapped)); | ||
| 164 | 165 | ||
| 165 | constexpr auto KMemoryRegionType_DramKernelCode = | 166 | constexpr auto KMemoryRegionType_DramKernelCode = |
| 166 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 0); | 167 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 0); |
| @@ -168,78 +169,69 @@ constexpr auto KMemoryRegionType_DramKernelSlab = | |||
| 168 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 1); | 169 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 1); |
| 169 | constexpr auto KMemoryRegionType_DramKernelPtHeap = | 170 | constexpr auto KMemoryRegionType_DramKernelPtHeap = |
| 170 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 2).SetAttribute( | 171 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 2).SetAttribute( |
| 171 | KMemoryRegionAttr::LinearMapped); | 172 | KMemoryRegionAttr_LinearMapped); |
| 172 | constexpr auto KMemoryRegionType_DramKernelInitPt = | 173 | constexpr auto KMemoryRegionType_DramKernelInitPt = |
| 173 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 3).SetAttribute( | 174 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 3).SetAttribute( |
| 174 | KMemoryRegionAttr::LinearMapped); | 175 | KMemoryRegionAttr_LinearMapped); |
| 175 | static_assert(static_cast<KMemoryRegionAttr>(KMemoryRegionType_DramKernelCode.GetValue()) == | 176 | static_assert(KMemoryRegionType_DramKernelCode.GetValue() == |
| 176 | (static_cast<KMemoryRegionAttr>(0xCE) | KMemoryRegionAttr::CarveoutProtected | | 177 | (0xCE | KMemoryRegionAttr_CarveoutProtected | KMemoryRegionAttr_NoUserMap)); |
| 177 | KMemoryRegionAttr::NoUserMap)); | 178 | static_assert(KMemoryRegionType_DramKernelSlab.GetValue() == |
| 178 | static_assert(static_cast<KMemoryRegionAttr>(KMemoryRegionType_DramKernelSlab.GetValue()) == | 179 | (0x14E | KMemoryRegionAttr_CarveoutProtected | KMemoryRegionAttr_NoUserMap)); |
| 179 | (static_cast<KMemoryRegionAttr>(0x14E) | KMemoryRegionAttr::CarveoutProtected | | 180 | static_assert(KMemoryRegionType_DramKernelPtHeap.GetValue() == |
| 180 | KMemoryRegionAttr::NoUserMap)); | 181 | (0x24E | KMemoryRegionAttr_CarveoutProtected | KMemoryRegionAttr_NoUserMap | |
| 181 | static_assert(static_cast<KMemoryRegionAttr>(KMemoryRegionType_DramKernelPtHeap.GetValue()) == | 182 | KMemoryRegionAttr_LinearMapped)); |
| 182 | (static_cast<KMemoryRegionAttr>(0x24E) | KMemoryRegionAttr::CarveoutProtected | | 183 | static_assert(KMemoryRegionType_DramKernelInitPt.GetValue() == |
| 183 | KMemoryRegionAttr::NoUserMap | KMemoryRegionAttr::LinearMapped)); | 184 | (0x44E | KMemoryRegionAttr_CarveoutProtected | KMemoryRegionAttr_NoUserMap | |
| 184 | static_assert(static_cast<KMemoryRegionAttr>(KMemoryRegionType_DramKernelInitPt.GetValue()) == | 185 | KMemoryRegionAttr_LinearMapped)); |
| 185 | (static_cast<KMemoryRegionAttr>(0x44E) | KMemoryRegionAttr::CarveoutProtected | | ||
| 186 | KMemoryRegionAttr::NoUserMap | KMemoryRegionAttr::LinearMapped)); | ||
| 187 | 186 | ||
| 188 | constexpr auto KMemoryRegionType_DramReservedEarly = | 187 | constexpr auto KMemoryRegionType_DramReservedEarly = |
| 189 | KMemoryRegionType_DramReservedBase.DeriveAttribute(KMemoryRegionAttr::NoUserMap); | 188 | KMemoryRegionType_DramReservedBase.DeriveAttribute(KMemoryRegionAttr_NoUserMap); |
| 190 | static_assert(static_cast<KMemoryRegionAttr>(KMemoryRegionType_DramReservedEarly.GetValue()) == | 189 | static_assert(KMemoryRegionType_DramReservedEarly.GetValue() == |
| 191 | (static_cast<KMemoryRegionAttr>(0x16) | KMemoryRegionAttr::NoUserMap)); | 190 | (0x16 | KMemoryRegionAttr_NoUserMap)); |
| 192 | 191 | ||
| 193 | constexpr auto KMemoryRegionType_KernelTraceBuffer = | 192 | constexpr auto KMemoryRegionType_KernelTraceBuffer = |
| 194 | KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 0) | 193 | KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 0) |
| 195 | .SetAttribute(KMemoryRegionAttr::LinearMapped) | 194 | .SetAttribute(KMemoryRegionAttr_LinearMapped) |
| 196 | .SetAttribute(KMemoryRegionAttr::UserReadOnly); | 195 | .SetAttribute(KMemoryRegionAttr_UserReadOnly); |
| 197 | constexpr auto KMemoryRegionType_OnMemoryBootImage = | 196 | constexpr auto KMemoryRegionType_OnMemoryBootImage = |
| 198 | KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 1); | 197 | KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 1); |
| 199 | constexpr auto KMemoryRegionType_DTB = KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 2); | 198 | constexpr auto KMemoryRegionType_DTB = KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 2); |
| 200 | static_assert(static_cast<KMemoryRegionAttr>(KMemoryRegionType_KernelTraceBuffer.GetValue()) == | 199 | static_assert(KMemoryRegionType_KernelTraceBuffer.GetValue() == |
| 201 | (static_cast<KMemoryRegionAttr>(0xD6) | KMemoryRegionAttr::LinearMapped | | 200 | (0xD6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_UserReadOnly)); |
| 202 | KMemoryRegionAttr::UserReadOnly)); | ||
| 203 | static_assert(KMemoryRegionType_OnMemoryBootImage.GetValue() == 0x156); | 201 | static_assert(KMemoryRegionType_OnMemoryBootImage.GetValue() == 0x156); |
| 204 | static_assert(KMemoryRegionType_DTB.GetValue() == 0x256); | 202 | static_assert(KMemoryRegionType_DTB.GetValue() == 0x256); |
| 205 | 203 | ||
| 206 | constexpr auto KMemoryRegionType_DramPoolPartition = | 204 | constexpr auto KMemoryRegionType_DramPoolPartition = |
| 207 | KMemoryRegionType_DramHeapBase.DeriveAttribute(KMemoryRegionAttr::NoUserMap); | 205 | KMemoryRegionType_DramHeapBase.DeriveAttribute(KMemoryRegionAttr_NoUserMap); |
| 208 | static_assert(static_cast<KMemoryRegionAttr>(KMemoryRegionType_DramPoolPartition.GetValue()) == | 206 | static_assert(KMemoryRegionType_DramPoolPartition.GetValue() == |
| 209 | (static_cast<KMemoryRegionAttr>(0x26) | KMemoryRegionAttr::LinearMapped | | 207 | (0x26 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap)); |
| 210 | KMemoryRegionAttr::NoUserMap)); | ||
| 211 | 208 | ||
| 212 | constexpr auto KMemoryRegionType_DramPoolManagement = | 209 | constexpr auto KMemoryRegionType_DramPoolManagement = |
| 213 | KMemoryRegionType_DramPoolPartition.DeriveTransition(0, 2).DeriveTransition().SetAttribute( | 210 | KMemoryRegionType_DramPoolPartition.DeriveTransition(0, 2).DeriveTransition().SetAttribute( |
| 214 | KMemoryRegionAttr::CarveoutProtected); | 211 | KMemoryRegionAttr_CarveoutProtected); |
| 215 | constexpr auto KMemoryRegionType_DramUserPool = | 212 | constexpr auto KMemoryRegionType_DramUserPool = |
| 216 | KMemoryRegionType_DramPoolPartition.DeriveTransition(1, 2).DeriveTransition(); | 213 | KMemoryRegionType_DramPoolPartition.DeriveTransition(1, 2).DeriveTransition(); |
| 217 | static_assert(static_cast<KMemoryRegionAttr>(KMemoryRegionType_DramPoolManagement.GetValue()) == | 214 | static_assert(KMemoryRegionType_DramPoolManagement.GetValue() == |
| 218 | (static_cast<KMemoryRegionAttr>(0x166) | KMemoryRegionAttr::LinearMapped | | 215 | (0x166 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap | |
| 219 | KMemoryRegionAttr::NoUserMap | KMemoryRegionAttr::CarveoutProtected)); | 216 | KMemoryRegionAttr_CarveoutProtected)); |
| 220 | static_assert(static_cast<KMemoryRegionAttr>(KMemoryRegionType_DramUserPool.GetValue()) == | 217 | static_assert(KMemoryRegionType_DramUserPool.GetValue() == |
| 221 | (static_cast<KMemoryRegionAttr>(0x1A6) | KMemoryRegionAttr::LinearMapped | | 218 | (0x1A6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap)); |
| 222 | KMemoryRegionAttr::NoUserMap)); | ||
| 223 | 219 | ||
| 224 | constexpr auto KMemoryRegionType_DramApplicationPool = KMemoryRegionType_DramUserPool.Derive(4, 0); | 220 | constexpr auto KMemoryRegionType_DramApplicationPool = KMemoryRegionType_DramUserPool.Derive(4, 0); |
| 225 | constexpr auto KMemoryRegionType_DramAppletPool = KMemoryRegionType_DramUserPool.Derive(4, 1); | 221 | constexpr auto KMemoryRegionType_DramAppletPool = KMemoryRegionType_DramUserPool.Derive(4, 1); |
| 226 | constexpr auto KMemoryRegionType_DramSystemNonSecurePool = | 222 | constexpr auto KMemoryRegionType_DramSystemNonSecurePool = |
| 227 | KMemoryRegionType_DramUserPool.Derive(4, 2); | 223 | KMemoryRegionType_DramUserPool.Derive(4, 2); |
| 228 | constexpr auto KMemoryRegionType_DramSystemPool = | 224 | constexpr auto KMemoryRegionType_DramSystemPool = |
| 229 | KMemoryRegionType_DramUserPool.Derive(4, 3).SetAttribute(KMemoryRegionAttr::CarveoutProtected); | 225 | KMemoryRegionType_DramUserPool.Derive(4, 3).SetAttribute(KMemoryRegionAttr_CarveoutProtected); |
| 230 | static_assert(static_cast<KMemoryRegionAttr>(KMemoryRegionType_DramApplicationPool.GetValue()) == | 226 | static_assert(KMemoryRegionType_DramApplicationPool.GetValue() == |
| 231 | (static_cast<KMemoryRegionAttr>(0x7A6) | KMemoryRegionAttr::LinearMapped | | 227 | (0x7A6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap)); |
| 232 | KMemoryRegionAttr::NoUserMap)); | 228 | static_assert(KMemoryRegionType_DramAppletPool.GetValue() == |
| 233 | static_assert(static_cast<KMemoryRegionAttr>(KMemoryRegionType_DramAppletPool.GetValue()) == | 229 | (0xBA6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap)); |
| 234 | (static_cast<KMemoryRegionAttr>(0xBA6) | KMemoryRegionAttr::LinearMapped | | 230 | static_assert(KMemoryRegionType_DramSystemNonSecurePool.GetValue() == |
| 235 | KMemoryRegionAttr::NoUserMap)); | 231 | (0xDA6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap)); |
| 236 | static_assert( | 232 | static_assert(KMemoryRegionType_DramSystemPool.GetValue() == |
| 237 | static_cast<KMemoryRegionAttr>(KMemoryRegionType_DramSystemNonSecurePool.GetValue()) == | 233 | (0x13A6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap | |
| 238 | (static_cast<KMemoryRegionAttr>(0xDA6) | KMemoryRegionAttr::LinearMapped | | 234 | KMemoryRegionAttr_CarveoutProtected)); |
| 239 | KMemoryRegionAttr::NoUserMap)); | ||
| 240 | static_assert(static_cast<KMemoryRegionAttr>(KMemoryRegionType_DramSystemPool.GetValue()) == | ||
| 241 | (static_cast<KMemoryRegionAttr>(0x13A6) | KMemoryRegionAttr::LinearMapped | | ||
| 242 | KMemoryRegionAttr::NoUserMap | KMemoryRegionAttr::CarveoutProtected)); | ||
| 243 | 235 | ||
| 244 | constexpr auto KMemoryRegionType_VirtualDramHeapBase = KMemoryRegionType_Dram.DeriveSparse(1, 3, 0); | 236 | constexpr auto KMemoryRegionType_VirtualDramHeapBase = KMemoryRegionType_Dram.DeriveSparse(1, 3, 0); |
| 245 | constexpr auto KMemoryRegionType_VirtualDramKernelPtHeap = | 237 | constexpr auto KMemoryRegionType_VirtualDramKernelPtHeap = |
| @@ -284,18 +276,18 @@ constexpr auto KMemoryRegionType_BoardDeviceBase = | |||
| 284 | static_assert(KMemoryRegionType_ArchDeviceBase.GetValue() == 0x5); | 276 | static_assert(KMemoryRegionType_ArchDeviceBase.GetValue() == 0x5); |
| 285 | static_assert(KMemoryRegionType_BoardDeviceBase.GetValue() == 0x5); | 277 | static_assert(KMemoryRegionType_BoardDeviceBase.GetValue() == 0x5); |
| 286 | 278 | ||
| 287 | #if defined(ATMOSPHERE_ARCH_ARM64) | 279 | #if defined(ARCH_ARM64) |
| 288 | #include <mesosphere/arch/arm64/kern_k_memory_region_device_types.inc> | 280 | #include "core/hle/kernel/arch/arm64/k_memory_region_device_types.inc" |
| 289 | #elif defined(ATMOSPHERE_ARCH_ARM) | 281 | #elif defined(ARCH_ARM) |
| 290 | #include <mesosphere/arch/arm/kern_k_memory_region_device_types.inc> | 282 | #error "Unimplemented"" |
| 291 | #else | 283 | #else |
| 292 | // Default to no architecture devices. | 284 | // Default to no architecture devices. |
| 293 | constexpr auto NumArchitectureDeviceRegions = 0; | 285 | constexpr auto NumArchitectureDeviceRegions = 0; |
| 294 | #endif | 286 | #endif |
| 295 | static_assert(NumArchitectureDeviceRegions >= 0); | 287 | static_assert(NumArchitectureDeviceRegions >= 0); |
| 296 | 288 | ||
| 297 | #if defined(ATMOSPHERE_BOARD_NINTENDO_NX) | 289 | #if defined(BOARD_NINTENDO_NX) |
| 298 | #include <mesosphere/board/nintendo/nx/kern_k_memory_region_device_types.inc> | 290 | #include "core/hle/kernel/board/nintendo/nx/k_memory_region_device_types.inc" |
| 299 | #else | 291 | #else |
| 300 | // Default to no board devices. | 292 | // Default to no board devices. |
| 301 | constexpr auto NumBoardDeviceRegions = 0; | 293 | constexpr auto NumBoardDeviceRegions = 0; |