summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/include/vm/dynalloc.h1
-rw-r--r--sys/vm/vm_dynalloc.c15
2 files changed, 16 insertions, 0 deletions
diff --git a/sys/include/vm/dynalloc.h b/sys/include/vm/dynalloc.h
index 4a70f2c..8c51a55 100644
--- a/sys/include/vm/dynalloc.h
+++ b/sys/include/vm/dynalloc.h
@@ -33,6 +33,7 @@
#include <sys/types.h>
void *dynalloc(size_t sz);
+void *dynrealloc(void *old_ptr, size_t newsize);
void dynfree(void *ptr);
#endif /* !_VM_DYNALLOC_H_ */
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.