summaryrefslogtreecommitdiff
path: root/src/heap.h
diff options
context:
space:
mode:
authorAleksa Vučković <aleksav013@gmail.com>2021-10-24 18:47:28 +0200
committerAleksa Vučković <aleksav013@gmail.com>2021-10-24 18:47:28 +0200
commit0bca634f7e70b05239f46f3bd40bb37468d67957 (patch)
treec4c121dea59ff4183ffb78da4eba75b61f8c8891 /src/heap.h
parent1395dc42159d52ba36524fabe805897cd20bd01e (diff)
Fixing keyboard, changes to Makefile and string.h, trying to add heap...
Diffstat (limited to 'src/heap.h')
-rw-r--r--src/heap.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/heap.h b/src/heap.h
new file mode 100644
index 0000000..2f66501
--- /dev/null
+++ b/src/heap.h
@@ -0,0 +1,23 @@
+#include"types.h"
+
+typedef struct _KHEAPBLOCKBM {
+ struct _KHEAPBLOCKBM *next;
+ uint32_t size;
+ uint32_t used;
+ uint32_t bsize;
+ uint32_t lfb;
+} KHEAPBLOCKBM;
+
+typedef struct _KHEAPBM {
+ KHEAPBLOCKBM *fblock;
+} KHEAPBM;
+
+void k_heapBMInit(KHEAPBM *heap);
+int k_heapBMAddBlock(KHEAPBM *heap, uintptr_t addr, uint32_t size, uint32_t bsize);
+void *k_heapBMAlloc(KHEAPBM *heap, uint32_t size);
+void k_heapBMFree(KHEAPBM *heap, void *ptr);
+
+extern KHEAPBM kheap;
+
+#define kmalloc k_heapBMAlloc
+#define kfree k_heapBMFree