From 88e9b3b3a6060ab1035e0576519e18bb64edda09 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Wed, 13 Dec 2023 14:25:19 -0500 Subject: 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 --- sys/vm/vm_dynalloc.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'sys/vm/vm_dynalloc.c') 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 @@ -44,6 +44,21 @@ dynalloc(size_t sz) return tlsf_malloc(vm_ctx.tlsf_ctx, 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 * -- cgit v1.2.3