/*! This method makes an Address. * \param Base is the base address. * \param Offset is the offset address. * \return Returns a shared pointer to a new Address with correct information if base and offset are associated to a memory area, otherwise it returns an empty shared pointer Address. */ Address MakeAddress(TBase Base, TOffset Offset) const { MemoryArea const* ma = GetMemoryArea(Address(Base, Offset)); if (ma == NULL) return Address(); return ma->MakeAddress(Offset); }
Address Document::MakeAddress(TBase Base, TOffset Offset) const { MemoryArea const* pMemArea = GetMemoryArea(Address(Base, Offset)); if (pMemArea == nullptr) return Address(); return pMemArea->MakeAddress(Offset); }
bool Document::ConvertAddressToFileOffset(Address const& rAddr, TOffset& rFileOffset) const { MemoryArea const* pMemoryArea = GetMemoryArea(rAddr); if (pMemoryArea == nullptr) return false; return pMemoryArea->ConvertOffsetToFileOffset(rAddr.GetOffset(), rFileOffset); }
Tag Document::GetArchitectureTag(Address const& rAddress) const { Tag ArchTag = MEDUSA_ARCH_UNK; auto const spCell = GetCell(rAddress); if (spCell != nullptr) { ArchTag = spCell->GetArchitectureTag(); if (ArchTag != MEDUSA_ARCH_UNK) return ArchTag; } auto const pMemArea = GetMemoryArea(rAddress); if (pMemArea != nullptr) { ArchTag = pMemArea->GetArchitectureTag(); if (ArchTag != MEDUSA_ARCH_UNK) return ArchTag; } return ArchTag; }
u8 Document::GetMode(Address const& rAddress) const { u8 Mode = 0; auto const spCell = GetCell(rAddress); if (spCell != nullptr) { auto spCellArch = ModuleManager::Instance().GetArchitecture(spCell->GetArchitectureTag()); if (spCellArch != nullptr) { Mode = spCellArch->GetDefaultMode(rAddress); if (Mode != 0) return Mode; } Mode = spCell->GetMode(); if (Mode != 0) return Mode; } auto const pMemArea = GetMemoryArea(rAddress); if (pMemArea != nullptr) { auto spMemAreaArch = ModuleManager::Instance().GetArchitecture(pMemArea->GetArchitectureTag()); if (spMemAreaArch != nullptr) { Mode = spMemAreaArch->GetDefaultMode(rAddress); if (Mode != 0) return Mode; } Mode = pMemArea->GetArchitectureMode(); if (Mode != 0) return Mode; } return Mode; }