1.1 --- a/libmem/lib/src/flexpage.cc Tue Mar 28 19:01:14 2023 +0200
1.2 +++ b/libmem/lib/src/flexpage.cc Wed Mar 29 00:32:20 2023 +0200
1.3 @@ -1,7 +1,7 @@
1.4 /*
1.5 * A flexpage abstraction.
1.6 *
1.7 - * Copyright (C) 2021, 2022 Paul Boddie <paul@boddie.org.uk>
1.8 + * Copyright (C) 2021, 2022, 2023 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 @@ -22,6 +22,7 @@
1.13 #include <algorithm>
1.14
1.15 #include "flexpage.h"
1.16 +#include "ipc.h"
1.17
1.18
1.19
1.20 @@ -99,11 +100,17 @@
1.21 _counter++;
1.22 }
1.23
1.24 -/* Invalidate the flexpage, meaning that it should not now be in use. */
1.25 +/* Unmap and invalidate the flexpage, meaning that it should not now be in
1.26 + use. */
1.27
1.28 void Flexpage::invalidate()
1.29 {
1.30 _counter = 0;
1.31 + ipc_unmap_flexpage(this);
1.32 +
1.33 + /* Unmap and invalidate all derived flexpages. */
1.34 +
1.35 + disassociate();
1.36 }
1.37
1.38 /* Return whether the flexpage is in use and is therefore valid. */
1.39 @@ -205,8 +212,15 @@
1.40 derived.push_back(flexpage);
1.41 }
1.42
1.43 +/* Invalidate and unmap all derived flexpages. */
1.44 +
1.45 void Flexpage::disassociate()
1.46 {
1.47 + DerivedFlexpages::iterator it;
1.48 +
1.49 + for (it = derived.begin(); it != derived.end(); it++)
1.50 + (*it)->invalidate();
1.51 +
1.52 derived.clear();
1.53 }
1.54