diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/malloc.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/malloc.c b/src/core/malloc.c index d694f5559..32fd5fc0e 100644 --- a/src/core/malloc.c +++ b/src/core/malloc.c @@ -145,6 +145,18 @@ static unsigned int discard_cache ( void ) { } /** + * Discard all cached data + * + */ +static void discard_all_cache ( void ) { + unsigned int discarded; + + do { + discarded = discard_cache(); + } while ( discarded ); +} + +/** * Allocate a memory block * * @v size Requested size @@ -458,6 +470,19 @@ struct init_fn heap_init_fn __init_fn ( INIT_EARLY ) = { .initialise = init_heap, }; +/** + * Discard all cached data on shutdown + * + */ +static void shutdown_cache ( int booting __unused ) { + discard_all_cache(); +} + +/** Memory allocator shutdown function */ +struct startup_fn heap_startup_fn __startup_fn ( STARTUP_EARLY ) = { + .shutdown = shutdown_cache, +}; + #if 0 #include <stdio.h> /** |
