1.1 --- a/libmem/include/mem/flexpage.h Fri May 20 00:40:27 2022 +0200
1.2 +++ b/libmem/include/mem/flexpage.h 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 @@ -21,6 +21,8 @@
1.13
1.14 #pragma once
1.15
1.16 +#include <list>
1.17 +
1.18 #include <mem/memory_utils.h>
1.19 #include <mem/region.h>
1.20 #include <mem/send_flexpage.h>
1.21 @@ -34,6 +36,16 @@
1.22
1.23
1.24
1.25 +/* Forward declaration. */
1.26 +
1.27 +class Flexpage;
1.28 +
1.29 +/* Employed data types. */
1.30 +
1.31 +typedef std::list<Flexpage *> DerivedFlexpages;
1.32 +
1.33 +
1.34 +
1.35 /* A flexpage abstraction. */
1.36
1.37 class Flexpage
1.38 @@ -45,6 +57,10 @@
1.39 public:
1.40 Region *region;
1.41
1.42 + /* Flexpage relationships to support masked regions. */
1.43 +
1.44 + DerivedFlexpages derived;
1.45 +
1.46 /* General flexpage characteristics. */
1.47
1.48 offset_t base_addr, size;
1.49 @@ -56,10 +72,13 @@
1.50
1.51 /* Associate a flexpage with a memory 'region'. */
1.52
1.53 - explicit Flexpage(Region *region) : region(region)
1.54 + explicit Flexpage(Region *region = NULL)
1.55 + : region(region)
1.56 {
1.57 }
1.58
1.59 + void set_region(Region *region);
1.60 +
1.61 void reset(offset_t offset);
1.62
1.63 bool decrement();
1.64 @@ -80,6 +99,12 @@
1.65 offset_t max_offset=0);
1.66
1.67 SendFlexpage to_unmap();
1.68 +
1.69 + /* Associate other flexpages with this flexpage. */
1.70 +
1.71 + void associate(Flexpage *flexpage);
1.72 +
1.73 + void disassociate();
1.74 };
1.75
1.76 // vim: tabstop=4 expandtab shiftwidth=4