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 address_t base_addr; 23 length_t size; 24 offset_t base_offset; 25 26 /* Transient debugging information. */ 27 28 address_t page_addr; 29 length_t page_offset; 30 31 /* Associate a flexpage with a memory 'region'. */ 32 33 explicit Flexpage(Region *region) : region(region) 34 { 35 } 36 37 void reset(offset_t offset); 38 39 bool decrement(); 40 41 void increment(); 42 43 void invalidate(); 44 45 bool valid(); 46 47 bool supports_position(offset_t position); 48 49 void upgrade(flags_t flags); 50 51 SendFlexpage to_send(offset_t offset, address_t hot_spot, flags_t flags, 52 offset_t max_offset=0); 53 54 SendFlexpage to_unmap(); 55 }; 56 57 // vim: tabstop=4 expandtab shiftwidth=4