aboutsummaryrefslogtreecommitdiff
path: root/sys/vm
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2023-12-13 14:25:19 -0500
committerIan Moffett <ian@osmora.org>2023-12-13 14:28:10 -0500
commit88e9b3b3a6060ab1035e0576519e18bb64edda09 (patch)
tree2371978ee7c9cfde30879214cd2faeadf18a6cb5 /sys/vm
parent32611417417466af6d277a85c280d0dc6ab02575 (diff)
kernel: vm: Add support for dynalloc pool resize
This commit creates a wrapper that allows resizing of a memory pool created by dynalloc() Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/vm')
-rw-r--r--sys/vm/vm_dynalloc.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/sys/vm/vm_dynalloc.c b/sys/vm/vm_dynalloc.c
index 8f766a8..d43372b 100644
--- a/sys/vm/vm_dynalloc.c
+++ b/sys/vm/vm_dynalloc.c
@@ -45,6 +45,21 @@ dynalloc(size_t sz)
}
/*
+ * Reallocates memory pool created by `dynalloc()'
+ *
+ * @old_ptr: Pointer to old pool.
+ * @newsize: Size of new pool.
+ */
+void *
+dynrealloc(void *old_ptr, size_t newsize)
+{
+ /* TODO: Per CPU */
+ struct cpu_vm_ctx vm_ctx = vm_get_bsp_ctx();
+
+ return tlsf_realloc(vm_ctx.tlsf_ctx, old_ptr, newsize);
+}
+
+/*
* Free dynamically allocated memory
*
* @ptr: Pointer to base of memory.