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.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libc/stdlib.c b/src/libc/stdlib.c
index 4fea56e..1316152 100644
--- a/src/libc/stdlib.c
+++ b/src/libc/stdlib.c
@@ -86,7 +86,7 @@ static memory_manager_t *stdlib_memory_manager = NULL;
void *malloc( size_t size )
{
- return memory_manager_allocate( stdlib_memory_manager, size );
+ return memory_manager_allocate( stdlib_memory_manager, size, 1 );
}
void free( void *p )
@@ -94,7 +94,18 @@ void free( void *p )
memory_manager_deallocate( stdlib_memory_manager, &p );
}
+void *aligned_alloc( size_t alignment, size_t size )
+{
+ if( size % alignment != 0 ) {
+ kernel_panic( "Illegal call to 'aligned_alloc' with size %d and alignment %d!",
+ size, alignment );
+ }
+
+ return memory_manager_allocate( stdlib_memory_manager, size, alignment );
+}
+
void __stdlib_set_memory_manager( memory_manager_t *memory_manager )
{
stdlib_memory_manager = memory_manager;
}
+