Add the size and address to the ModuleData

This commit is contained in:
Maschell 2020-04-29 12:35:40 +02:00
parent ebf09003d3
commit 48b5f853e3
5 changed files with 30 additions and 0 deletions

View File

@ -26,6 +26,8 @@ bool ModuleDataPersistence::saveModuleData(module_information_t * moduleInformat
module_data->bssSize = module->getBSSSize(); module_data->bssSize = module->getBSSSize();
module_data->sbssAddr = module->getSBSSAddr(); module_data->sbssAddr = module->getSBSSAddr();
module_data->sbssSize = module->getSBSSSize(); module_data->sbssSize = module->getSBSSSize();
module_data->address = module->getAddress();
module_data->size = module->getSize();
module_data->entrypoint = module->getEntrypoint(); module_data->entrypoint = module->getEntrypoint();
@ -63,6 +65,8 @@ std::vector<ModuleData*> ModuleDataPersistence::loadModuleData(module_informatio
moduleData->setBSSLocation(module_data->bssAddr, module_data->bssSize); moduleData->setBSSLocation(module_data->bssAddr, module_data->bssSize);
moduleData->setSBSSLocation(module_data->sbssAddr, module_data->sbssSize); moduleData->setSBSSLocation(module_data->sbssAddr, module_data->sbssSize);
moduleData->setEntrypoint(module_data->entrypoint); 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++) { for(uint32_t j = 0; j < DYN_LINK_RELOCATION_LIST_LENGTH; j++) {
dyn_linking_relocation_entry_t * linking_entry = &(module_data->linking_entries[j]); dyn_linking_relocation_entry_t * linking_entry = &(module_data->linking_entries[j]);

View File

@ -40,6 +40,8 @@ struct module_information_single_t {
uint32_t sbssAddr; uint32_t sbssAddr;
uint32_t sbssSize; uint32_t sbssSize;
uint32_t entrypoint; uint32_t entrypoint;
uint32_t address;
uint32_t size;
}; };
#define MAXIMUM_MODULES 8 #define MAXIMUM_MODULES 8

View File

@ -48,6 +48,14 @@ public:
this->entrypoint = addr; this->entrypoint = addr;
} }
void setAddress(uint32_t addr) {
this->address = addr;
}
void setSize(uint32_t size) {
this->size = size;
}
void addRelocationData(RelocationData * relocation_data) { void addRelocationData(RelocationData * relocation_data) {
relocation_data_list.push_back(relocation_data); relocation_data_list.push_back(relocation_data);
} }
@ -76,6 +84,14 @@ public:
return entrypoint; return entrypoint;
} }
uint32_t getAddress() {
return address;
}
uint32_t getSize() {
return address;
}
std::string toString(); std::string toString();
private: private:
std::vector<RelocationData *> relocation_data_list; std::vector<RelocationData *> relocation_data_list;
@ -84,5 +100,7 @@ private:
uint32_t bssSize = 0; uint32_t bssSize = 0;
uint32_t sbssAddr = 0; uint32_t sbssAddr = 0;
uint32_t sbssSize = 0; uint32_t sbssSize = 0;
uint32_t address = 0;
uint32_t size = 0;
uint32_t entrypoint = 0; uint32_t entrypoint = 0;
}; };

View File

@ -133,6 +133,8 @@ ModuleData * ModuleDataFactory::load(std::string path, uint32_t destination_addr
free(destinations); free(destinations);
moduleData->setEntrypoint(entrypoint); moduleData->setEntrypoint(entrypoint);
moduleData->setAddress(destination_address);
moduleData->setSize(totalSize);
DEBUG_FUNCTION_LINE("Saved entrypoint as %08X", entrypoint); DEBUG_FUNCTION_LINE("Saved entrypoint as %08X", entrypoint);
return moduleData; return moduleData;

View File

@ -30,6 +30,8 @@ bool ModuleDataPersistence::saveModuleData(module_information_t * moduleInformat
module_data->bssSize = module->getBSSSize(); module_data->bssSize = module->getBSSSize();
module_data->sbssAddr = module->getSBSSAddr(); module_data->sbssAddr = module->getSBSSAddr();
module_data->sbssSize = module->getSBSSSize(); module_data->sbssSize = module->getSBSSSize();
module_data->address = module->getAddress();
module_data->size = module->getSize();
module_data->entrypoint = module->getEntrypoint(); module_data->entrypoint = module->getEntrypoint();
@ -66,6 +68,8 @@ std::vector<ModuleData*> ModuleDataPersistence::loadModuleData(module_informatio
moduleData->setBSSLocation(module_data->bssAddr, module_data->bssSize); moduleData->setBSSLocation(module_data->bssAddr, module_data->bssSize);
moduleData->setSBSSLocation(module_data->sbssAddr, module_data->sbssSize); moduleData->setSBSSLocation(module_data->sbssAddr, module_data->sbssSize);
moduleData->setEntrypoint(module_data->entrypoint); 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++) { for(uint32_t j = 0; j < DYN_LINK_RELOCATION_LIST_LENGTH; j++) {
dyn_linking_relocation_entry_t * linking_entry = &(module_data->linking_entries[j]); dyn_linking_relocation_entry_t * linking_entry = &(module_data->linking_entries[j]);