From 72e6e87d822a6b1acd904313a4cf0f724f2bb52e Mon Sep 17 00:00:00 2001 From: Eladash Date: Tue, 22 Dec 2020 15:21:49 +0200 Subject: [PATCH] Fix SPU ELF loader --- rpcs3/Emu/Cell/RawSPUThread.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/rpcs3/Emu/Cell/RawSPUThread.cpp b/rpcs3/Emu/Cell/RawSPUThread.cpp index c78fb3f8c8..00776bd9e8 100644 --- a/rpcs3/Emu/Cell/RawSPUThread.cpp +++ b/rpcs3/Emu/Cell/RawSPUThread.cpp @@ -319,20 +319,18 @@ bool spu_thread::write_reg(const u32 addr, const u32 value) void spu_load_exec(const spu_exec_object& elf) { - auto ls0 = vm::addr_t{RAW_SPU_BASE_ADDR}; - spu_thread::g_raw_spu_ctr++; + auto spu = idm::make_ptr>("TEST_SPU", nullptr, 0, "", 0); + for (const auto& prog : elf.progs) { if (prog.p_type == 0x1u /* LOAD */ && prog.p_memsz) { - std::memcpy(vm::base(ls0 + prog.p_vaddr), prog.bin.data(), prog.p_filesz); + std::memcpy(spu->_ptr(prog.p_vaddr), prog.bin.data(), prog.p_filesz); } } - auto spu = idm::make_ptr>("TEST_SPU", nullptr, 0, "", 0); - spu_thread::g_raw_spu_id[0] = spu->id; spu->status_npc = {SPU_STATUS_RUNNING, elf.header.e_entry};