diff --git a/libraries/libmesosphere/source/init/kern_init_slab_setup.cpp b/libraries/libmesosphere/source/init/kern_init_slab_setup.cpp index 01a580c29..5737afea7 100644 --- a/libraries/libmesosphere/source/init/kern_init_slab_setup.cpp +++ b/libraries/libmesosphere/source/init/kern_init_slab_setup.cpp @@ -127,10 +127,14 @@ namespace ams::kern::init { size += util::AlignUp(sizeof(NAME) * (COUNT), alignof(void *)); \ }); - /* NOTE: This can't be used right now because we don't have all these types implemented. */ - /* Once we do, uncomment the following and stop using the hardcoded size. */ + /* Add the size required for each slab. */ FOREACH_SLAB_TYPE(ADD_SLAB_SIZE) + #undef ADD_SLAB_SIZE + + /* Add the reserved size. */ + size += SlabRegionReservedSize; + return size; } diff --git a/mesosphere/kernel/source/arch/arm64/init/kern_init_core.cpp b/mesosphere/kernel/source/arch/arm64/init/kern_init_core.cpp index c13beb815..54ec9c055 100644 --- a/mesosphere/kernel/source/arch/arm64/init/kern_init_core.cpp +++ b/mesosphere/kernel/source/arch/arm64/init/kern_init_core.cpp @@ -156,7 +156,7 @@ namespace ams::kern::init { const size_t resource_region_size = GetResourceRegionSize(); /* Determine the size of the slab region. */ - const size_t slab_region_size = CalculateTotalSlabHeapSize(); + const size_t slab_region_size = util::AlignUp(CalculateTotalSlabHeapSize(), PageSize); MESOSPHERE_INIT_ABORT_UNLESS(slab_region_size <= resource_region_size); /* Setup the slab region. */