Fix SPU ELF loader

This commit is contained in:
Eladash 2020-12-22 15:21:49 +02:00 committed by Ivan
parent 0055d84bd6
commit 72e6e87d82

View File

@ -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<named_thread<spu_thread>>("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<void>(prog.p_vaddr), prog.bin.data(), prog.p_filesz);
}
}
auto spu = idm::make_ptr<named_thread<spu_thread>>("TEST_SPU", nullptr, 0, "", 0);
spu_thread::g_raw_spu_id[0] = spu->id;
spu->status_npc = {SPU_STATUS_RUNNING, elf.header.e_entry};