1.1 --- a/libmem/lib/src/flexpage.cc Sat May 01 23:51:28 2021 +0200
1.2 +++ b/libmem/lib/src/flexpage.cc Sat May 01 23:51:50 2021 +0200
1.3 @@ -61,6 +61,9 @@
1.4 page_addr = base_addr + page_offset;
1.5 }
1.6
1.7 +/* Decrement the usage counter, returning whether the flexpage is now no longer
1.8 + used. */
1.9 +
1.10 bool Flexpage::decrement()
1.11 {
1.12 if (_counter)
1.13 @@ -72,16 +75,22 @@
1.14 return 0;
1.15 }
1.16
1.17 +/* Increment the usage counter. */
1.18 +
1.19 void Flexpage::increment()
1.20 {
1.21 _counter++;
1.22 }
1.23
1.24 +/* Invalidate the flexpage, meaning that it should not now be in use. */
1.25 +
1.26 void Flexpage::invalidate()
1.27 {
1.28 _counter = 0;
1.29 }
1.30
1.31 +/* Return whether the flexpage is in use and is therefore valid. */
1.32 +
1.33 bool Flexpage::valid()
1.34 {
1.35 return _counter != 0;
2.1 --- a/libmem/lib/src/memory_incremental.cc Sat May 01 23:51:28 2021 +0200
2.2 +++ b/libmem/lib/src/memory_incremental.cc Sat May 01 23:51:50 2021 +0200
2.3 @@ -23,6 +23,8 @@
2.4
2.5 #include <stdlib.h>
2.6
2.7 +
2.8 +
2.9 /* Initialise the memory pool with an optional 'limit' in pages. */
2.10
2.11 MemoryIncremental::MemoryIncremental(unsigned int limit, offset_t region_size)
2.12 @@ -87,6 +89,9 @@
2.13 return NULL;
2.14 }
2.15
2.16 +/* Allocate a new region having the default region size rounded to the nearest
2.17 + page. */
2.18 +
2.19 Region *MemoryIncremental::region()
2.20 {
2.21 return region(_region_size);