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