NativeNaturalType getSize(NativeNaturalType index) const { NativeNaturalType size = 0; Storage::bitwiseCopy<-1>(reinterpret_cast<NativeNaturalType*>(&size), reinterpret_cast<const NativeNaturalType*>(this), 0, getSizeOffset()+index*getSizeBits(), getSizeBits()); return size; }
void generateStats(struct Stats& stats) { stats.uninhabitable += getPadding(); stats.totalMetaData += bitsPerPage-getPadding()-getDataBits()*getMaxCount(); stats.inhabitedMetaData += (getSizeBits()+architectureSize)*header.count; stats.totalPayload += getDataBits()*getMaxCount(); stats.inhabitedPayload += getDataBits()*header.count; }
uv_err_t UVDElfRelocation::applyRelocationsForWrite() { printf_elf_relocation_debug("relocation: applying relocation for write\n"); //The two r_info parts { UVDElfSymbol *symbol = NULL; UVDElfSymbolSectionHeaderEntry *sectionHeader = NULL; uint32_t symbolIndex = 0; uv_assert_err_ret(getElfSymbol(&symbol)); sectionHeader = symbol->m_symbolSectionHeader; uv_assert_ret(sectionHeader); uv_assert_err_ret(sectionHeader->getSymbolIndex(symbol, &symbolIndex)); printf_elf_relocation_debug("symbol: %s, index: %d\n", symbol->m_sName.c_str(), symbolIndex); //What does this comment mean? What is the real object? //Might help later to update the real object m_relocation.r_info = ELF32_R_INFO(symbolIndex, ELF32_R_TYPE(m_relocation.r_info)); } uv_assert_err_ret(updateRelocationTypeByBits(getSizeBits())); //r_offset { uint32_t elfSymbolFileOffset = 0; //uv_assert_err_ret(getFileOffset(&elfSymbolFileOffset)); //Absolute relocation is applied at the offset + local offset to make a full offset //FIXME: ...or not since it seems this is being set to 0 m_relocation.r_offset = elfSymbolFileOffset + m_offset; } ELF_RELOCATION_DEBUG(m_headerEntryRelocatableData.hexdump()); return UV_ERR_OK; }
NativeNaturalType getPadding() const { return getDataOffset()-(getSizeOffset()+getSizeBits()*getMaxCount()); }
NativeNaturalType getMaxCount() const { return (bitsPerPage-getSizeOffset())/(getSizeBits()+architectureSize+getDataBits()); }
void setSize(NativeNaturalType index, NativeNaturalType size) { Storage::bitwiseCopy<-1>(reinterpret_cast<NativeNaturalType*>(this), reinterpret_cast<const NativeNaturalType*>(&size), getSizeOffset()+index*getSizeBits(), 0, getSizeBits()); }