diff options
author | Marvin Borner | 2020-05-13 21:28:56 +0200 |
---|---|---|
committer | Marvin Borner | 2020-05-13 22:12:41 +0200 |
commit | a9c7529dcca845d98192ece62be70f752972216b (patch) | |
tree | 666d49ceb411a669abe6191151b2238fd7156c30 /src/kernel/memory/alloc.h | |
parent | e1a6ed079303dc7d218f1d5326a13b6755781271 (diff) |
Replaced alloc.h with liballoc
And many more adaptions to the lib
Diffstat (limited to 'src/kernel/memory/alloc.h')
-rw-r--r-- | src/kernel/memory/alloc.h | 44 |
1 files changed, 4 insertions, 40 deletions
diff --git a/src/kernel/memory/alloc.h b/src/kernel/memory/alloc.h index a7b05bc..6c4290e 100644 --- a/src/kernel/memory/alloc.h +++ b/src/kernel/memory/alloc.h @@ -1,47 +1,11 @@ #ifndef MELVIX_ALLOC_H #define MELVIX_ALLOC_H -#include <stdbool.h> -#include <stddef.h> #include <stdint.h> -#define KHEAP_MAGIC 0xCAFEBABE -#define KHEAP_MAGIC2 0xDEADBEEF -#define KHEAP_END 0xFFFFDEAD -#define MEM_END 0x8000000 - -struct heap_header { - u32 magic; - bool free; - u32 size; - u32 magic2; -}; - -struct heap_footer { - u32 magic; - u32 size; - u32 magic2; -}; - -void kheap_init(); - -void *fmalloc(u32 size); -void *kcalloc(u32 num, u32 size); -void *kmalloc(u32 size); -void *kmalloc_a(u32 size); -void kfree(void *ptr); - -void *umalloc(u32 size); -void *ucalloc(u32 num, u32 size); -void ufree(void *address); - -void init_heap(struct heap_header *heap, u32 size); - -#define KHEAP_SIZE 0xFFFFF -#define UHEAP_SIZE 0xFFFFF -#define HEAP_S (sizeof(struct heap_header)) -#define HEAP_TOTAL (sizeof(struct heap_footer) + HEAP_S) -#define HEAP_MINIMUM 1 -#define HEAP_FIND_SIZE (HEAP_TOTAL + HEAP_MINIMUM) +void *malloc(u32); +void *realloc(void *, u32); +void *calloc(u32, u32); +void free(void *); #endif
\ No newline at end of file |