kernel/slab: Disable the block allocator entirely if disabled.

block_alloc and friends are now declared as static, so we got
GCC errors about unused functions when USE_SLAB_ALLOCATOR_FOR_MALLOC
was 0. So, instead, just don't initialize the block allocator
at all.

This was the change that triggered the prior commits: if the
block allocator is completely disabled, the first object
allocated through an object_cache is inside VMAddressSpace
initialization, which happens during the interim period
mentioned in previous commits.

Haiku now can be built and booted all the way to the desktop
with the kernel guarded heap enabled (and without the guarded
heap substituting for the object cache.)

Change-Id: If2f08a741826799127ecfd263d6c82ed4263eaab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7701
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
This commit is contained in:
Augustin Cavalier
2024-05-29 18:10:06 +00:00
committed by waddlesplash
parent 7133a49e81
commit bd25d788a2
+26 -3
View File
@@ -23,6 +23,9 @@
#include "MemoryManager.h"
#if USE_SLAB_ALLOCATOR_FOR_MALLOC
//#define TEST_ALL_CACHES_DURING_BOOT
static const size_t kBlockSizes[] = {
@@ -202,9 +205,6 @@ block_allocator_init_rest()
// #pragma mark - public API
#if USE_SLAB_ALLOCATOR_FOR_MALLOC
void*
memalign(size_t alignment, size_t size)
{
@@ -295,6 +295,29 @@ realloc(void* address, size_t newSize)
}
#else
void*
block_alloc_early(size_t size)
{
panic("block allocator not enabled!");
return NULL;
}
void
block_allocator_init_boot()
{
}
void
block_allocator_init_rest()
{
}
#endif // USE_SLAB_ALLOCATOR_FOR_MALLOC