summaryrefslogtreecommitdiff
path: root/src/libc/stdlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libc/stdlib.c')
-rw-r--r--src/libc/stdlib.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/libc/stdlib.c b/src/libc/stdlib.c
index 46bdce8..9150431 100644
--- a/src/libc/stdlib.c
+++ b/src/libc/stdlib.c
@@ -45,4 +45,23 @@ char *itoa( int v, char *s, int base )
return s;
}
+
+// TODO: we should have a global memory manager and one per
+// user process later
+static memory_manager_t *stdlib_memory_manager = NULL;
+void *malloc( size_t size )
+{
+ return memory_manager_allocate( stdlib_memory_manager, size );
+}
+
+void free( void *p )
+{
+ memory_manager_deallocate( stdlib_memory_manager, &p );
+}
+
+void __stdlib_set_memory_manager( memory_manager_t *memory_manager )
+{
+ stdlib_memory_manager = memory_manager;
+}
+