Copy sys_spu_segment info in SPU TG

No idea whether it fixes something or not
This commit is contained in:
Nekotekina 2017-08-27 02:57:41 +03:00
parent 834712bb58
commit f59a448f3f
3 changed files with 10 additions and 9 deletions

View file

@ -322,7 +322,7 @@ s32 sys_raw_spu_load(s32 id, vm::cptr<char> path, vm::ptr<u32> entry)
sys_spu_image img;
img.load(elf_file);
img.deploy(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id);
img.deploy(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id, img.segs.get_ptr(), img.nsegs);
img.free();
*entry = img.entry_point | 1;
@ -335,7 +335,7 @@ s32 sys_raw_spu_image_load(ppu_thread& ppu, s32 id, vm::ptr<sys_spu_image> img)
sysPrxForUser.warning("sys_raw_spu_image_load(id=%d, img=*0x%x)", id, img);
// Load SPU segments
img->deploy(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id);
img->deploy(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id, img->segs.get_ptr(), img->nsegs);
// Use MMIO
vm::write32(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id + RAW_SPU_PROB_OFFSET + SPU_NPC_offs, img->entry_point | 1);

View file

@ -66,7 +66,7 @@ void sys_spu_image::free()
}
}
void sys_spu_image::deploy(u32 loc)
void sys_spu_image::deploy(u32 loc, sys_spu_segment* segs, u32 nsegs)
{
// Segment info dump
std::string dump;
@ -76,7 +76,7 @@ void sys_spu_image::deploy(u32 loc)
sha1_starts(&sha);
u8 sha1_hash[20];
for (int i = 0; i < nsegs; i++)
for (u32 i = 0; i < nsegs; i++)
{
auto& seg = segs[i];
@ -232,7 +232,8 @@ error_code sys_spu_thread_initialize(vm::ptr<u32> thread, u32 group_id, u32 spu_
group->threads[spu_num] = std::move(spu);
group->args[spu_num] = {arg->arg1, arg->arg2, arg->arg3, arg->arg4};
group->imgs[spu_num] = *img;
group->imgs[spu_num] = std::make_pair(*img, std::vector<sys_spu_segment>());
group->imgs[spu_num].second.assign(img->segs.get_ptr(), img->segs.get_ptr() + img->nsegs);
if (++group->init == group->num)
{
@ -374,9 +375,9 @@ error_code sys_spu_thread_group_start(ppu_thread& ppu, u32 id)
auto& args = group->args[thread->index];
auto& img = group->imgs[thread->index];
img.deploy(thread->offset);
sys_spu_image::deploy(thread->offset, img.second.data(), img.first.nsegs);
thread->pc = img.entry_point;
thread->pc = img.first.entry_point;
thread->cpu_init();
thread->gpr[3] = v128::from64(0, args[0]);
thread->gpr[4] = v128::from64(0, args[1]);

View file

@ -182,7 +182,7 @@ struct sys_spu_image
void load(const fs::file& stream);
void free();
void deploy(u32 loc);
static void deploy(u32 loc, sys_spu_segment* segs, u32 nsegs);
};
enum : u32
@ -221,7 +221,7 @@ struct lv2_spu_group
cond_variable cv; // used to signal waiting PPU thread
std::array<std::shared_ptr<SPUThread>, 256> threads; // SPU Threads
std::array<sys_spu_image, 256> imgs; // SPU Images
std::array<std::pair<sys_spu_image, std::vector<sys_spu_segment>>, 256> imgs; // SPU Images
std::array<std::array<u64, 4>, 256> args; // SPU Thread Arguments
std::weak_ptr<lv2_event_queue> ep_run; // port for SYS_SPU_THREAD_GROUP_EVENT_RUN events