Merge pull request #273 from artart78/master

Fixed the rest of the ELF issues
This commit is contained in:
Henrik Rydgård 2012-12-27 23:24:46 -08:00
commit 3fb9b62d17
3 changed files with 15 additions and 8 deletions

View File

@ -318,17 +318,20 @@ bool ElfReader::LoadInto(u32 loadAddress)
}
// Segment relocations (a few games use them)
for (int i=0; i<header->e_phnum; i++)
if (GetNumSections() == 0)
{
Elf32_Phdr *p = &segments[i];
if (p->p_type == 0x700000A0)
for (int i=0; i<header->e_phnum; i++)
{
INFO_LOG(LOADER,"Loading segment relocations");
Elf32_Phdr *p = &segments[i];
if (p->p_type == 0x700000A0)
{
INFO_LOG(LOADER,"Loading segment relocations");
int numRelocs = p->p_filesz / sizeof(Elf32_Rel);
int numRelocs = p->p_filesz / sizeof(Elf32_Rel);
Elf32_Rel *rels = (Elf32_Rel *)GetSegmentPtr(i);
LoadRelocations(rels, numRelocs);
Elf32_Rel *rels = (Elf32_Rel *)GetSegmentPtr(i);
LoadRelocations(rels, numRelocs);
}
}
}

View File

@ -105,6 +105,10 @@ public:
{
return segments[segment].p_offset;
}
u32 GetSegmentVaddr(int segment)
{
return segmentVAddr[segment];
}
bool DidRelocate() {
return bRelocate;

View File

@ -249,7 +249,7 @@ Module *__KernelLoadELFFromPtr(const u8 *ptr, u32 loadAddress, std::string *erro
if (sceModuleInfoSection != -1)
modinfo = (PspModuleInfo *)Memory::GetPointer(reader.GetSectionAddr(sceModuleInfoSection));
else
modinfo = (PspModuleInfo *)Memory::GetPointer(reader.GetVaddr() + (reader.GetSegmentPaddr(0) & 0x7FFFFFFF) - reader.GetSegmentOffset(0));
modinfo = (PspModuleInfo *)Memory::GetPointer(reader.GetSegmentVaddr(0) + (reader.GetSegmentPaddr(0) & 0x7FFFFFFF) - reader.GetSegmentOffset(0));
// Check for module blacklist - we don't allow games to load these modules from disc
// as we have HLE implementations and the originals won't run in the emu because they