summaryrefslogtreecommitdiff
path: root/src/kernel/mem/mem.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/mem/mem.c')
-rw-r--r--src/kernel/mem/mem.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/kernel/mem/mem.c b/src/kernel/mem/mem.c
index 2061aff..c6494b7 100644
--- a/src/kernel/mem/mem.c
+++ b/src/kernel/mem/mem.c
@@ -2,12 +2,19 @@
#include <core/sys.h>
#include <core/monitor.h>
#include "paging.h"
-#include "heap.h"
+
+#include <config.h>
+
+#ifdef K_USE_BASIC_HEAP
+#include "heap.basic.h"
+#else
+#include "heap.std.h"
+#endif
#define FREEPAGESTOKEEP 5
-#define KHEAP_IDXSIZE 0x1000
-#define KHEAP_INITSIZE 0x80000
+#define KHEAP_IDXSIZE 0x4000 // only used with heap.std.h
+#define KHEAP_INITSIZE 0x00080000
#define KHEAP_MAXSIZE 0x08000000
size_t mem_placementAddr;
@@ -76,7 +83,11 @@ static struct heap kheap;
/* Called on kernel start. Creates the kernel heap. */
void kheap_init() {
+#ifdef K_USE_BASIC_HEAP
+ heap_create(&kheap, (mem_placementAddr & 0xFFFFF000) + 0x1000, KHEAP_INITSIZE, KHEAP_MAXSIZE);
+#else
heap_create(&kheap, (mem_placementAddr & 0xFFFFF000) + 0x1000, KHEAP_IDXSIZE, KHEAP_INITSIZE, KHEAP_MAXSIZE);
+#endif
kheap_working = 1;
monitor_write("[KHeap] ");
}