From 7a4bc281958c639cd52ff4f192933aa161ba81a4 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 19 Aug 2022 18:03:59 +0200 Subject: kernel: kzalloc --- src/kernel/mem/alloc.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/kernel/mem') 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 +#include #include 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; +} -- cgit v1.2.3