mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 08:21:29 +12:00
SPU
Implemented sys_raw_spu_load, sys_raw_spu_image_load. Minor review of MFC, channels.
This commit is contained in:
parent
35257f5e94
commit
1ab5ef9dd7
4 changed files with 206 additions and 79 deletions
|
@ -1,6 +1,9 @@
|
|||
#include "stdafx.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/lv2/SC_SPU_Thread.h"
|
||||
#include "Loader/ELF.h"
|
||||
#include "Emu/Cell/RawSPUThread.h"
|
||||
|
||||
void sysPrxForUser_init();
|
||||
Module sysPrxForUser("sysPrxForUser", sysPrxForUser_init);
|
||||
|
@ -59,7 +62,7 @@ int sys_spu_elf_get_segments(u32 elf_img, mem_ptr_t<sys_spu_segment> segments, i
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_spu_image_import(mem_ptr_t<sys_spu_image> img, u64 src, u32 type)
|
||||
int sys_spu_image_import(mem_ptr_t<sys_spu_image> img, u32 src, u32 type)
|
||||
{
|
||||
sysPrxForUser.Warning("sys_spu_image_import(img=0x%x, src=0x%x, type=0x%x)", img.GetAddr(), src, type);
|
||||
|
||||
|
@ -79,6 +82,41 @@ int sys_spu_image_import(mem_ptr_t<sys_spu_image> img, u64 src, u32 type)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_raw_spu_load(int id, u32 path_addr, mem32_t entry)
|
||||
{
|
||||
const wxString path = Memory.ReadString(path_addr).mb_str();
|
||||
sysPrxForUser.Warning("sys_raw_spu_load(id=0x%x, path=0x%x [%s], entry_addr=0x%x)",
|
||||
id, path_addr, path, entry.GetAddr());
|
||||
|
||||
vfsFile f(path.c_str());
|
||||
if(!f.IsOpened())
|
||||
{
|
||||
sysPrxForUser.Error("sys_raw_spu_load error: '%s' not found!", path);
|
||||
return CELL_ENOENT;
|
||||
}
|
||||
|
||||
ELFLoader l(f);
|
||||
l.LoadInfo();
|
||||
l.LoadData(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id);
|
||||
|
||||
entry = l.GetEntry();
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
extern u64 g_last_spu_offset;
|
||||
|
||||
int sys_raw_spu_image_load(int id, mem_ptr_t<sys_spu_image> img)
|
||||
{
|
||||
sysPrxForUser.Warning("sys_raw_spu_image_load(id=0x%x, img_addr=0x%x)", id, img.GetAddr());
|
||||
|
||||
memcpy(Memory + RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id, Memory + g_last_spu_offset, 256 * 1024);
|
||||
Memory.Write32(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * id + RAW_SPU_PROB_OFFSET + SPU_NPC_offs,
|
||||
img->entry_point - g_last_spu_offset);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
void sysPrxForUser_init()
|
||||
{
|
||||
sysPrxForUser.AddFunc(0x744680a2, sys_initialize_tls);
|
||||
|
@ -118,4 +156,7 @@ void sysPrxForUser_init()
|
|||
sysPrxForUser.AddFunc(0x1ed454ce, sys_spu_elf_get_information);
|
||||
sysPrxForUser.AddFunc(0xdb6b3250, sys_spu_elf_get_segments);
|
||||
sysPrxForUser.AddFunc(0xebe5f72f, sys_spu_image_import);
|
||||
|
||||
sysPrxForUser.AddFunc(0x893305fa, sys_raw_spu_load);
|
||||
sysPrxForUser.AddFunc(0xb995662e, sys_raw_spu_image_load);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue