bool ELF32Loader::LoadPhdrInfo() { if(ehdr.e_phoff == 0 && ehdr.e_phnum) { ConLog.Error("LoadPhdr32 error: Program header offset is null!"); return false; } elf32_f.Seek(ehdr.e_phoff); for(uint i=0; i<ehdr.e_phnum; ++i) { Elf32_Phdr* phdr = new Elf32_Phdr(); phdr->Load(elf32_f); phdr_arr.Move(phdr); } return true; }
bool ELF32Loader::LoadPhdrInfo() { if(ehdr.e_phoff == 0 && ehdr.e_phnum) { ConLog.Error("LoadPhdr32 error: Program header offset is null!"); return false; } elf32_f.Seek(ehdr.e_phoff); for(uint i=0; i<ehdr.e_phnum; ++i) { Elf32_Phdr* phdr = new Elf32_Phdr(); if(ehdr.IsLittleEndian()) phdr->LoadLE(elf32_f); else phdr->Load(elf32_f); phdr_arr.Move(phdr); } if(/*!Memory.IsGoodAddr(entry)*/ entry & 0x1) { //entry is physical, convert to virtual entry &= ~0x1; for(size_t i=0; i<phdr_arr.GetCount(); ++i) { if(phdr_arr[i].p_paddr >= entry && entry < phdr_arr[i].p_paddr + phdr_arr[i].p_memsz) { entry += phdr_arr[i].p_vaddr; ConLog.Warning("virtual entry = 0x%x", entry); break; } } } return true; }