aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/memory/alloc.c
diff options
context:
space:
mode:
authorMarvin Borner2020-05-03 22:44:24 +0200
committerMarvin Borner2020-05-03 22:44:24 +0200
commit2ac25568839df7af2e271db9efa84bbd6fcb1f88 (patch)
tree3747958b729275c07115c579def55d246d72669e /src/kernel/memory/alloc.c
parent5a02853da5c454ff34e65ddaea5e677a3285bc79 (diff)
Added missing memory functions
Diffstat (limited to 'src/kernel/memory/alloc.c')
-rw-r--r--src/kernel/memory/alloc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/kernel/memory/alloc.c b/src/kernel/memory/alloc.c
index 098eb75..825c639 100644
--- a/src/kernel/memory/alloc.c
+++ b/src/kernel/memory/alloc.c
@@ -165,6 +165,13 @@ void *kmalloc(uint32_t size)
return malloc_internal(kheap, size);
}
+void *kcalloc(uint32_t num, uint32_t size)
+{
+ void *ptr = kmalloc(num * size);
+ memset(ptr, 0, num * size);
+ return ptr;
+}
+
void kfree(void *address)
{
if (kheap == NULL)
@@ -178,6 +185,13 @@ void *umalloc(size_t size)
return malloc_internal(uheap, size);
}
+void *ucalloc(uint32_t num, uint32_t size)
+{
+ void *ptr = umalloc(num * size);
+ memset(ptr, 0, num * size);
+ return ptr;
+}
+
void ufree(void *address)
{
free_internal(uheap, address);