paul@0 | 1 | #pragma once |
paul@0 | 2 | |
paul@0 | 3 | #include "memory_utils.h" |
paul@0 | 4 | #include "region.h" |
paul@0 | 5 | #include "send_flexpage.h" |
paul@0 | 6 | |
paul@0 | 7 | |
paul@0 | 8 | |
paul@0 | 9 | /* A flexpage abstraction. */ |
paul@0 | 10 | |
paul@0 | 11 | class Flexpage |
paul@0 | 12 | { |
paul@0 | 13 | protected: |
paul@0 | 14 | unsigned int _counter; |
paul@54 | 15 | flags_t _flags; |
paul@0 | 16 | |
paul@0 | 17 | public: |
paul@0 | 18 | Region *region; |
paul@0 | 19 | |
paul@0 | 20 | /* General flexpage characteristics. */ |
paul@0 | 21 | |
paul@0 | 22 | offset_t base_addr, size; |
paul@0 | 23 | offset_t base_offset; |
paul@0 | 24 | |
paul@0 | 25 | /* Transient debugging information. */ |
paul@0 | 26 | |
paul@0 | 27 | offset_t page_addr, page_offset; |
paul@0 | 28 | |
paul@0 | 29 | /* Associate a flexpage with a memory 'region'. */ |
paul@0 | 30 | |
paul@0 | 31 | explicit Flexpage(Region *region) : region(region) |
paul@0 | 32 | { |
paul@0 | 33 | } |
paul@0 | 34 | |
paul@0 | 35 | void reset(offset_t offset); |
paul@0 | 36 | |
paul@0 | 37 | bool decrement(); |
paul@0 | 38 | |
paul@0 | 39 | void increment(); |
paul@0 | 40 | |
paul@0 | 41 | void invalidate(); |
paul@0 | 42 | |
paul@0 | 43 | bool valid(); |
paul@0 | 44 | |
paul@0 | 45 | bool supports_position(offset_t position); |
paul@0 | 46 | |
paul@54 | 47 | void upgrade(flags_t flags); |
paul@11 | 48 | |
paul@86 | 49 | SendFlexpage to_send(offset_t offset, offset_t hot_spot, flags_t flags, |
paul@86 | 50 | offset_t max_offset=0); |
paul@0 | 51 | |
paul@0 | 52 | SendFlexpage to_unmap(); |
paul@0 | 53 | }; |
paul@0 | 54 | |
paul@0 | 55 | // vim: tabstop=4 expandtab shiftwidth=4 |