diff --git a/include/aos/ram_alloc.h b/include/aos/ram_alloc.h index d7b9702..0c462ed 100644 --- a/include/aos/ram_alloc.h +++ b/include/aos/ram_alloc.h @@ -32,7 +32,8 @@ errval_t ram_alloc_aligned(struct capref *ret, size_t size, size_t alignment); errval_t ram_alloc(struct capref *retcap, size_t size); errval_t ram_free(struct capref cap); errval_t ram_available(genpaddr_t *available, genpaddr_t *total); -errval_t ram_alloc_set(ram_alloc_func_t local_allocator, ram_free_func_t local_free); +errval_t ram_alloc_set(ram_alloc_func_t local_allocator); +errval_t ram_alloc_set_with_free(ram_alloc_func_t local_allocator, ram_free_func_t local_free); void ram_set_affinity(uint64_t minbase, uint64_t maxlimit); void ram_get_affinity(uint64_t *minbase, uint64_t *maxlimit); void ram_alloc_init(void); diff --git a/lib/aos/init.c b/lib/aos/init.c index 2221cb5..4672199 100644 --- a/lib/aos/init.c +++ b/lib/aos/init.c @@ -123,7 +123,7 @@ errval_t barrelfish_init_onthread(struct spawn_domain_params *params) // Initialize ram_alloc state ram_alloc_init(); /* All domains use smallcn to initialize */ - err = ram_alloc_set(ram_alloc_fixed, NULL); + err = ram_alloc_set(ram_alloc_fixed); if (err_is_fail(err)) { return err_push(err, LIB_ERR_RAM_ALLOC_SET); } diff --git a/lib/aos/ram_alloc.c b/lib/aos/ram_alloc.c index abfa4cc..1df7d64 100644 --- a/lib/aos/ram_alloc.c +++ b/lib/aos/ram_alloc.c @@ -142,7 +142,12 @@ void ram_alloc_init(void) * If local_allocator is NULL, it will be initialized to the default * remote allocator. */ -errval_t ram_alloc_set(ram_alloc_func_t local_allocator, ram_free_func_t local_free) +errval_t ram_alloc_set(ram_alloc_func_t local_allocator) +{ + return ram_alloc_set_with_free(local_allocator, NULL); +} + +errval_t ram_alloc_set_with_free(ram_alloc_func_t local_allocator, ram_free_func_t local_free) { struct ram_alloc_state *ram_alloc_state = get_ram_alloc_state(); diff --git a/usr/init/mem_alloc.c b/usr/init/mem_alloc.c index 53f2827..48ae4ab 100644 --- a/usr/init/mem_alloc.c +++ b/usr/init/mem_alloc.c @@ -71,7 +71,7 @@ errval_t initialize_ram_alloc(void) // Initialize the generic RAM allocator to use our local allocator. // We do this here, because mm_add allocates memory for the slab allocator, // and that uses ram_alloc. - err = ram_alloc_set(aos_ram_alloc_aligned, aos_ram_free); + err = ram_alloc_set_with_free(aos_ram_alloc_aligned, aos_ram_free); if (err_is_fail(err)) { return err_push(err, LIB_ERR_RAM_ALLOC_SET); }