From 8712d6a95984805e242f1189a5a76db2fbd5d39f Mon Sep 17 00:00:00 2001 From: Amlal Date: Mon, 9 Sep 2024 17:33:20 +0200 Subject: FIX: Kernel related, see below. - Allocate space for heap header as well. - Don't forget to turn user bit off, and turn present off when dealing with virtual memory. Signed-off-by: Amlal --- dev/ZKA/Sources/Heap.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'dev/ZKA/Sources') diff --git a/dev/ZKA/Sources/Heap.cxx b/dev/ZKA/Sources/Heap.cxx index 1f9af6a2..cd46a80b 100644 --- a/dev/ZKA/Sources/Heap.cxx +++ b/dev/ZKA/Sources/Heap.cxx @@ -94,18 +94,20 @@ namespace Kernel { Detail::mm_alloc_init_timeout(); - auto szFix = sz; + auto sz_fix = sz; - if (szFix == 0) + if (sz_fix == 0) return nullptr; - auto wrapper = kHeapPageMgr.Request(rw, user, No, szFix); + sz_fix += sizeof(Detail::HEAP_INFORMATION_BLOCK); + + auto wrapper = kHeapPageMgr.Request(rw, user, No, sz_fix); Detail::HEAP_INFORMATION_BLOCK_PTR heap_info_ptr = reinterpret_cast( wrapper.VirtualAddress() + sizeof(Detail::HEAP_INFORMATION_BLOCK)); - heap_info_ptr->fHeapSize = szFix; + heap_info_ptr->fHeapSize = sz_fix; heap_info_ptr->fMagic = kKernelHeapMagic; heap_info_ptr->fCRC32 = No; // dont fill it for now. heap_info_ptr->fHeapPtr = reinterpret_cast(heap_info_ptr) + sizeof(Detail::HEAP_INFORMATION_BLOCK); -- cgit v1.2.3