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