diff options
Diffstat (limited to 'src/kernel/mem/alloc.h')
-rw-r--r-- | src/kernel/mem/alloc.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/kernel/mem/alloc.h b/src/kernel/mem/alloc.h index fa2798a..671a468 100644 --- a/src/kernel/mem/alloc.h +++ b/src/kernel/mem/alloc.h @@ -1,5 +1,6 @@ #pragma once #include <kernel/arch/generic.h> +#include <shared/mem.h> #include <stddef.h> extern struct malloc_hdr *malloc_last; @@ -20,3 +21,9 @@ void page_free(void *first, size_t pages); void kmalloc_sanity(const void *addr); void *kmalloc(size_t len); void kfree(void *ptr); + +static inline void *kzalloc(size_t len) { + void *b = kmalloc(len); + memset(b, 0, len); + return b; +} |