2012-11-15 00:39:56 +01:00
|
|
|
#include "stdafx.h"
|
|
|
|
|
#include "Emu/SysCalls/SysCalls.h"
|
2013-06-30 10:46:29 +02:00
|
|
|
#include "Loader/ELF.h"
|
2012-11-15 00:39:56 +01:00
|
|
|
|
|
|
|
|
SysCallBase sc_spu("sys_spu");
|
|
|
|
|
|
|
|
|
|
struct sys_spu_thread_group_attribute
|
|
|
|
|
{
|
|
|
|
|
u32 name_len;
|
|
|
|
|
u32 name_addr;
|
|
|
|
|
int type;
|
|
|
|
|
union{u32 ct;} option;
|
|
|
|
|
};
|
|
|
|
|
|
2013-06-30 10:46:29 +02:00
|
|
|
struct sys_spu_image
|
|
|
|
|
{
|
|
|
|
|
u32 type;
|
|
|
|
|
u32 entry_point;
|
|
|
|
|
u32 segs_addr;
|
|
|
|
|
int nsegs;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
u32 LoadImage(vfsStream& stream)
|
|
|
|
|
{
|
|
|
|
|
ELFLoader l(stream);
|
|
|
|
|
l.LoadInfo();
|
|
|
|
|
l.LoadData(Memory.MainMem.Alloc(stream.GetSize()));
|
|
|
|
|
|
|
|
|
|
return l.GetEntry();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int sys_spu_image_open(u32 img_addr, u32 path_addr)
|
|
|
|
|
{
|
|
|
|
|
const wxString& path = Memory.ReadString(path_addr);
|
|
|
|
|
sc_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img_addr, path_addr, path);
|
|
|
|
|
|
|
|
|
|
vfsLocalFile stream(path);
|
|
|
|
|
LoadImage(stream);
|
|
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-15 00:39:56 +01:00
|
|
|
//170
|
|
|
|
|
int sys_spu_thread_group_create(u64 id_addr, u32 num, int prio, u64 attr_addr)
|
|
|
|
|
{
|
|
|
|
|
ConLog.Write("sys_spu_thread_group_create:");
|
|
|
|
|
ConLog.Write("*** id_addr=0x%llx", id_addr);
|
|
|
|
|
ConLog.Write("*** num=%d", num);
|
|
|
|
|
ConLog.Write("*** prio=%d", prio);
|
|
|
|
|
ConLog.Write("*** attr_addr=0x%llx", attr_addr);
|
|
|
|
|
|
|
|
|
|
sys_spu_thread_group_attribute& attr = *new sys_spu_thread_group_attribute(*(sys_spu_thread_group_attribute*)&Memory[attr_addr]);
|
|
|
|
|
|
|
|
|
|
ConLog.Write("*** attr.name_len=%d", re(attr.name_len));
|
|
|
|
|
ConLog.Write("*** attr.name_addr=0x%x", re(attr.name_addr));
|
|
|
|
|
ConLog.Write("*** attr.type=%d", re(attr.type));
|
|
|
|
|
ConLog.Write("*** attr.option.ct=%d", re(attr.option.ct));
|
|
|
|
|
|
|
|
|
|
const wxString& name = Memory.ReadString(re(attr.name_addr), re(attr.name_len));
|
|
|
|
|
ConLog.Write("*** name='%s'", name);
|
|
|
|
|
|
|
|
|
|
Memory.Write32(id_addr,
|
|
|
|
|
Emu.GetIdManager().GetNewID(wxString::Format("sys_spu_thread_group %s", name), &attr, 0));
|
|
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int sys_spu_thread_create(u64 thread_id_addr, u64 entry_addr, u64 arg,
|
|
|
|
|
int prio, u32 stacksize, u64 flags, u64 threadname_addr)
|
|
|
|
|
{
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//160
|
|
|
|
|
int sys_raw_spu_create(u32 id_addr, u32 attr_addr)
|
|
|
|
|
{
|
2013-06-30 10:46:29 +02:00
|
|
|
sc_spu.Warning("sys_raw_spu_create(id_addr=0x%x, attr_addr=0x%x)", id_addr, attr_addr);
|
2012-11-15 00:39:56 +01:00
|
|
|
|
2013-06-30 10:46:29 +02:00
|
|
|
//PPCThread& new_thread = Emu.GetCPU().AddThread(false);
|
|
|
|
|
//Emu.GetIdManager().GetNewID("sys_raw_spu", new u32(attr_addr));
|
|
|
|
|
//Memory.Write32(id_addr, Emu.GetCPU().GetThreadNumById(false, new_thread.GetId()));
|
2012-11-15 00:39:56 +01:00
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//169
|
|
|
|
|
int sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu)
|
|
|
|
|
{
|
2013-06-30 10:46:29 +02:00
|
|
|
sc_spu.Warning("sys_spu_initialize(max_usable_spu=%d, max_raw_spu=%d)", max_usable_spu, max_raw_spu);
|
2012-11-15 00:39:56 +01:00
|
|
|
|
|
|
|
|
if(!Memory.InitSpuRawMem(max_raw_spu))
|
|
|
|
|
{
|
|
|
|
|
return CELL_UNKNOWN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return CELL_OK;
|
|
|
|
|
}
|