|
@@ -144,6 +144,18 @@ static unsigned int discard_cache ( void ) {
|
144
|
144
|
return discarded;
|
145
|
145
|
}
|
146
|
146
|
|
|
147
|
+/**
|
|
148
|
+ * Discard all cached data
|
|
149
|
+ *
|
|
150
|
+ */
|
|
151
|
+static void discard_all_cache ( void ) {
|
|
152
|
+ unsigned int discarded;
|
|
153
|
+
|
|
154
|
+ do {
|
|
155
|
+ discarded = discard_cache();
|
|
156
|
+ } while ( discarded );
|
|
157
|
+}
|
|
158
|
+
|
147
|
159
|
/**
|
148
|
160
|
* Allocate a memory block
|
149
|
161
|
*
|
|
@@ -458,6 +470,19 @@ struct init_fn heap_init_fn __init_fn ( INIT_EARLY ) = {
|
458
|
470
|
.initialise = init_heap,
|
459
|
471
|
};
|
460
|
472
|
|
|
473
|
+/**
|
|
474
|
+ * Discard all cached data on shutdown
|
|
475
|
+ *
|
|
476
|
+ */
|
|
477
|
+static void shutdown_cache ( int booting __unused ) {
|
|
478
|
+ discard_all_cache();
|
|
479
|
+}
|
|
480
|
+
|
|
481
|
+/** Memory allocator shutdown function */
|
|
482
|
+struct startup_fn heap_startup_fn __startup_fn ( STARTUP_EARLY ) = {
|
|
483
|
+ .shutdown = shutdown_cache,
|
|
484
|
+};
|
|
485
|
+
|
461
|
486
|
#if 0
|
462
|
487
|
#include <stdio.h>
|
463
|
488
|
/**
|