1 #pragma once 2 3 #include <systypes/base.h> 4 5 #include "types.h" 6 7 8 9 /* Region-related state information. */ 10 11 class RegionState 12 { 13 public: 14 unsigned long size; 15 fileid_t fileid; 16 offset_t filepos; 17 18 explicit RegionState(unsigned long size=0, fileid_t fileid=0, offset_t filepos=0); 19 20 void fill(fileid_t fileid, offset_t filepos); 21 22 bool valid() { return size != 0; } 23 }; 24 25 26 27 /* A memory region abstraction. */ 28 29 class Region 30 { 31 public: 32 offset_t start, end; 33 34 /* Debugging information. */ 35 36 RegionState state; 37 38 /* Methods. */ 39 40 explicit Region(offset_t start, offset_t end); 41 42 virtual ~Region(); 43 44 offset_t size(); 45 46 int compare(Region *other); 47 48 void fill(fileid_t fileid, offset_t filepos); 49 50 void flush(); 51 52 /* Simulation methods. */ 53 54 char *read(offset_t offset=0); 55 56 void write(const char *data, offset_t offset=0); 57 }; 58 59 // vim: tabstop=4 expandtab shiftwidth=4