kern: fully implement slabheap init

This commit is contained in:
Michael Scire 2020-01-30 01:41:59 -08:00
parent 7d6b16d7fb
commit d5a4c17ee7
12 changed files with 319 additions and 13 deletions

View file

@ -96,7 +96,7 @@ namespace ams::kern::init {
KInitialPageTable ttbr1_table(util::AlignDown(cpu::GetTtbr1El1(), PageSize), KInitialPageTable::NoClear{});
/* Initialize the slab allocator counts. */
/* TODO */
InitializeSlabResourceCounts();
/* Insert the root block for the virtual memory tree, from which all other blocks will derive. */
KMemoryLayout::GetVirtualMemoryBlockTree().insert(*KMemoryLayout::GetMemoryBlockAllocator().Create(KernelVirtualAddressSpaceBase, KernelVirtualAddressSpaceSize, 0, 0));
@ -142,7 +142,7 @@ namespace ams::kern::init {
const size_t resource_region_size = KernelResourceRegionSize + (use_extra_resources ? ExtraKernelResourceSize : 0);
/* Determine the size of the slab region. */
const size_t slab_region_size = 0x647000; /* TODO: Calculate this on the fly. */
const size_t slab_region_size = CalculateTotalSlabHeapSize();
MESOSPHERE_INIT_ABORT_UNLESS(slab_region_size <= resource_region_size);
/* Setup the slab region. */