summaryrefslogtreecommitdiff
path: root/src/kernel.c
diff options
context:
space:
mode:
authorCarlos Maiolino <[email protected]>2025-09-14 14:18:41 +0200
committerCarlos Maiolino <[email protected]>2025-09-14 14:18:41 +0200
commitcd2c4e4a25cb41ca6fe622f0ccf1b1a3dd9d5660 (patch)
tree319ff940278d98f0010bdcdfcbc08bf22cb6aec0 /src/kernel.c
parent833f883ab85d57d8f9cfae5a2181b3e097fae8bd (diff)
Add a kernel heap
Use the heap API to implement a 100MiB heap to be used by the kernel code. Add example usage to src/kernel.c Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'src/kernel.c')
-rw-r--r--src/kernel.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/kernel.c b/src/kernel.c
index 8a8bd61..cd9f9d7 100644
--- a/src/kernel.c
+++ b/src/kernel.c
@@ -5,6 +5,7 @@
#include <toxic/kernel.h>
#include <toxic/idt.h>
#include <toxic/io.h>
+#include <mm/kernel_heap.h>
void start_kernel()
{
@@ -12,6 +13,20 @@ void start_kernel()
vprintl("Hello World!!!\n");
vprintl("Testing it!!!\n");
+ kernel_heap_init();
interrupts_init();
+
+ void *ptr = kmalloc(50);
+ void *ptr2 = kmalloc(5000);
+ void *ptr3 = kmalloc(5600);
+
+ *((int *)ptr) = 11;
+ kfree(ptr);
+ void *ptr4 = kmalloc(50);
+
+ *((int *)ptr2) = 22;
+ *((int *)ptr3) = 33;
+ *((int *)ptr4) = 44;
+ if (ptr || ptr2 || ptr3 || ptr4) {}
}