Removed external functions from SysCalls.h

* Replace `int` with `s32` as return type for syscalls.
* Renamed `SC_Something.*` files with the proper lv2 name
`sys_something.*`.
* Moving away from the lv2, those functions and folders that doesn't
correspond to lv2 functions. E.g. module functions from sys_io,
sysPrxForUser, cellGcmSys.
* Splitted some files (memory -> memory+mmapper) and merged other ones
(event+event_flag ->event, spu+spu_thread -> spu), according to common
sense, PSDevWiki docs, and checking firmware files.
* Removed external functions from `SysCalls.h`.

NOTE: What should we do about: cellGcmCallback? It's not a lv2 syscall
but it appears on the sc_table and it is actually called in games. Is
this some kind of hack?
This commit is contained in:
Alexandro Sánchez Bach 2014-06-25 00:38:34 +02:00
parent 7218ccfe66
commit 08d61163ea
73 changed files with 2243 additions and 968 deletions

View file

@ -7,7 +7,7 @@
#include "Emu/SysCalls/Modules.h"
#include "Emu/FS/vfsFile.h"
#include "Emu/FS/vfsStreamMemory.h"
#include "Emu/SysCalls/lv2/SC_SPU_Thread.h"
#include "Emu/SysCalls/lv2/sys_spu.h"
#include "Loader/ELF.h"
#include "Emu/Cell/RawSPUThread.h"
@ -15,6 +15,49 @@
//Module sysPrxForUser("sysPrxForUser", sysPrxForUser_init);
Module *sysPrxForUser = nullptr;
struct HeapInfo
{
u32 heap_addr;
u32 align;
u32 size;
HeapInfo(u32 _heap_addr, u32 _align, u32 _size)
: heap_addr(_heap_addr)
, align(_align)
, size(_size)
{
}
};
int sys_heap_create_heap(const u32 heap_addr, const u32 align, const u32 size)
{
sysPrxForUser->Warning("sys_heap_create_heap(heap_addr=0x%x, align=0x%x, size=0x%x)", heap_addr, align, size);
u32 heap_id = sysPrxForUser->GetNewId(new HeapInfo(heap_addr, align, size));
sysPrxForUser->Warning("*** sys_heap created: id = %d", heap_id);
return heap_id;
}
int sys_heap_malloc(const u32 heap_id, const u32 size)
{
sysPrxForUser->Warning("sys_heap_malloc(heap_id=%d, size=0x%x)", heap_id, size);
HeapInfo* heap;
if(!sysPrxForUser->CheckId(heap_id, heap)) return CELL_ESRCH;
return Memory.Alloc(size, 1);
}
int _sys_heap_memalign(u32 heap_id, u32 align, u32 size)
{
sysPrxForUser->Warning("_sys_heap_memalign(heap_id=%d, align=0x%x, size=0x%x)", heap_id, align, size);
HeapInfo* heap;
if(!sysPrxForUser->CheckId(heap_id, heap)) return CELL_ESRCH;
return Memory.Alloc(size, align);
}
void sys_initialize_tls()
{
sysPrxForUser->Log("sys_initialize_tls()");
@ -204,5 +247,4 @@ void sysPrxForUser_init()
sysPrxForUser->AddFunc(0x67f9fedb, sys_game_process_exitspawn2);
sysPrxForUser->AddFunc(0xfc52a7a9, sys_game_process_exitspawn);
}