1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-26 04:32:35 +01:00
This commit is contained in:
Nekotekina 2013-11-30 03:40:50 +04:00
commit f0946c4bc8
6 changed files with 11 additions and 1 deletions

View File

@ -185,7 +185,8 @@ void Emulator::Load()
ConLog.Write("max addr = 0x%x", l.GetMaxAddr()); ConLog.Write("max addr = 0x%x", l.GetMaxAddr());
thread.SetOffset(Memory.MainMem.GetStartAddr()); thread.SetOffset(Memory.MainMem.GetStartAddr());
Memory.MainMem.Alloc(Memory.MainMem.GetStartAddr() + l.GetMaxAddr(), 0xFFFFED - l.GetMaxAddr()); Memory.MainMem.Alloc(Memory.MainMem.GetStartAddr() + l.GetMaxAddr(), 0xFFFFED - l.GetMaxAddr());
thread.SetEntry(l.GetEntry() - Memory.MainMem.GetStartAddr()); //thread.SetEntry(l.GetEntry() - Memory.MainMem.GetStartAddr());
thread.SetEntry(l.GetTextEntry());
break; break;
case MACHINE_PPC64: case MACHINE_PPC64:

View File

@ -27,6 +27,7 @@ bool ELFLoader::LoadInfo()
entry = loader->GetEntry(); entry = loader->GetEntry();
machine = loader->GetMachine(); machine = loader->GetMachine();
_text_section_offset = loader->GetTextEntry();
return true; return true;
} }

View File

@ -135,6 +135,8 @@ bool ELF32Loader::LoadShdrInfo()
name += c; name += c;
} }
shdr_name_arr.Add(name); shdr_name_arr.Add(name);
if(name == ".text") //temporary solution for SPU ELF loading
_text_section_offset = shdr_arr[i].sh_offset;
} }
return true; return true;

View File

@ -186,6 +186,8 @@ bool ELF64Loader::LoadShdrInfo(s64 offset)
} }
shdr_name_arr.Add(name); shdr_name_arr.Add(name);
if(name == ".text")
_text_section_offset = shdr_arr[i].sh_offset;
} }
return true; return true;

View File

@ -147,6 +147,7 @@ bool Loader::Analyze()
machine = m_loader->GetMachine(); machine = m_loader->GetMachine();
entry = m_loader->GetMachine() == MACHINE_SPU ? m_loader->GetEntry() + g_spu_offset : m_loader->GetEntry(); entry = m_loader->GetMachine() == MACHINE_SPU ? m_loader->GetEntry() + g_spu_offset : m_loader->GetEntry();
_text_section_offset = m_loader->GetTextEntry();
return true; return true;
} }

View File

@ -181,12 +181,14 @@ protected:
u32 min_addr; u32 min_addr;
u32 max_addr; u32 max_addr;
Elf_Machine machine; Elf_Machine machine;
u32 _text_section_offset;
LoaderBase() LoaderBase()
: machine(MACHINE_Unknown) : machine(MACHINE_Unknown)
, entry(0) , entry(0)
, min_addr(0) , min_addr(0)
, max_addr(0) , max_addr(0)
, _text_section_offset(0)
{ {
} }
@ -196,6 +198,7 @@ public:
Elf_Machine GetMachine() { return machine; } Elf_Machine GetMachine() { return machine; }
u32 GetEntry() { return entry; } u32 GetEntry() { return entry; }
u32 GetTextEntry() { return _text_section_offset; }
u32 GetMinAddr() { return min_addr; } u32 GetMinAddr() { return min_addr; }
u32 GetMaxAddr() { return min_addr; } u32 GetMaxAddr() { return min_addr; }
}; };