summaryrefslogtreecommitdiff
path: root/kernel/include/lib/klib.h
diff options
context:
space:
mode:
authorFreya Murphy <freya@freyacat.org>2025-04-15 22:20:59 -0400
committerFreya Murphy <freya@freyacat.org>2025-04-15 22:20:59 -0400
commit2dbf529c33aa3e24beff944758d586bb0608c1be (patch)
tree5b3381c3c8d9a74ccb988c8945fe0681c3ee7301 /kernel/include/lib/klib.h
parentfix %n (diff)
downloadcomus-2dbf529c33aa3e24beff944758d586bb0608c1be.tar.gz
comus-2dbf529c33aa3e24beff944758d586bb0608c1be.tar.bz2
comus-2dbf529c33aa3e24beff944758d586bb0608c1be.zip
expand memory manager work with userspace (more then one ctx)
Diffstat (limited to 'kernel/include/lib/klib.h')
-rw-r--r--kernel/include/lib/klib.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/kernel/include/lib/klib.h b/kernel/include/lib/klib.h
index 7f66e90..0d9797b 100644
--- a/kernel/include/lib/klib.h
+++ b/kernel/include/lib/klib.h
@@ -231,4 +231,29 @@ void log_backtrace(void);
*/
void log_backtrace_ex(void *ip, void *bp);
+/**
+ * Allocates size_t bytes in memory
+ *
+ * @param size - the amount of bytes to allocate
+ * @returns the address allocated or NULL on failure
+ */
+void *kalloc(size_t size);
+
+/**
+ * Rellocates a given allocated ptr to a new size of bytes in memory.
+ * If ptr is NULL it will allocate new memory.
+ *
+ * @param ptr - the pointer to reallocate
+ * @param size - the amount of bytes to reallocate to
+ * @returns the address allocated or NULL on failure
+ */
+void *krealloc(void *ptr, size_t size);
+
+/**
+ * Frees an allocated pointer in memory
+ *
+ * @param ptr - the pointer to free
+ */
+void kfree(void *ptr);
+
#endif /* klib.h */