| 1 | #ifndef ENVIRONMENT_DATA_SEGMENT_H |
|---|
| 2 | #define ENVIRONMENT_DATA_SEGMENT_H |
|---|
| 3 | |
|---|
| 4 | #include "../../../shared/soclib_segment_table.h" |
|---|
| 5 | #include "Type_target.h" |
|---|
| 6 | |
|---|
| 7 | #include <iomanip> |
|---|
| 8 | |
|---|
| 9 | extern "C" void loadexec(void **emem, int *esize, int *eoffset, const char *file, const char ** sections); |
|---|
| 10 | |
|---|
| 11 | namespace environment { |
|---|
| 12 | namespace data { |
|---|
| 13 | |
|---|
| 14 | class Segment |
|---|
| 15 | { |
|---|
| 16 | protected : std::string name; |
|---|
| 17 | |
|---|
| 18 | protected : uint32_t base; |
|---|
| 19 | protected : uint32_t index; |
|---|
| 20 | protected : uint32_t size; |
|---|
| 21 | protected : bool uncached; |
|---|
| 22 | protected : char * data; |
|---|
| 23 | protected : type_target_t type; |
|---|
| 24 | |
|---|
| 25 | public : Segment (void); |
|---|
| 26 | public : Segment (SEGMENT_TABLE_ENTRY * segment); |
|---|
| 27 | public : ~Segment (void); |
|---|
| 28 | |
|---|
| 29 | public : bool init (const char * filename, const char ** sections); |
|---|
| 30 | public : void define_target (type_target_t type, uint32_t index); |
|---|
| 31 | public : type_target_t getType (void); |
|---|
| 32 | public : uint32_t getIndex (void); |
|---|
| 33 | public : uint32_t getBase (void); |
|---|
| 34 | public : uint32_t getSize (void); |
|---|
| 35 | public : bool getUncached (void); |
|---|
| 36 | public : char * data_addr (void); |
|---|
| 37 | public : bool test (std::string name); |
|---|
| 38 | public : bool test (uint32_t address, uint32_t size); |
|---|
| 39 | public : void read (uint32_t address, uint32_t size, char * & data_dest); |
|---|
| 40 | public : void write (uint32_t address, uint32_t size, char * & data_src); |
|---|
| 41 | public : friend std::ostream& operator<< (std::ostream& output, Segment & x); |
|---|
| 42 | }; |
|---|
| 43 | |
|---|
| 44 | }; |
|---|
| 45 | }; |
|---|
| 46 | #endif |
|---|