diff --git a/relocator/src/ModuleDataPersistence.cpp b/relocator/src/ModuleDataPersistence.cpp index 07f78b3..794b1ea 100644 --- a/relocator/src/ModuleDataPersistence.cpp +++ b/relocator/src/ModuleDataPersistence.cpp @@ -26,6 +26,8 @@ bool ModuleDataPersistence::saveModuleData(module_information_t * moduleInformat module_data->bssSize = module->getBSSSize(); module_data->sbssAddr = module->getSBSSAddr(); module_data->sbssSize = module->getSBSSSize(); + module_data->address = module->getAddress(); + module_data->size = module->getSize(); module_data->entrypoint = module->getEntrypoint(); @@ -63,6 +65,8 @@ std::vector ModuleDataPersistence::loadModuleData(module_informatio moduleData->setBSSLocation(module_data->bssAddr, module_data->bssSize); moduleData->setSBSSLocation(module_data->sbssAddr, module_data->sbssSize); moduleData->setEntrypoint(module_data->entrypoint); + moduleData->setAddress(module_data->address); + moduleData->setSize(module_data->size); for(uint32_t j = 0; j < DYN_LINK_RELOCATION_LIST_LENGTH; j++) { dyn_linking_relocation_entry_t * linking_entry = &(module_data->linking_entries[j]); diff --git a/source/common/module_defines.h b/source/common/module_defines.h index f14e5df..6162b13 100644 --- a/source/common/module_defines.h +++ b/source/common/module_defines.h @@ -40,6 +40,8 @@ struct module_information_single_t { uint32_t sbssAddr; uint32_t sbssSize; uint32_t entrypoint; + uint32_t address; + uint32_t size; }; #define MAXIMUM_MODULES 8 diff --git a/source/module/ModuleData.h b/source/module/ModuleData.h index 41b9a77..59da3c1 100644 --- a/source/module/ModuleData.h +++ b/source/module/ModuleData.h @@ -48,6 +48,14 @@ public: this->entrypoint = addr; } + void setAddress(uint32_t addr) { + this->address = addr; + } + + void setSize(uint32_t size) { + this->size = size; + } + void addRelocationData(RelocationData * relocation_data) { relocation_data_list.push_back(relocation_data); } @@ -76,6 +84,14 @@ public: return entrypoint; } + uint32_t getAddress() { + return address; + } + + uint32_t getSize() { + return address; + } + std::string toString(); private: std::vector relocation_data_list; @@ -84,5 +100,7 @@ private: uint32_t bssSize = 0; uint32_t sbssAddr = 0; uint32_t sbssSize = 0; + uint32_t address = 0; + uint32_t size = 0; uint32_t entrypoint = 0; }; diff --git a/source/module/ModuleDataFactory.cpp b/source/module/ModuleDataFactory.cpp index 362357c..d70be0f 100644 --- a/source/module/ModuleDataFactory.cpp +++ b/source/module/ModuleDataFactory.cpp @@ -133,6 +133,8 @@ ModuleData * ModuleDataFactory::load(std::string path, uint32_t destination_addr free(destinations); moduleData->setEntrypoint(entrypoint); + moduleData->setAddress(destination_address); + moduleData->setSize(totalSize); DEBUG_FUNCTION_LINE("Saved entrypoint as %08X", entrypoint); return moduleData; diff --git a/source/module/ModuleDataPersistence.cpp b/source/module/ModuleDataPersistence.cpp index b4990b1..9808db4 100644 --- a/source/module/ModuleDataPersistence.cpp +++ b/source/module/ModuleDataPersistence.cpp @@ -30,6 +30,8 @@ bool ModuleDataPersistence::saveModuleData(module_information_t * moduleInformat module_data->bssSize = module->getBSSSize(); module_data->sbssAddr = module->getSBSSAddr(); module_data->sbssSize = module->getSBSSSize(); + module_data->address = module->getAddress(); + module_data->size = module->getSize(); module_data->entrypoint = module->getEntrypoint(); @@ -66,6 +68,8 @@ std::vector ModuleDataPersistence::loadModuleData(module_informatio moduleData->setBSSLocation(module_data->bssAddr, module_data->bssSize); moduleData->setSBSSLocation(module_data->sbssAddr, module_data->sbssSize); moduleData->setEntrypoint(module_data->entrypoint); + moduleData->setAddress(module_data->address); + moduleData->setSize(module_data->size); for(uint32_t j = 0; j < DYN_LINK_RELOCATION_LIST_LENGTH; j++) { dyn_linking_relocation_entry_t * linking_entry = &(module_data->linking_entries[j]);