diff options
| -rw-r--r-- | src/core/hle/kernel/k_memory_region_type.h | 123 |
1 files changed, 74 insertions, 49 deletions
diff --git a/src/core/hle/kernel/k_memory_region_type.h b/src/core/hle/kernel/k_memory_region_type.h index 7e2fcccdc..e5630c1ac 100644 --- a/src/core/hle/kernel/k_memory_region_type.h +++ b/src/core/hle/kernel/k_memory_region_type.h | |||
| @@ -142,32 +142,38 @@ private: | |||
| 142 | 142 | ||
| 143 | } // namespace impl | 143 | } // namespace impl |
| 144 | 144 | ||
| 145 | constexpr auto KMemoryRegionType_None = impl::KMemoryRegionTypeValue(); | 145 | constexpr inline auto KMemoryRegionType_None = impl::KMemoryRegionTypeValue(); |
| 146 | constexpr auto KMemoryRegionType_Kernel = KMemoryRegionType_None.DeriveInitial(0, 2); | 146 | |
| 147 | constexpr auto KMemoryRegionType_Dram = KMemoryRegionType_None.DeriveInitial(1, 2); | 147 | constexpr inline auto KMemoryRegionType_Kernel = KMemoryRegionType_None.DeriveInitial(0, 2); |
| 148 | constexpr inline auto KMemoryRegionType_Dram = KMemoryRegionType_None.DeriveInitial(1, 2); | ||
| 148 | static_assert(KMemoryRegionType_Kernel.GetValue() == 0x1); | 149 | static_assert(KMemoryRegionType_Kernel.GetValue() == 0x1); |
| 149 | static_assert(KMemoryRegionType_Dram.GetValue() == 0x2); | 150 | static_assert(KMemoryRegionType_Dram.GetValue() == 0x2); |
| 150 | 151 | ||
| 151 | constexpr auto KMemoryRegionType_DramKernelBase = | 152 | // constexpr inline auto KMemoryRegionType_CoreLocalRegion = |
| 153 | // KMemoryRegionType_None.DeriveInitial(2).Finalize(); | ||
| 154 | // static_assert(KMemoryRegionType_CoreLocalRegion.GetValue() == 0x4); | ||
| 155 | |||
| 156 | constexpr inline auto KMemoryRegionType_DramKernelBase = | ||
| 152 | KMemoryRegionType_Dram.DeriveSparse(0, 3, 0) | 157 | KMemoryRegionType_Dram.DeriveSparse(0, 3, 0) |
| 153 | .SetAttribute(KMemoryRegionAttr_NoUserMap) | 158 | .SetAttribute(KMemoryRegionAttr_NoUserMap) |
| 154 | .SetAttribute(KMemoryRegionAttr_CarveoutProtected); | 159 | .SetAttribute(KMemoryRegionAttr_CarveoutProtected); |
| 155 | constexpr auto KMemoryRegionType_DramReservedBase = KMemoryRegionType_Dram.DeriveSparse(0, 3, 1); | 160 | constexpr inline auto KMemoryRegionType_DramReservedBase = |
| 156 | constexpr auto KMemoryRegionType_DramHeapBase = | 161 | KMemoryRegionType_Dram.DeriveSparse(0, 3, 1); |
| 162 | constexpr inline auto KMemoryRegionType_DramHeapBase = | ||
| 157 | KMemoryRegionType_Dram.DeriveSparse(0, 3, 2).SetAttribute(KMemoryRegionAttr_LinearMapped); | 163 | KMemoryRegionType_Dram.DeriveSparse(0, 3, 2).SetAttribute(KMemoryRegionAttr_LinearMapped); |
| 158 | static_assert(KMemoryRegionType_DramKernelBase.GetValue() == | 164 | static_assert(KMemoryRegionType_DramKernelBase.GetValue() == |
| 159 | (0xE | KMemoryRegionAttr_CarveoutProtected | KMemoryRegionAttr_NoUserMap)); | 165 | (0xE | KMemoryRegionAttr_CarveoutProtected | KMemoryRegionAttr_NoUserMap)); |
| 160 | static_assert(KMemoryRegionType_DramReservedBase.GetValue() == (0x16)); | 166 | static_assert(KMemoryRegionType_DramReservedBase.GetValue() == (0x16)); |
| 161 | static_assert(KMemoryRegionType_DramHeapBase.GetValue() == (0x26 | KMemoryRegionAttr_LinearMapped)); | 167 | static_assert(KMemoryRegionType_DramHeapBase.GetValue() == (0x26 | KMemoryRegionAttr_LinearMapped)); |
| 162 | 168 | ||
| 163 | constexpr auto KMemoryRegionType_DramKernelCode = | 169 | constexpr inline auto KMemoryRegionType_DramKernelCode = |
| 164 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 0); | 170 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 0); |
| 165 | constexpr auto KMemoryRegionType_DramKernelSlab = | 171 | constexpr inline auto KMemoryRegionType_DramKernelSlab = |
| 166 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 1); | 172 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 1); |
| 167 | constexpr auto KMemoryRegionType_DramKernelPtHeap = | 173 | constexpr inline auto KMemoryRegionType_DramKernelPtHeap = |
| 168 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 2).SetAttribute( | 174 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 2).SetAttribute( |
| 169 | KMemoryRegionAttr_LinearMapped); | 175 | KMemoryRegionAttr_LinearMapped); |
| 170 | constexpr auto KMemoryRegionType_DramKernelInitPt = | 176 | constexpr inline auto KMemoryRegionType_DramKernelInitPt = |
| 171 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 3).SetAttribute( | 177 | KMemoryRegionType_DramKernelBase.DeriveSparse(0, 4, 3).SetAttribute( |
| 172 | KMemoryRegionAttr_LinearMapped); | 178 | KMemoryRegionAttr_LinearMapped); |
| 173 | static_assert(KMemoryRegionType_DramKernelCode.GetValue() == | 179 | static_assert(KMemoryRegionType_DramKernelCode.GetValue() == |
| @@ -181,32 +187,40 @@ static_assert(KMemoryRegionType_DramKernelInitPt.GetValue() == | |||
| 181 | (0x44E | KMemoryRegionAttr_CarveoutProtected | KMemoryRegionAttr_NoUserMap | | 187 | (0x44E | KMemoryRegionAttr_CarveoutProtected | KMemoryRegionAttr_NoUserMap | |
| 182 | KMemoryRegionAttr_LinearMapped)); | 188 | KMemoryRegionAttr_LinearMapped)); |
| 183 | 189 | ||
| 184 | constexpr auto KMemoryRegionType_DramReservedEarly = | 190 | constexpr inline auto KMemoryRegionType_DramKernelSecureAppletMemory = |
| 191 | KMemoryRegionType_DramKernelBase.DeriveSparse(1, 3, 0).SetAttribute( | ||
| 192 | KMemoryRegionAttr_LinearMapped); | ||
| 193 | static_assert(KMemoryRegionType_DramKernelSecureAppletMemory.GetValue() == | ||
| 194 | (0x18E | KMemoryRegionAttr_CarveoutProtected | KMemoryRegionAttr_NoUserMap | | ||
| 195 | KMemoryRegionAttr_LinearMapped)); | ||
| 196 | |||
| 197 | constexpr inline auto KMemoryRegionType_DramReservedEarly = | ||
| 185 | KMemoryRegionType_DramReservedBase.DeriveAttribute(KMemoryRegionAttr_NoUserMap); | 198 | KMemoryRegionType_DramReservedBase.DeriveAttribute(KMemoryRegionAttr_NoUserMap); |
| 186 | static_assert(KMemoryRegionType_DramReservedEarly.GetValue() == | 199 | static_assert(KMemoryRegionType_DramReservedEarly.GetValue() == |
| 187 | (0x16 | KMemoryRegionAttr_NoUserMap)); | 200 | (0x16 | KMemoryRegionAttr_NoUserMap)); |
| 188 | 201 | ||
| 189 | constexpr auto KMemoryRegionType_KernelTraceBuffer = | 202 | constexpr inline auto KMemoryRegionType_KernelTraceBuffer = |
| 190 | KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 0) | 203 | KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 0) |
| 191 | .SetAttribute(KMemoryRegionAttr_LinearMapped) | 204 | .SetAttribute(KMemoryRegionAttr_LinearMapped) |
| 192 | .SetAttribute(KMemoryRegionAttr_UserReadOnly); | 205 | .SetAttribute(KMemoryRegionAttr_UserReadOnly); |
| 193 | constexpr auto KMemoryRegionType_OnMemoryBootImage = | 206 | constexpr inline auto KMemoryRegionType_OnMemoryBootImage = |
| 194 | KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 1); | 207 | KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 1); |
| 195 | constexpr auto KMemoryRegionType_DTB = KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 2); | 208 | constexpr inline auto KMemoryRegionType_DTB = |
| 209 | KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 2); | ||
| 196 | static_assert(KMemoryRegionType_KernelTraceBuffer.GetValue() == | 210 | static_assert(KMemoryRegionType_KernelTraceBuffer.GetValue() == |
| 197 | (0xD6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_UserReadOnly)); | 211 | (0xD6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_UserReadOnly)); |
| 198 | static_assert(KMemoryRegionType_OnMemoryBootImage.GetValue() == 0x156); | 212 | static_assert(KMemoryRegionType_OnMemoryBootImage.GetValue() == 0x156); |
| 199 | static_assert(KMemoryRegionType_DTB.GetValue() == 0x256); | 213 | static_assert(KMemoryRegionType_DTB.GetValue() == 0x256); |
| 200 | 214 | ||
| 201 | constexpr auto KMemoryRegionType_DramPoolPartition = | 215 | constexpr inline auto KMemoryRegionType_DramPoolPartition = |
| 202 | KMemoryRegionType_DramHeapBase.DeriveAttribute(KMemoryRegionAttr_NoUserMap); | 216 | KMemoryRegionType_DramHeapBase.DeriveAttribute(KMemoryRegionAttr_NoUserMap); |
| 203 | static_assert(KMemoryRegionType_DramPoolPartition.GetValue() == | 217 | static_assert(KMemoryRegionType_DramPoolPartition.GetValue() == |
| 204 | (0x26 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap)); | 218 | (0x26 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap)); |
| 205 | 219 | ||
| 206 | constexpr auto KMemoryRegionType_DramPoolManagement = | 220 | constexpr inline auto KMemoryRegionType_DramPoolManagement = |
| 207 | KMemoryRegionType_DramPoolPartition.DeriveTransition(0, 2).DeriveTransition().SetAttribute( | 221 | KMemoryRegionType_DramPoolPartition.DeriveTransition(0, 2).DeriveTransition().SetAttribute( |
| 208 | KMemoryRegionAttr_CarveoutProtected); | 222 | KMemoryRegionAttr_CarveoutProtected); |
| 209 | constexpr auto KMemoryRegionType_DramUserPool = | 223 | constexpr inline auto KMemoryRegionType_DramUserPool = |
| 210 | KMemoryRegionType_DramPoolPartition.DeriveTransition(1, 2).DeriveTransition(); | 224 | KMemoryRegionType_DramPoolPartition.DeriveTransition(1, 2).DeriveTransition(); |
| 211 | static_assert(KMemoryRegionType_DramPoolManagement.GetValue() == | 225 | static_assert(KMemoryRegionType_DramPoolManagement.GetValue() == |
| 212 | (0x166 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap | | 226 | (0x166 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap | |
| @@ -214,11 +228,13 @@ static_assert(KMemoryRegionType_DramPoolManagement.GetValue() == | |||
| 214 | static_assert(KMemoryRegionType_DramUserPool.GetValue() == | 228 | static_assert(KMemoryRegionType_DramUserPool.GetValue() == |
| 215 | (0x1A6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap)); | 229 | (0x1A6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap)); |
| 216 | 230 | ||
| 217 | constexpr auto KMemoryRegionType_DramApplicationPool = KMemoryRegionType_DramUserPool.Derive(4, 0); | 231 | constexpr inline auto KMemoryRegionType_DramApplicationPool = |
| 218 | constexpr auto KMemoryRegionType_DramAppletPool = KMemoryRegionType_DramUserPool.Derive(4, 1); | 232 | KMemoryRegionType_DramUserPool.Derive(4, 0); |
| 219 | constexpr auto KMemoryRegionType_DramSystemNonSecurePool = | 233 | constexpr inline auto KMemoryRegionType_DramAppletPool = |
| 234 | KMemoryRegionType_DramUserPool.Derive(4, 1); | ||
| 235 | constexpr inline auto KMemoryRegionType_DramSystemNonSecurePool = | ||
| 220 | KMemoryRegionType_DramUserPool.Derive(4, 2); | 236 | KMemoryRegionType_DramUserPool.Derive(4, 2); |
| 221 | constexpr auto KMemoryRegionType_DramSystemPool = | 237 | constexpr inline auto KMemoryRegionType_DramSystemPool = |
| 222 | KMemoryRegionType_DramUserPool.Derive(4, 3).SetAttribute(KMemoryRegionAttr_CarveoutProtected); | 238 | KMemoryRegionType_DramUserPool.Derive(4, 3).SetAttribute(KMemoryRegionAttr_CarveoutProtected); |
| 223 | static_assert(KMemoryRegionType_DramApplicationPool.GetValue() == | 239 | static_assert(KMemoryRegionType_DramApplicationPool.GetValue() == |
| 224 | (0x7A6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap)); | 240 | (0x7A6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap)); |
| @@ -230,50 +246,55 @@ static_assert(KMemoryRegionType_DramSystemPool.GetValue() == | |||
| 230 | (0x13A6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap | | 246 | (0x13A6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap | |
| 231 | KMemoryRegionAttr_CarveoutProtected)); | 247 | KMemoryRegionAttr_CarveoutProtected)); |
| 232 | 248 | ||
| 233 | constexpr auto KMemoryRegionType_VirtualDramHeapBase = KMemoryRegionType_Dram.DeriveSparse(1, 3, 0); | 249 | constexpr inline auto KMemoryRegionType_VirtualDramHeapBase = |
| 234 | constexpr auto KMemoryRegionType_VirtualDramKernelPtHeap = | 250 | KMemoryRegionType_Dram.DeriveSparse(1, 3, 0); |
| 251 | constexpr inline auto KMemoryRegionType_VirtualDramKernelPtHeap = | ||
| 235 | KMemoryRegionType_Dram.DeriveSparse(1, 3, 1); | 252 | KMemoryRegionType_Dram.DeriveSparse(1, 3, 1); |
| 236 | constexpr auto KMemoryRegionType_VirtualDramKernelTraceBuffer = | 253 | constexpr inline auto KMemoryRegionType_VirtualDramKernelTraceBuffer = |
| 237 | KMemoryRegionType_Dram.DeriveSparse(1, 3, 2); | 254 | KMemoryRegionType_Dram.DeriveSparse(1, 3, 2); |
| 238 | static_assert(KMemoryRegionType_VirtualDramHeapBase.GetValue() == 0x1A); | 255 | static_assert(KMemoryRegionType_VirtualDramHeapBase.GetValue() == 0x1A); |
| 239 | static_assert(KMemoryRegionType_VirtualDramKernelPtHeap.GetValue() == 0x2A); | 256 | static_assert(KMemoryRegionType_VirtualDramKernelPtHeap.GetValue() == 0x2A); |
| 240 | static_assert(KMemoryRegionType_VirtualDramKernelTraceBuffer.GetValue() == 0x4A); | 257 | static_assert(KMemoryRegionType_VirtualDramKernelTraceBuffer.GetValue() == 0x4A); |
| 241 | 258 | ||
| 242 | // UNUSED: .DeriveSparse(2, 2, 0); | 259 | // UNUSED: .DeriveSparse(2, 2, 0); |
| 243 | constexpr auto KMemoryRegionType_VirtualDramUnknownDebug = | 260 | constexpr inline auto KMemoryRegionType_VirtualDramUnknownDebug = |
| 244 | KMemoryRegionType_Dram.DeriveSparse(2, 2, 1); | 261 | KMemoryRegionType_Dram.DeriveSparse(2, 2, 1); |
| 245 | static_assert(KMemoryRegionType_VirtualDramUnknownDebug.GetValue() == (0x52)); | 262 | static_assert(KMemoryRegionType_VirtualDramUnknownDebug.GetValue() == (0x52)); |
| 246 | 263 | ||
| 247 | constexpr auto KMemoryRegionType_VirtualDramKernelInitPt = | 264 | constexpr inline auto KMemoryRegionType_VirtualDramKernelSecureAppletMemory = |
| 265 | KMemoryRegionType_Dram.DeriveSparse(3, 1, 0); | ||
| 266 | static_assert(KMemoryRegionType_VirtualDramKernelSecureAppletMemory.GetValue() == (0x62)); | ||
| 267 | |||
| 268 | constexpr inline auto KMemoryRegionType_VirtualDramKernelInitPt = | ||
| 248 | KMemoryRegionType_VirtualDramHeapBase.Derive(3, 0); | 269 | KMemoryRegionType_VirtualDramHeapBase.Derive(3, 0); |
| 249 | constexpr auto KMemoryRegionType_VirtualDramPoolManagement = | 270 | constexpr inline auto KMemoryRegionType_VirtualDramPoolManagement = |
| 250 | KMemoryRegionType_VirtualDramHeapBase.Derive(3, 1); | 271 | KMemoryRegionType_VirtualDramHeapBase.Derive(3, 1); |
| 251 | constexpr auto KMemoryRegionType_VirtualDramUserPool = | 272 | constexpr inline auto KMemoryRegionType_VirtualDramUserPool = |
| 252 | KMemoryRegionType_VirtualDramHeapBase.Derive(3, 2); | 273 | KMemoryRegionType_VirtualDramHeapBase.Derive(3, 2); |
| 253 | static_assert(KMemoryRegionType_VirtualDramKernelInitPt.GetValue() == 0x19A); | 274 | static_assert(KMemoryRegionType_VirtualDramKernelInitPt.GetValue() == 0x19A); |
| 254 | static_assert(KMemoryRegionType_VirtualDramPoolManagement.GetValue() == 0x29A); | 275 | static_assert(KMemoryRegionType_VirtualDramPoolManagement.GetValue() == 0x29A); |
| 255 | static_assert(KMemoryRegionType_VirtualDramUserPool.GetValue() == 0x31A); | 276 | static_assert(KMemoryRegionType_VirtualDramUserPool.GetValue() == 0x31A); |
| 256 | 277 | ||
| 257 | // NOTE: For unknown reason, the pools are derived out-of-order here. It's worth eventually trying | 278 | // NOTE: For unknown reason, the pools are derived out-of-order here. |
| 258 | // to understand why Nintendo made this choice. | 279 | // It's worth eventually trying to understand why Nintendo made this choice. |
| 259 | // UNUSED: .Derive(6, 0); | 280 | // UNUSED: .Derive(6, 0); |
| 260 | // UNUSED: .Derive(6, 1); | 281 | // UNUSED: .Derive(6, 1); |
| 261 | constexpr auto KMemoryRegionType_VirtualDramAppletPool = | 282 | constexpr inline auto KMemoryRegionType_VirtualDramAppletPool = |
| 262 | KMemoryRegionType_VirtualDramUserPool.Derive(6, 2); | 283 | KMemoryRegionType_VirtualDramUserPool.Derive(6, 2); |
| 263 | constexpr auto KMemoryRegionType_VirtualDramApplicationPool = | 284 | constexpr inline auto KMemoryRegionType_VirtualDramApplicationPool = |
| 264 | KMemoryRegionType_VirtualDramUserPool.Derive(6, 3); | 285 | KMemoryRegionType_VirtualDramUserPool.Derive(6, 3); |
| 265 | constexpr auto KMemoryRegionType_VirtualDramSystemNonSecurePool = | 286 | constexpr inline auto KMemoryRegionType_VirtualDramSystemNonSecurePool = |
| 266 | KMemoryRegionType_VirtualDramUserPool.Derive(6, 4); | 287 | KMemoryRegionType_VirtualDramUserPool.Derive(6, 4); |
| 267 | constexpr auto KMemoryRegionType_VirtualDramSystemPool = | 288 | constexpr inline auto KMemoryRegionType_VirtualDramSystemPool = |
| 268 | KMemoryRegionType_VirtualDramUserPool.Derive(6, 5); | 289 | KMemoryRegionType_VirtualDramUserPool.Derive(6, 5); |
| 269 | static_assert(KMemoryRegionType_VirtualDramAppletPool.GetValue() == 0x1B1A); | 290 | static_assert(KMemoryRegionType_VirtualDramAppletPool.GetValue() == 0x1B1A); |
| 270 | static_assert(KMemoryRegionType_VirtualDramApplicationPool.GetValue() == 0x271A); | 291 | static_assert(KMemoryRegionType_VirtualDramApplicationPool.GetValue() == 0x271A); |
| 271 | static_assert(KMemoryRegionType_VirtualDramSystemNonSecurePool.GetValue() == 0x2B1A); | 292 | static_assert(KMemoryRegionType_VirtualDramSystemNonSecurePool.GetValue() == 0x2B1A); |
| 272 | static_assert(KMemoryRegionType_VirtualDramSystemPool.GetValue() == 0x331A); | 293 | static_assert(KMemoryRegionType_VirtualDramSystemPool.GetValue() == 0x331A); |
| 273 | 294 | ||
| 274 | constexpr auto KMemoryRegionType_ArchDeviceBase = | 295 | constexpr inline auto KMemoryRegionType_ArchDeviceBase = |
| 275 | KMemoryRegionType_Kernel.DeriveTransition(0, 1).SetSparseOnly(); | 296 | KMemoryRegionType_Kernel.DeriveTransition(0, 1).SetSparseOnly(); |
| 276 | constexpr auto KMemoryRegionType_BoardDeviceBase = | 297 | constexpr inline auto KMemoryRegionType_BoardDeviceBase = |
| 277 | KMemoryRegionType_Kernel.DeriveTransition(0, 2).SetDenseOnly(); | 298 | KMemoryRegionType_Kernel.DeriveTransition(0, 2).SetDenseOnly(); |
| 278 | static_assert(KMemoryRegionType_ArchDeviceBase.GetValue() == 0x5); | 299 | static_assert(KMemoryRegionType_ArchDeviceBase.GetValue() == 0x5); |
| 279 | static_assert(KMemoryRegionType_BoardDeviceBase.GetValue() == 0x5); | 300 | static_assert(KMemoryRegionType_BoardDeviceBase.GetValue() == 0x5); |
| @@ -284,7 +305,7 @@ static_assert(KMemoryRegionType_BoardDeviceBase.GetValue() == 0x5); | |||
| 284 | #error "Unimplemented" | 305 | #error "Unimplemented" |
| 285 | #else | 306 | #else |
| 286 | // Default to no architecture devices. | 307 | // Default to no architecture devices. |
| 287 | constexpr auto NumArchitectureDeviceRegions = 0; | 308 | constexpr inline auto NumArchitectureDeviceRegions = 0; |
| 288 | #endif | 309 | #endif |
| 289 | static_assert(NumArchitectureDeviceRegions >= 0); | 310 | static_assert(NumArchitectureDeviceRegions >= 0); |
| 290 | 311 | ||
| @@ -292,34 +313,35 @@ static_assert(NumArchitectureDeviceRegions >= 0); | |||
| 292 | #include "core/hle/kernel/board/nintendo/nx/k_memory_region_device_types.inc" | 313 | #include "core/hle/kernel/board/nintendo/nx/k_memory_region_device_types.inc" |
| 293 | #else | 314 | #else |
| 294 | // Default to no board devices. | 315 | // Default to no board devices. |
| 295 | constexpr auto NumBoardDeviceRegions = 0; | 316 | constexpr inline auto NumBoardDeviceRegions = 0; |
| 296 | #endif | 317 | #endif |
| 297 | static_assert(NumBoardDeviceRegions >= 0); | 318 | static_assert(NumBoardDeviceRegions >= 0); |
| 298 | 319 | ||
| 299 | constexpr auto KMemoryRegionType_KernelCode = KMemoryRegionType_Kernel.DeriveSparse(1, 4, 0); | 320 | constexpr inline auto KMemoryRegionType_KernelCode = KMemoryRegionType_Kernel.DeriveSparse(1, 4, 0); |
| 300 | constexpr auto KMemoryRegionType_KernelStack = KMemoryRegionType_Kernel.DeriveSparse(1, 4, 1); | 321 | constexpr inline auto KMemoryRegionType_KernelStack = |
| 301 | constexpr auto KMemoryRegionType_KernelMisc = KMemoryRegionType_Kernel.DeriveSparse(1, 4, 2); | 322 | KMemoryRegionType_Kernel.DeriveSparse(1, 4, 1); |
| 302 | constexpr auto KMemoryRegionType_KernelSlab = KMemoryRegionType_Kernel.DeriveSparse(1, 4, 3); | 323 | constexpr inline auto KMemoryRegionType_KernelMisc = KMemoryRegionType_Kernel.DeriveSparse(1, 4, 2); |
| 324 | constexpr inline auto KMemoryRegionType_KernelSlab = KMemoryRegionType_Kernel.DeriveSparse(1, 4, 3); | ||
| 303 | static_assert(KMemoryRegionType_KernelCode.GetValue() == 0x19); | 325 | static_assert(KMemoryRegionType_KernelCode.GetValue() == 0x19); |
| 304 | static_assert(KMemoryRegionType_KernelStack.GetValue() == 0x29); | 326 | static_assert(KMemoryRegionType_KernelStack.GetValue() == 0x29); |
| 305 | static_assert(KMemoryRegionType_KernelMisc.GetValue() == 0x49); | 327 | static_assert(KMemoryRegionType_KernelMisc.GetValue() == 0x49); |
| 306 | static_assert(KMemoryRegionType_KernelSlab.GetValue() == 0x89); | 328 | static_assert(KMemoryRegionType_KernelSlab.GetValue() == 0x89); |
| 307 | 329 | ||
| 308 | constexpr auto KMemoryRegionType_KernelMiscDerivedBase = | 330 | constexpr inline auto KMemoryRegionType_KernelMiscDerivedBase = |
| 309 | KMemoryRegionType_KernelMisc.DeriveTransition(); | 331 | KMemoryRegionType_KernelMisc.DeriveTransition(); |
| 310 | static_assert(KMemoryRegionType_KernelMiscDerivedBase.GetValue() == 0x149); | 332 | static_assert(KMemoryRegionType_KernelMiscDerivedBase.GetValue() == 0x149); |
| 311 | 333 | ||
| 312 | // UNUSED: .Derive(7, 0); | 334 | // UNUSED: .Derive(7, 0); |
| 313 | constexpr auto KMemoryRegionType_KernelMiscMainStack = | 335 | constexpr inline auto KMemoryRegionType_KernelMiscMainStack = |
| 314 | KMemoryRegionType_KernelMiscDerivedBase.Derive(7, 1); | 336 | KMemoryRegionType_KernelMiscDerivedBase.Derive(7, 1); |
| 315 | constexpr auto KMemoryRegionType_KernelMiscMappedDevice = | 337 | constexpr inline auto KMemoryRegionType_KernelMiscMappedDevice = |
| 316 | KMemoryRegionType_KernelMiscDerivedBase.Derive(7, 2); | 338 | KMemoryRegionType_KernelMiscDerivedBase.Derive(7, 2); |
| 317 | constexpr auto KMemoryRegionType_KernelMiscExceptionStack = | 339 | constexpr inline auto KMemoryRegionType_KernelMiscExceptionStack = |
| 318 | KMemoryRegionType_KernelMiscDerivedBase.Derive(7, 3); | 340 | KMemoryRegionType_KernelMiscDerivedBase.Derive(7, 3); |
| 319 | constexpr auto KMemoryRegionType_KernelMiscUnknownDebug = | 341 | constexpr inline auto KMemoryRegionType_KernelMiscUnknownDebug = |
| 320 | KMemoryRegionType_KernelMiscDerivedBase.Derive(7, 4); | 342 | KMemoryRegionType_KernelMiscDerivedBase.Derive(7, 4); |
| 321 | // UNUSED: .Derive(7, 5); | 343 | // UNUSED: .Derive(7, 5); |
| 322 | constexpr auto KMemoryRegionType_KernelMiscIdleStack = | 344 | constexpr inline auto KMemoryRegionType_KernelMiscIdleStack = |
| 323 | KMemoryRegionType_KernelMiscDerivedBase.Derive(7, 6); | 345 | KMemoryRegionType_KernelMiscDerivedBase.Derive(7, 6); |
| 324 | static_assert(KMemoryRegionType_KernelMiscMainStack.GetValue() == 0xB49); | 346 | static_assert(KMemoryRegionType_KernelMiscMainStack.GetValue() == 0xB49); |
| 325 | static_assert(KMemoryRegionType_KernelMiscMappedDevice.GetValue() == 0xD49); | 347 | static_assert(KMemoryRegionType_KernelMiscMappedDevice.GetValue() == 0xD49); |
| @@ -327,7 +349,8 @@ static_assert(KMemoryRegionType_KernelMiscExceptionStack.GetValue() == 0x1349); | |||
| 327 | static_assert(KMemoryRegionType_KernelMiscUnknownDebug.GetValue() == 0x1549); | 349 | static_assert(KMemoryRegionType_KernelMiscUnknownDebug.GetValue() == 0x1549); |
| 328 | static_assert(KMemoryRegionType_KernelMiscIdleStack.GetValue() == 0x2349); | 350 | static_assert(KMemoryRegionType_KernelMiscIdleStack.GetValue() == 0x2349); |
| 329 | 351 | ||
| 330 | constexpr auto KMemoryRegionType_KernelTemp = KMemoryRegionType_Kernel.Advance(2).Derive(2, 0); | 352 | constexpr inline auto KMemoryRegionType_KernelTemp = |
| 353 | KMemoryRegionType_Kernel.Advance(2).Derive(2, 0); | ||
| 331 | static_assert(KMemoryRegionType_KernelTemp.GetValue() == 0x31); | 354 | static_assert(KMemoryRegionType_KernelTemp.GetValue() == 0x31); |
| 332 | 355 | ||
| 333 | constexpr KMemoryRegionType GetTypeForVirtualLinearMapping(u32 type_id) { | 356 | constexpr KMemoryRegionType GetTypeForVirtualLinearMapping(u32 type_id) { |
| @@ -335,6 +358,8 @@ constexpr KMemoryRegionType GetTypeForVirtualLinearMapping(u32 type_id) { | |||
| 335 | return KMemoryRegionType_VirtualDramKernelTraceBuffer; | 358 | return KMemoryRegionType_VirtualDramKernelTraceBuffer; |
| 336 | } else if (KMemoryRegionType_DramKernelPtHeap.IsAncestorOf(type_id)) { | 359 | } else if (KMemoryRegionType_DramKernelPtHeap.IsAncestorOf(type_id)) { |
| 337 | return KMemoryRegionType_VirtualDramKernelPtHeap; | 360 | return KMemoryRegionType_VirtualDramKernelPtHeap; |
| 361 | } else if (KMemoryRegionType_DramKernelSecureAppletMemory.IsAncestorOf(type_id)) { | ||
| 362 | return KMemoryRegionType_VirtualDramKernelSecureAppletMemory; | ||
| 338 | } else if ((type_id | KMemoryRegionAttr_ShouldKernelMap) == type_id) { | 363 | } else if ((type_id | KMemoryRegionAttr_ShouldKernelMap) == type_id) { |
| 339 | return KMemoryRegionType_VirtualDramUnknownDebug; | 364 | return KMemoryRegionType_VirtualDramUnknownDebug; |
| 340 | } else { | 365 | } else { |