diff options
author | dzwdz | 2022-08-19 18:03:59 +0200 |
---|---|---|
committer | dzwdz | 2022-08-19 18:03:59 +0200 |
commit | 7a4bc281958c639cd52ff4f192933aa161ba81a4 (patch) | |
tree | 6afc254b32bc724d872227f4fb3699ef03f511a0 /src/kernel/mem | |
parent | e9161cdcda9e5170f3ea5f18a8275395004ffce4 (diff) |
kernel: kzalloc
Diffstat (limited to 'src/kernel/mem')
-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; +} |