PPU Loader: Fixup stack alignment after envp fix
This commit is contained in:
@@ -2337,13 +2337,13 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str
|
|||||||
if (!Emu.data.empty())
|
if (!Emu.data.empty())
|
||||||
{
|
{
|
||||||
std::memcpy(vm::base(ppu->stack_addr + ppu->stack_size - ::size32(Emu.data)), Emu.data.data(), Emu.data.size());
|
std::memcpy(vm::base(ppu->stack_addr + ppu->stack_size - ::size32(Emu.data)), Emu.data.data(), Emu.data.size());
|
||||||
ppu->gpr[1] -= Emu.data.size();
|
ppu->gpr[1] -= utils::align<u32>(::size32(Emu.data), 0x10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize process arguments
|
// Initialize process arguments
|
||||||
|
|
||||||
// Calculate storage requirements on the stack
|
// Calculate storage requirements on the stack
|
||||||
const u32 pointers_storage_size = u32{sizeof(u64)} * (::size32(Emu.envp) + ::size32(Emu.argv) + 3);
|
const u32 pointers_storage_size = u32{sizeof(u64)} * utils::align<u32>(::size32(Emu.envp) + ::size32(Emu.argv) + 2, 2);
|
||||||
|
|
||||||
u32 stack_alloc_size = pointers_storage_size;
|
u32 stack_alloc_size = pointers_storage_size;
|
||||||
|
|
||||||
@@ -2376,7 +2376,7 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str
|
|||||||
|
|
||||||
*args++ = 0;
|
*args++ = 0;
|
||||||
|
|
||||||
const vm::ptr<u64> envp = vm::cast(utils::align<u32>(args.addr(), 8));
|
const vm::ptr<u64> envp = args;
|
||||||
args = envp;
|
args = envp;
|
||||||
|
|
||||||
for (const auto& arg : Emu.envp)
|
for (const auto& arg : Emu.envp)
|
||||||
@@ -2391,8 +2391,6 @@ bool ppu_load_exec(const ppu_exec_object& elf, bool virtual_load, const std::str
|
|||||||
|
|
||||||
*args++ = 0;
|
*args++ = 0;
|
||||||
|
|
||||||
*args++ = 0; // Unknown
|
|
||||||
|
|
||||||
ppu->gpr[1] -= stack_alloc_size;
|
ppu->gpr[1] -= stack_alloc_size;
|
||||||
|
|
||||||
ensure(g_fxo->get<lv2_memory_container>().take(primary_stacksize));
|
ensure(g_fxo->get<lv2_memory_container>().take(primary_stacksize));
|
||||||
|
|||||||
Reference in New Issue
Block a user