summaryrefslogtreecommitdiff
path: root/src/kernel/malloc.h
diff options
context:
space:
mode:
authordzwdz2024-03-13 22:33:38 +0100
committerdzwdz2024-03-13 22:46:47 +0100
commit72f55421fb61b750512f324d284b30e3e67e36e0 (patch)
tree8933dc013580a2440730644807a03606c6805547 /src/kernel/malloc.h
parente47412d940db4e9be2d05608272e30f560a275d0 (diff)
kernel/malloc: slight rework (it's still bad), store more metadata
Diffstat (limited to 'src/kernel/malloc.h')
-rw-r--r--src/kernel/malloc.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/kernel/malloc.h b/src/kernel/malloc.h
index 671a468..03934de 100644
--- a/src/kernel/malloc.h
+++ b/src/kernel/malloc.h
@@ -3,8 +3,6 @@
#include <shared/mem.h>
#include <stddef.h>
-extern struct malloc_hdr *malloc_last;
-
void mem_init(void *memtop);
void mem_reserve(void *addr, size_t len);
void mem_debugprint(void);
@@ -19,11 +17,12 @@ void *page_zalloc(size_t pages);
void page_free(void *first, size_t pages);
void kmalloc_sanity(const void *addr);
-void *kmalloc(size_t len);
+void *kmalloc(size_t len, const char *desc);
void kfree(void *ptr);
-static inline void *kzalloc(size_t len) {
- void *b = kmalloc(len);
+// TODO calloc
+static inline void *kzalloc(size_t len, const char *desc) {
+ void *b = kmalloc(len, desc);
memset(b, 0, len);
return b;
}