mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-16 08:04:23 -04:00
kern: add new overflow checks on KMemoryRegions
This commit is contained in:
parent
748893fe77
commit
0a1465f198
8 changed files with 32 additions and 1 deletions
|
@ -52,6 +52,8 @@ namespace ams::kern {
|
|||
/* Initialize the memory manager and the KPageBuffer slabheap. */
|
||||
{
|
||||
const auto &management_region = KMemoryLayout::GetPoolManagementRegion();
|
||||
MESOSPHERE_ABORT_UNLESS(management_region.GetEndAddress() != 0);
|
||||
|
||||
Kernel::GetMemoryManager().Initialize(management_region.GetAddress(), management_region.GetSize());
|
||||
init::InitializeKPageBufferSlabHeap();
|
||||
}
|
||||
|
@ -68,6 +70,8 @@ namespace ams::kern {
|
|||
/* Initialize the Dynamic Slab Heaps. */
|
||||
{
|
||||
const auto &pt_heap_region = KMemoryLayout::GetPageTableHeapRegion();
|
||||
MESOSPHERE_ABORT_UNLESS(pt_heap_region.GetEndAddress() != 0);
|
||||
|
||||
Kernel::InitializeResourceManagers(pt_heap_region.GetAddress(), pt_heap_region.GetSize());
|
||||
}
|
||||
}
|
||||
|
@ -124,6 +128,13 @@ namespace ams::kern {
|
|||
|
||||
/* Resume all threads suspended while we initialized. */
|
||||
KThread::ResumeThreadsSuspendedForInit();
|
||||
|
||||
/* Validate that all reserved dram blocks are valid. */
|
||||
for (const auto ®ion : KMemoryLayout::GetPhysicalMemoryRegionTree()) {
|
||||
if (region.IsDerivedFrom(KMemoryRegionType_DramReservedBase)) {
|
||||
MESOSPHERE_ABORT_UNLESS(region.GetEndAddress() != 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
cpu::SynchronizeAllCores();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue