1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/mapping/flexpage.h Thu Apr 01 00:57:43 2021 +0200
1.3 @@ -0,0 +1,54 @@
1.4 +#pragma once
1.5 +
1.6 +#include "memory_utils.h"
1.7 +#include "region.h"
1.8 +#include "send_flexpage.h"
1.9 +
1.10 +
1.11 +
1.12 +/* A flexpage abstraction. */
1.13 +
1.14 +class Flexpage
1.15 +{
1.16 +protected:
1.17 + unsigned int _counter;
1.18 + flags_t _flags;
1.19 +
1.20 +public:
1.21 + Region *region;
1.22 +
1.23 + /* General flexpage characteristics. */
1.24 +
1.25 + offset_t base_addr, size;
1.26 + offset_t base_offset;
1.27 +
1.28 + /* Transient debugging information. */
1.29 +
1.30 + offset_t page_addr, page_offset;
1.31 +
1.32 + /* Associate a flexpage with a memory 'region'. */
1.33 +
1.34 + explicit Flexpage(Region *region) : region(region)
1.35 + {
1.36 + }
1.37 +
1.38 + void reset(offset_t offset);
1.39 +
1.40 + bool decrement();
1.41 +
1.42 + void increment();
1.43 +
1.44 + void invalidate();
1.45 +
1.46 + bool valid();
1.47 +
1.48 + bool supports_position(offset_t position);
1.49 +
1.50 + void upgrade(flags_t flags);
1.51 +
1.52 + SendFlexpage to_send(offset_t offset, offset_t hot_spot, offset_t max_offset=0);
1.53 +
1.54 + SendFlexpage to_unmap();
1.55 +};
1.56 +
1.57 +// vim: tabstop=4 expandtab shiftwidth=4