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