diff --git a/kernel/kernel/Memory/kmalloc.cpp b/kernel/kernel/Memory/kmalloc.cpp index f9decdb4..7d24da52 100644 --- a/kernel/kernel/Memory/kmalloc.cpp +++ b/kernel/kernel/Memory/kmalloc.cpp @@ -12,9 +12,7 @@ extern uint8_t g_kernel_end[]; static constexpr size_t s_kmalloc_min_align = alignof(max_align_t); -static uint8_t s_kmalloc_storage[2 * MB]; - -static BAN::UniqPtr s_general_allocator; +static uint8_t s_kmalloc_storage[20 * MB]; struct kmalloc_node { @@ -303,19 +301,6 @@ void* kmalloc(size_t size, size_t align, bool force_indentity_map) Kernel::CriticalScope critical; - // FIXME: this is a hack to make more dynamic kmalloc memory - if (size > PAGE_SIZE && !force_indentity_map) - { - using namespace Kernel; - - if (!s_general_allocator) - s_general_allocator = MUST(GeneralAllocator::create(PageTable::kernel(), (vaddr_t)g_kernel_end)); - - auto vaddr = s_general_allocator->allocate(size); - if (vaddr) - return (void*)vaddr; - } - if (size == 0 || size >= info.size) goto no_memory; @@ -350,9 +335,6 @@ void kfree(void* address) Kernel::CriticalScope critical; - if (s_general_allocator && s_general_allocator->deallocate((Kernel::vaddr_t)address)) - return; - if (s_kmalloc_fixed_info.base <= address_uint && address_uint < s_kmalloc_fixed_info.end) { auto& info = s_kmalloc_fixed_info; @@ -414,13 +396,6 @@ BAN::Optional kmalloc_paddr_of(Kernel::vaddr_t vaddr) { using namespace Kernel; - if (s_general_allocator) - { - auto paddr = s_general_allocator->paddr_of(vaddr); - if (paddr.has_value()) - return paddr.value(); - } - if ((vaddr_t)s_kmalloc_storage <= vaddr && vaddr < (vaddr_t)s_kmalloc_storage + sizeof(s_kmalloc_storage)) return V2P(vaddr);