aboutsummaryrefslogtreecommitdiff
path: root/kernel/include/libk/liballoc.h
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-02-03 20:38:28 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2025-02-03 20:38:28 +0530
commit70d67f088a2131466c22f6dadbe388a3ee1d5efb (patch)
tree819f93e0295e4e6682cea25e718cc998eeaaf216 /kernel/include/libk/liballoc.h
parenta52729a44eb1a42f10544e67eecc5cc85b9e99c2 (diff)
libk: Start work on custom liballoc
Diffstat (limited to 'kernel/include/libk/liballoc.h')
-rw-r--r--kernel/include/libk/liballoc.h30
1 files changed, 10 insertions, 20 deletions
diff --git a/kernel/include/libk/liballoc.h b/kernel/include/libk/liballoc.h
index 11c3111..56ee5d2 100644
--- a/kernel/include/libk/liballoc.h
+++ b/kernel/include/libk/liballoc.h
@@ -19,39 +19,29 @@
#ifndef __libk_kmalloc_h
#define __libk_kmalloc_h
-#include <mm/virtual_mm.h>
#include <stddef.h>
#include <stdint.h>
namespace LibAlloc
{
-/** This is a boundary tag which is prepended to the
- * page or section of a page which we have allocated. It is
- * used to identify valid memory blocks that the
- * application is trying to free.
- */
-struct boundary_tag {
- unsigned int magic; //< It's a kind of ...
- unsigned int size; //< Requested size.
- unsigned int real_size; //< Actual size.
- int index; //< Location in the page table.
+class Block
+{
+public:
+ Block *m_next;
+ Block *m_prev;
- struct boundary_tag *split_left; //< Linked-list info for broken pages.
- struct boundary_tag *split_right; //< The same.
+ uint32_t m_size;
- struct boundary_tag *next; //< Linked list info.
- struct boundary_tag *prev; //< Linked list info.
+public:
+ void initialize(uint32_t size);
+
+ void *get_chunk(void);
};
bool initialized(void);
void initialize(void);
-void *kmalloc(size_t);
-void *krealloc(void *, size_t);
-void *kcalloc(size_t, size_t);
-void kfree(void *);
-
}
#endif