1.1 --- a/libmem/lib/src/flexpage.cc Fri May 20 00:40:27 2022 +0200
1.2 +++ b/libmem/lib/src/flexpage.cc Fri May 20 22:54:36 2022 +0200
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * A flexpage abstraction.
1.6 *
1.7 - * Copyright (C) 2021 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2021, 2022 Paul Boddie <paul@boddie.org.uk>
1.9 *
1.10 * This program is free software; you can redistribute it and/or
1.11 * modify it under the terms of the GNU General Public License as
1.12 @@ -31,6 +31,9 @@
1.13
1.14 void Flexpage::reset(offset_t offset)
1.15 {
1.16 + if (region == NULL)
1.17 + return;
1.18 +
1.19 _counter = 0;
1.20
1.21 /* By definition (see "Flexible-Sized Page Objects - Object-Orientation
1.22 @@ -63,6 +66,13 @@
1.23 page_addr = base_addr + page_offset;
1.24 }
1.25
1.26 +/* Set a region. */
1.27 +
1.28 +void Flexpage::set_region(Region *region)
1.29 +{
1.30 + this->region = region;
1.31 +}
1.32 +
1.33 /* Decrement the usage counter, returning whether the flexpage is now no longer
1.34 used. */
1.35
1.36 @@ -179,4 +189,16 @@
1.37 return SendFlexpage(base_addr, page_order(size), _flags);
1.38 }
1.39
1.40 +/* Associate another flexpage with this flexpage. */
1.41 +
1.42 +void Flexpage::associate(Flexpage *flexpage)
1.43 +{
1.44 + derived.push_back(flexpage);
1.45 +}
1.46 +
1.47 +void Flexpage::disassociate()
1.48 +{
1.49 + derived.clear();
1.50 +}
1.51 +
1.52 // vim: tabstop=4 expandtab shiftwidth=4