mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 11:36:13 +00:00
Merge pull request #396 from DHrpcs3/prx_loader
Changes for modules and lv2 sycalls
This commit is contained in:
commit
d0b7c9a9af
90 changed files with 2069 additions and 2558 deletions
|
@ -2,8 +2,8 @@
|
|||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Event_flag.h"
|
||||
#include "Emu/SysCalls/lv2/sys_lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/sys_event.h"
|
||||
|
||||
#include "Emu/Cell/RawSPUThread.h"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "SPUThread.h"
|
||||
#include "Emu/event.h"
|
||||
#include "Emu/Event.h"
|
||||
|
||||
__forceinline static u32 GetRawSPURegAddrByNum(int num, int offset)
|
||||
{
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Event_flag.h"
|
||||
#include "Emu/SysCalls/lv2/sys_lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/sys_event.h"
|
||||
|
||||
#include "SPUInstrTable.h"
|
||||
#include "SPUDisAsm.h"
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Event_flag.h"
|
||||
#include "Emu/SysCalls/lv2/sys_lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/sys_event.h"
|
||||
|
||||
|
||||
#include "Emu/Cell/SPUThread.h"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#include "PPCThread.h"
|
||||
#include "Emu/event.h"
|
||||
#include "Emu/SysCalls/lv2/SC_SPU_Thread.h"
|
||||
#include "Emu/Event.h"
|
||||
#include "Emu/SysCalls/lv2/sys_spu.h"
|
||||
#include "MFC.h"
|
||||
#include "Emu/SysCalls/ErrorCodes.h"
|
||||
#include <mutex>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "event.h"
|
||||
#include "Event.h"
|
||||
|
||||
void EventManager::Init()
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "Emu/SysCalls/lv2/SC_Lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/sys_lwmutex.h"
|
||||
|
||||
#define FIX_SPUQ(x) ((u64)x | 0x5350555100000000ULL)
|
||||
// arbitrary code to prevent "special" zero value in key argument
|
|
@ -3,7 +3,7 @@
|
|||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "RSXThread.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Time.h"
|
||||
#include "Emu/SysCalls/lv2/sys_time.h"
|
||||
|
||||
#define ARGS(x) (x >= count ? OutOfArgsCount(x, cmd, count) : Memory.Read32(Memory.RSXIOMem.GetStartAddr() + m_ctrl->get + (4*(x+1))))
|
||||
|
||||
|
|
|
@ -5,12 +5,20 @@
|
|||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Crypto/sha1.h"
|
||||
#include <mutex>
|
||||
#include "Emu/System.h"
|
||||
#include "ModuleManager.h"
|
||||
|
||||
u32 getFunctionId(const std::string& name)
|
||||
{
|
||||
const char* suffix = "\x67\x59\x65\x99\x04\x25\x04\x90\x56\x64\x27\x49\x94\x89\x74\x1A"; // Symbol name suffix
|
||||
std::string input = name + suffix;
|
||||
unsigned char output[20];
|
||||
|
||||
|
||||
sha1((unsigned char*)input.c_str(), input.length(), output); // Compute SHA-1 hash
|
||||
return (u32&)output[0];
|
||||
}
|
||||
|
||||
Module::Module(u16 id, const char* name)
|
||||
: m_is_loaded(false)
|
||||
|
@ -217,4 +225,3 @@ bool Module::CheckID(u32 id, ID*& _id) const
|
|||
{
|
||||
return Emu.GetIdManager().CheckID(id) && (_id = &Emu.GetIdManager().GetID(id))->m_name == GetName();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#define declCPU PPUThread& CPU = GetCurrentPPUThread
|
||||
|
||||
|
||||
//TODO
|
||||
struct ModuleFunc
|
||||
{
|
||||
|
@ -120,16 +119,24 @@ public:
|
|||
}
|
||||
|
||||
template<typename T> __forceinline void AddFunc(u32 id, T func);
|
||||
|
||||
template<typename T> __forceinline void AddFunc(const std::string& name, T func);
|
||||
template<typename T> __forceinline void AddFuncSub(const char group[8], const u64 ops[], const char* name, T func);
|
||||
};
|
||||
|
||||
u32 getFunctionId(const std::string& name);
|
||||
|
||||
template<typename T>
|
||||
__forceinline void Module::AddFunc(u32 id, T func)
|
||||
{
|
||||
m_funcs_list.emplace_back(new ModuleFunc(id, bind_func(func)));
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
__forceinline void Module::AddFunc(const std::string& name, T func)
|
||||
{
|
||||
AddFunc(getFunctionId(name), func);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
__forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], const char* name, T func)
|
||||
{
|
||||
|
@ -144,7 +151,6 @@ __forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], cons
|
|||
sf->found = 0;
|
||||
|
||||
// TODO: check for self-inclusions, use CRC
|
||||
|
||||
for (u32 i = 0; ops[i]; i++)
|
||||
{
|
||||
SFuncOp op;
|
||||
|
@ -157,4 +163,3 @@ __forceinline void Module::AddFuncSub(const char group[8], const u64 ops[], cons
|
|||
}
|
||||
Emu.GetSFuncManager().push_back(sf);
|
||||
}
|
||||
|
||||
|
|
|
@ -1149,6 +1149,31 @@ int cellGcmSetTile(u8 index, u8 location, u32 offset, u32 size, u32 pitch, u8 co
|
|||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
// TODO: This function was originally located in lv2/SC_GCM and appears in RPCS3 as a lv2 syscall with id 1023,
|
||||
// which according to lv2 dumps isn't the case. So, is this a proper place for this function?
|
||||
|
||||
int cellGcmCallback(u32 context_addr, u32 count)
|
||||
{
|
||||
GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH);
|
||||
|
||||
CellGcmContextData& ctx = (CellGcmContextData&)Memory[context_addr];
|
||||
CellGcmControl& ctrl = (CellGcmControl&)Memory[gcm_info.control_addr];
|
||||
|
||||
const s32 res = ctx.current - ctx.begin - ctrl.put;
|
||||
|
||||
if(res > 0) Memory.Copy(ctx.begin, ctx.current - res, res);
|
||||
|
||||
ctx.current = ctx.begin + res;
|
||||
|
||||
//InterlockedExchange64((volatile long long*)((u8*)&ctrl + offsetof(CellGcmControl, put)), (u64)(u32)re(res));
|
||||
ctrl.put = res;
|
||||
ctrl.get = 0;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void cellGcmSys_init()
|
||||
{
|
||||
// Data Retrieval
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "cellSysutil.h"
|
||||
#include "cellResc.h"
|
||||
|
||||
//void cellResc_init();
|
||||
|
|
|
@ -199,7 +199,7 @@ int cellVideoOutGetResolution(u32 resolutionId, mem_ptr_t<CellVideoOutResolution
|
|||
return CELL_VIDEO_OUT_SUCCEEDED;
|
||||
}
|
||||
|
||||
int cellVideoOutConfigure(u32 videoOut, u32 config_addr, u32 option_addr, u32 waitForEvent)
|
||||
s32 cellVideoOutConfigure(u32 videoOut, u32 config_addr, u32 option_addr, u32 waitForEvent)
|
||||
{
|
||||
cellSysutil->Warning("cellVideoOutConfigure(videoOut=%d, config_addr=0x%x, option_addr=0x%x, waitForEvent=0x%x)",
|
||||
videoOut, config_addr, option_addr, waitForEvent);
|
||||
|
|
|
@ -213,3 +213,6 @@ struct CellHddGameCBResult
|
|||
be_t<u32> invalidMsg_addr; // char*
|
||||
be_t<u32> reserved_addr; // void*
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
s32 cellVideoOutConfigure(u32 videoOut, u32 config_addr, u32 option_addr, u32 waitForEvent);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "Loader/TRP.h"
|
||||
#include "Loader/TROPUSR.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Time.h"
|
||||
#include "Emu/SysCalls/lv2/sys_time.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,46 @@
|
|||
//Module sys_io(0x0017, sys_io_init);
|
||||
Module *sys_io = nullptr;
|
||||
|
||||
//cellPad
|
||||
extern int cellPadInit(u32 max_connect);
|
||||
extern int cellPadEnd();
|
||||
extern int cellPadClearBuf(u32 port_no);
|
||||
extern int cellPadGetData(u32 port_no, u32 data_addr);
|
||||
extern int cellPadGetDataExtra(u32 port_no, u32 device_type_addr, u32 data_addr);
|
||||
extern int cellPadSetActDirect(u32 port_no, u32 param_addr);
|
||||
extern int cellPadGetInfo(u32 info_addr);
|
||||
extern int cellPadGetInfo2(u32 info_addr);
|
||||
extern int cellPadSetPortSetting(u32 port_no, u32 port_setting);
|
||||
extern int cellPadInfoPressMode(u32 port_no);
|
||||
extern int cellPadInfoSensorMode(u32 port_no);
|
||||
extern int cellPadSetPressMode(u32 port_no, u32 mode);
|
||||
extern int cellPadSetSensorMode(u32 port_no, u32 mode);
|
||||
extern int cellPadGetCapabilityInfo(u32 port_no, mem32_t info_addr);
|
||||
|
||||
//cellKb
|
||||
extern int cellKbInit(u32 max_connect);
|
||||
extern int cellKbEnd();
|
||||
extern int cellKbClearBuf(u32 port_no);
|
||||
extern u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode);
|
||||
extern int cellKbGetInfo(mem_class_t info);
|
||||
extern int cellKbRead(u32 port_no, mem_class_t data);
|
||||
extern int cellKbSetCodeType(u32 port_no, u32 type);
|
||||
extern int cellKbSetLEDStatus(u32 port_no, u8 led);
|
||||
extern int cellKbSetReadMode(u32 port_no, u32 rmode);
|
||||
extern int cellKbGetConfiguration(u32 port_no, mem_class_t config);
|
||||
|
||||
//cellMouse
|
||||
extern int cellMouseInit(u32 max_connect);
|
||||
extern int cellMouseClearBuf(u32 port_no);
|
||||
extern int cellMouseEnd();
|
||||
extern int cellMouseGetInfo(mem_class_t info);
|
||||
extern int cellMouseInfoTabletMode(u32 port_no, mem_class_t info);
|
||||
extern int cellMouseGetData(u32 port_no, mem_class_t data);
|
||||
extern int cellMouseGetDataList(u32 port_no, mem_class_t data);
|
||||
extern int cellMouseSetTabletMode(u32 port_no, u32 mode);
|
||||
extern int cellMouseGetTabletDataList(u32 port_no, mem_class_t data);
|
||||
extern int cellMouseGetRawData(u32 port_no, mem_class_t data);
|
||||
|
||||
void sys_io_init()
|
||||
{
|
||||
sys_io->AddFunc(0x1cf98800, cellPadInit);
|
||||
|
|
|
@ -523,7 +523,7 @@ static func_caller* sc_table[kSyscallTableLength] =
|
|||
null_func, null_func, null_func, null_func, null_func, //1009
|
||||
null_func, null_func, null_func, null_func, null_func, //1014
|
||||
null_func, null_func, null_func, null_func, null_func, //1019
|
||||
null_func, null_func, null_func, bind_func(cellGcmCallback), //1024
|
||||
null_func, null_func, null_func, bind_func(cellGcmCallback), //1023
|
||||
};
|
||||
|
||||
/** HACK: Used to delete func_caller objects that get allocated and stored in sc_table (above).
|
||||
|
|
|
@ -1,20 +1,31 @@
|
|||
#pragma once
|
||||
#include "ErrorCodes.h"
|
||||
#include "lv2/SC_Process.h"
|
||||
#include "lv2/SC_PRX.h"
|
||||
#include "lv2/SC_FileSystem.h"
|
||||
#include "lv2/SC_Memory.h"
|
||||
#include "lv2/SC_Timer.h"
|
||||
#include "lv2/SC_Rwlock.h"
|
||||
#include "lv2/SC_SPU_Thread.h"
|
||||
#include "lv2/SC_Lwmutex.h"
|
||||
#include "lv2/SC_Lwcond.h"
|
||||
#include "lv2/SC_Event_flag.h"
|
||||
#include "lv2/SC_Condition.h"
|
||||
#include "lv2/SC_Spinlock.h"
|
||||
#include "lv2/SC_Semaphore.h"
|
||||
#include "Emu/event.h"
|
||||
#include "Static.h"
|
||||
|
||||
#include "lv2/lv2Fs.h"
|
||||
#include "lv2/sys_cond.h"
|
||||
#include "lv2/sys_event.h"
|
||||
#include "lv2/sys_interrupt.h"
|
||||
#include "lv2/sys_lwcond.h"
|
||||
#include "lv2/sys_lwmutex.h"
|
||||
#include "lv2/sys_memory.h"
|
||||
#include "lv2/sys_mmapper.h"
|
||||
#include "lv2/sys_ppu_thread.h"
|
||||
#include "lv2/sys_process.h"
|
||||
#include "lv2/sys_prx.h"
|
||||
#include "lv2/sys_rsx.h"
|
||||
#include "lv2/sys_rwlock.h"
|
||||
#include "lv2/sys_semaphore.h"
|
||||
#include "lv2/sys_spinlock.h"
|
||||
#include "lv2/sys_spu.h"
|
||||
#include "lv2/sys_time.h"
|
||||
#include "lv2/sys_timer.h"
|
||||
#include "lv2/sys_trace.h"
|
||||
#include "lv2/sys_tty.h"
|
||||
#include "lv2/sys_vm.h"
|
||||
|
||||
#include "Emu/Event.h"
|
||||
|
||||
//#define SYSCALLS_DEBUG
|
||||
|
||||
#define declCPU PPUThread& CPU = GetCurrentPPUThread
|
||||
|
@ -123,313 +134,9 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
//sys_event
|
||||
extern int sys_event_queue_create(mem32_t equeue_id, mem_ptr_t<sys_event_queue_attr> attr, u64 event_queue_key, int size);
|
||||
extern int sys_event_queue_destroy(u32 equeue_id, int mode);
|
||||
extern int sys_event_queue_receive(u32 equeue_id, mem_ptr_t<sys_event_data> event, u64 timeout);
|
||||
extern int sys_event_queue_tryreceive(u32 equeue_id, mem_ptr_t<sys_event_data> event_array, int size, mem32_t number);
|
||||
extern int sys_event_queue_drain(u32 event_queue_id);
|
||||
extern int sys_event_port_create(mem32_t eport_id, int port_type, u64 name);
|
||||
extern int sys_event_port_destroy(u32 eport_id);
|
||||
extern int sys_event_port_connect_local(u32 event_port_id, u32 event_queue_id);
|
||||
extern int sys_event_port_disconnect(u32 eport_id);
|
||||
extern int sys_event_port_send(u32 event_port_id, u64 data1, u64 data2, u64 data3);
|
||||
|
||||
//sys_event_flag
|
||||
extern int sys_event_flag_create(mem32_t eflag_id, mem_ptr_t<sys_event_flag_attr> attr, u64 init);
|
||||
extern int sys_event_flag_destroy(u32 eflag_id);
|
||||
extern int sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64 timeout);
|
||||
extern int sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result);
|
||||
extern int sys_event_flag_set(u32 eflag_id, u64 bitptn);
|
||||
extern int sys_event_flag_clear(u32 eflag_id, u64 bitptn);
|
||||
extern int sys_event_flag_cancel(u32 eflag_id, mem32_t num);
|
||||
extern int sys_event_flag_get(u32 eflag_id, mem64_t flags);
|
||||
|
||||
//sys_semaphore
|
||||
extern int sys_semaphore_create(mem32_t sem, mem_ptr_t<sys_semaphore_attribute> attr, int initial_count, int max_count);
|
||||
extern int sys_semaphore_destroy(u32 sem_id);
|
||||
extern int sys_semaphore_wait(u32 sem_id, u64 timeout);
|
||||
extern int sys_semaphore_trywait(u32 sem_id);
|
||||
extern int sys_semaphore_post(u32 sem_id, int count);
|
||||
extern int sys_semaphore_get_value(u32 sem_id, mem32_t count);
|
||||
|
||||
//sys_lwcond
|
||||
extern int sys_lwcond_create(mem_ptr_t<sys_lwcond_t> lwcond, mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwcond_attribute_t> attr);
|
||||
extern int sys_lwcond_destroy(mem_ptr_t<sys_lwcond_t> lwcond);
|
||||
extern int sys_lwcond_signal(mem_ptr_t<sys_lwcond_t> lwcond);
|
||||
extern int sys_lwcond_signal_all(mem_ptr_t<sys_lwcond_t> lwcond);
|
||||
extern int sys_lwcond_signal_to(mem_ptr_t<sys_lwcond_t> lwcond, u32 ppu_thread_id);
|
||||
extern int sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout);
|
||||
|
||||
//sys_lwmutex
|
||||
extern int sys_lwmutex_create(mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwmutex_attribute_t> attr);
|
||||
extern int sys_lwmutex_destroy(mem_ptr_t<sys_lwmutex_t> lwmutex);
|
||||
extern int sys_lwmutex_lock(mem_ptr_t<sys_lwmutex_t> lwmutex, u64 timeout);
|
||||
extern int sys_lwmutex_trylock(mem_ptr_t<sys_lwmutex_t> lwmutex);
|
||||
extern int sys_lwmutex_unlock(mem_ptr_t<sys_lwmutex_t> lwmutex);
|
||||
|
||||
//sys_cond
|
||||
extern int sys_cond_create(mem32_t cond_id, u32 mutex_id, mem_ptr_t<sys_cond_attribute> attr);
|
||||
extern int sys_cond_destroy(u32 cond_id);
|
||||
extern int sys_cond_wait(u32 cond_id, u64 timeout);
|
||||
extern int sys_cond_signal(u32 cond_id);
|
||||
extern int sys_cond_signal_all(u32 cond_id);
|
||||
extern int sys_cond_signal_to(u32 cond_id, u32 thread_id);
|
||||
|
||||
//sys_mutex
|
||||
extern int sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr);
|
||||
extern int sys_mutex_destroy(u32 mutex_id);
|
||||
extern int sys_mutex_lock(u32 mutex_id, u64 timeout);
|
||||
extern int sys_mutex_trylock(u32 mutex_id);
|
||||
extern int sys_mutex_unlock(u32 mutex_id);
|
||||
|
||||
//sys_rwlock
|
||||
extern int sys_rwlock_create(mem32_t rw_lock_id, mem_ptr_t<sys_rwlock_attribute_t> attr);
|
||||
extern int sys_rwlock_destroy(u32 rw_lock_id);
|
||||
extern int sys_rwlock_rlock(u32 rw_lock_id, u64 timeout);
|
||||
extern int sys_rwlock_tryrlock(u32 rw_lock_id);
|
||||
extern int sys_rwlock_runlock(u32 rw_lock_id);
|
||||
extern int sys_rwlock_wlock(u32 rw_lock_id, u64 timeout);
|
||||
extern int sys_rwlock_trywlock(u32 rw_lock_id);
|
||||
extern int sys_rwlock_wunlock(u32 rw_lock_id);
|
||||
|
||||
//sys_spinlock
|
||||
extern void sys_spinlock_initialize(mem_ptr_t<spinlock> lock);
|
||||
extern void sys_spinlock_lock(mem_ptr_t<spinlock> lock);
|
||||
extern int sys_spinlock_trylock(mem_ptr_t<spinlock> lock);
|
||||
extern void sys_spinlock_unlock(mem_ptr_t<spinlock> lock);
|
||||
|
||||
//ppu_thread
|
||||
extern void sys_ppu_thread_exit(u64 errorcode);
|
||||
extern int sys_ppu_thread_yield();
|
||||
extern int sys_ppu_thread_join(u64 thread_id, mem64_t vptr);
|
||||
extern int sys_ppu_thread_detach(u64 thread_id);
|
||||
extern void sys_ppu_thread_get_join_state(u32 isjoinable_addr);
|
||||
extern int sys_ppu_thread_set_priority(u64 thread_id, int prio);
|
||||
extern int sys_ppu_thread_get_priority(u64 thread_id, u32 prio_addr);
|
||||
extern int sys_ppu_thread_get_stack_information(u32 info_addr);
|
||||
extern int sys_ppu_thread_stop(u64 thread_id);
|
||||
extern int sys_ppu_thread_restart(u64 thread_id);
|
||||
extern int sys_ppu_thread_create(mem64_t thread_id, u32 entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr);
|
||||
extern void sys_ppu_thread_once(u32 once_ctrl_addr, u32 entry);
|
||||
extern int sys_ppu_thread_get_id(const u32 id_addr);
|
||||
|
||||
//memory
|
||||
extern int sys_memory_allocate(u32 size, u32 flags, u32 alloc_addr_addr);
|
||||
extern int sys_memory_allocate_from_container(u32 size, u32 cid, u32 flags, u32 alloc_addr_addr);
|
||||
extern int sys_memory_free(u32 start_addr);
|
||||
extern int sys_memory_get_page_attribute(u32 addr, mem_ptr_t<sys_page_attr_t> attr);
|
||||
extern int sys_memory_get_user_memory_size(mem_ptr_t<sys_memory_info_t> mem_info);
|
||||
extern int sys_memory_container_create(mem32_t cid, u32 yield_size);
|
||||
extern int sys_memory_container_destroy(u32 cid);
|
||||
extern int sys_memory_container_get_size(mem_ptr_t<sys_memory_info_t> mem_info, u32 cid);
|
||||
extern int sys_mmapper_allocate_address(u32 size, u64 flags, u32 alignment, u32 alloc_addr);
|
||||
extern int sys_mmapper_allocate_fixed_address();
|
||||
extern int sys_mmapper_allocate_memory(u32 size, u64 flags, mem32_t mem_id);
|
||||
extern int sys_mmapper_allocate_memory_from_container(u32 size, u32 cid, u64 flags, mem32_t mem_id);
|
||||
extern int sys_mmapper_change_address_access_right(u32 start_addr, u64 flags);
|
||||
extern int sys_mmapper_free_address(u32 start_addr);
|
||||
extern int sys_mmapper_free_memory(u32 mem_id);
|
||||
extern int sys_mmapper_map_memory(u32 start_addr, u32 mem_id, u64 flags);
|
||||
extern int sys_mmapper_search_and_map(u32 start_addr, u32 mem_id, u64 flags, u32 alloc_addr);
|
||||
extern int sys_mmapper_unmap_memory(u32 start_addr, u32 mem_id_addr);
|
||||
extern int sys_mmapper_enable_page_fault_notification(u32 start_addr, u32 q_id);
|
||||
|
||||
//vm
|
||||
extern int sys_vm_memory_map(u32 vsize, u32 psize, u32 cid, u64 flag, u64 policy, u32 addr);
|
||||
extern int sys_vm_unmap(u32 addr);
|
||||
extern int sys_vm_append_memory(u32 addr, u32 size);
|
||||
extern int sys_vm_return_memory(u32 addr, u32 size);
|
||||
extern int sys_vm_lock(u32 addr, u32 size);
|
||||
extern int sys_vm_unlock(u32 addr, u32 size);
|
||||
extern int sys_vm_touch(u32 addr, u32 size);
|
||||
extern int sys_vm_flush(u32 addr, u32 size);
|
||||
extern int sys_vm_invalidate(u32 addr, u32 size);
|
||||
extern int sys_vm_store(u32 addr, u32 size);
|
||||
extern int sys_vm_sync(u32 addr, u32 size);
|
||||
extern int sys_vm_test(u32 addr, u32 size, u32 result_addr);
|
||||
extern int sys_vm_get_statistics(u32 addr, u32 stat_addr);
|
||||
|
||||
//cellFs
|
||||
extern int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size);
|
||||
extern int cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nread);
|
||||
extern int cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nwrite);
|
||||
extern int cellFsClose(u32 fd);
|
||||
extern int cellFsOpendir(u32 path_addr, mem32_t fd);
|
||||
extern int cellFsReaddir(u32 fd, mem_ptr_t<CellFsDirent> dir, mem64_t nread);
|
||||
extern int cellFsClosedir(u32 fd);
|
||||
extern int cellFsStat(u32 path_addr, mem_ptr_t<CellFsStat> sb);
|
||||
extern int cellFsFstat(u32 fd, mem_ptr_t<CellFsStat> sb);
|
||||
extern int cellFsMkdir(u32 path_addr, u32 mode);
|
||||
extern int cellFsRename(u32 from_addr, u32 to_addr);
|
||||
extern int cellFsRmdir(u32 path_addr);
|
||||
extern int cellFsUnlink(u32 path_addr);
|
||||
extern int cellFsLseek(u32 fd, s64 offset, u32 whence, mem64_t pos);
|
||||
extern int cellFsFtruncate(u32 fd, u64 size);
|
||||
extern int cellFsTruncate(u32 path_addr, u64 size);
|
||||
extern int cellFsFGetBlockSize(u32 fd, mem64_t sector_size, mem64_t block_size);
|
||||
extern int cellFsGetBlockSize(u32 path_addr, mem64_t sector_size, mem64_t block_size);
|
||||
extern int cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count);
|
||||
extern int cellFsGetDirectoryEntries(u32 fd, mem_ptr_t<CellFsDirectoryEntry> entries, u32 entries_size, mem32_t data_count);
|
||||
extern int cellFsStReadInit(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf);
|
||||
extern int cellFsStReadFinish(u32 fd);
|
||||
extern int cellFsStReadGetRingBuf(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf);
|
||||
extern int cellFsStReadGetStatus(u32 fd, mem64_t status);
|
||||
extern int cellFsStReadGetRegid(u32 fd, mem64_t regid);
|
||||
extern int cellFsStReadStart(u32 fd, u64 offset, u64 size);
|
||||
extern int cellFsStReadStop(u32 fd);
|
||||
extern int cellFsStRead(u32 fd, u32 buf_addr, u64 size, mem64_t rsize);
|
||||
extern int cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, mem64_t size);
|
||||
extern int cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size);
|
||||
extern int cellFsStReadWait(u32 fd, u64 size);
|
||||
extern int cellFsStReadWaitCallback(u32 fd, u64 size, mem_func_ptr_t<void (*)(int xfd, u64 xsize)> func);
|
||||
|
||||
//cellVideo
|
||||
extern int cellVideoOutGetState(u32 videoOut, u32 deviceIndex, u32 state_addr);
|
||||
extern int cellVideoOutGetResolution(u32 resolutionId, mem_ptr_t<CellVideoOutResolution> resolution);
|
||||
extern int cellVideoOutConfigure(u32 videoOut, u32 config_addr, u32 option_addr, u32 waitForEvent);
|
||||
extern int cellVideoOutGetConfiguration(u32 videoOut, u32 config_addr, u32 option_addr);
|
||||
extern int cellVideoOutGetNumberOfDevice(u32 videoOut);
|
||||
extern int cellVideoOutGetResolutionAvailability(u32 videoOut, u32 resolutionId, u32 aspect, u32 option);
|
||||
|
||||
//cellPad
|
||||
extern int cellPadInit(u32 max_connect);
|
||||
extern int cellPadEnd();
|
||||
extern int cellPadClearBuf(u32 port_no);
|
||||
extern int cellPadGetData(u32 port_no, u32 data_addr);
|
||||
extern int cellPadGetDataExtra(u32 port_no, u32 device_type_addr, u32 data_addr);
|
||||
extern int cellPadSetActDirect(u32 port_no, u32 param_addr);
|
||||
extern int cellPadGetInfo(u32 info_addr);
|
||||
extern int cellPadGetInfo2(u32 info_addr);
|
||||
extern int cellPadSetPortSetting(u32 port_no, u32 port_setting);
|
||||
extern int cellPadInfoPressMode(u32 port_no);
|
||||
extern int cellPadInfoSensorMode(u32 port_no);
|
||||
extern int cellPadSetPressMode(u32 port_no, u32 mode);
|
||||
extern int cellPadSetSensorMode(u32 port_no, u32 mode);
|
||||
extern int cellPadGetCapabilityInfo(u32 port_no, mem32_t info_addr);
|
||||
|
||||
//cellKb
|
||||
extern int cellKbInit(u32 max_connect);
|
||||
extern int cellKbEnd();
|
||||
extern int cellKbClearBuf(u32 port_no);
|
||||
extern u16 cellKbCnvRawCode(u32 arrange, u32 mkey, u32 led, u16 rawcode);
|
||||
extern int cellKbGetInfo(mem_class_t info);
|
||||
extern int cellKbRead(u32 port_no, mem_class_t data);
|
||||
extern int cellKbSetCodeType(u32 port_no, u32 type);
|
||||
extern int cellKbSetLEDStatus(u32 port_no, u8 led);
|
||||
extern int cellKbSetReadMode(u32 port_no, u32 rmode);
|
||||
extern int cellKbGetConfiguration(u32 port_no, mem_class_t config);
|
||||
|
||||
//cellMouse
|
||||
extern int cellMouseInit(u32 max_connect);
|
||||
extern int cellMouseClearBuf(u32 port_no);
|
||||
extern int cellMouseEnd();
|
||||
extern int cellMouseGetInfo(mem_class_t info);
|
||||
extern int cellMouseInfoTabletMode(u32 port_no, mem_class_t info);
|
||||
extern int cellMouseGetData(u32 port_no, mem_class_t data);
|
||||
extern int cellMouseGetDataList(u32 port_no, mem_class_t data);
|
||||
extern int cellMouseSetTabletMode(u32 port_no, u32 mode);
|
||||
extern int cellMouseGetTabletDataList(u32 port_no, mem_class_t data);
|
||||
extern int cellMouseGetRawData(u32 port_no, mem_class_t data);
|
||||
|
||||
//cellGcm
|
||||
//cellGcm (used as lv2 syscall #1023)
|
||||
extern int cellGcmCallback(u32 context_addr, u32 count);
|
||||
|
||||
//sys_tty
|
||||
extern int sys_tty_read(u32 ch, u64 buf_addr, u32 len, u64 preadlen_addr);
|
||||
extern int sys_tty_write(u32 ch, u64 buf_addr, u32 len, u64 pwritelen_addr);
|
||||
|
||||
//sys_heap
|
||||
extern int sys_heap_create_heap(const u32 heap_addr, const u32 start_addr, const u32 size);
|
||||
extern int sys_heap_malloc(const u32 heap_addr, const u32 size);
|
||||
extern int _sys_heap_memalign(u32 heap_id, u32 align, u32 size);
|
||||
|
||||
//sys_spu
|
||||
extern int sys_spu_image_open(mem_ptr_t<sys_spu_image> img, u32 path_addr);
|
||||
extern int sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<sys_spu_image> img, mem_ptr_t<sys_spu_thread_attribute> attr, mem_ptr_t<sys_spu_thread_argument> arg);
|
||||
extern int sys_spu_thread_set_argument(u32 id, mem_ptr_t<sys_spu_thread_argument> arg);
|
||||
extern int sys_spu_thread_group_destroy(u32 id);
|
||||
extern int sys_spu_thread_group_start(u32 id);
|
||||
extern int sys_spu_thread_group_suspend(u32 id);
|
||||
extern int sys_spu_thread_group_resume(u32 id);
|
||||
extern int sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu_thread_group_attribute> attr);
|
||||
extern int sys_spu_thread_create(mem32_t thread_id, mem32_t entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr);
|
||||
extern int sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status);
|
||||
extern int sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et);
|
||||
extern int sys_spu_thread_group_disconnect_event(u32 id, u32 et);
|
||||
extern int sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, u32 spup_addr);
|
||||
extern int sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup);
|
||||
extern int sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu);
|
||||
extern int sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type);
|
||||
extern int sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type);
|
||||
extern int sys_spu_thread_write_spu_mb(u32 id, u32 value);
|
||||
extern int sys_spu_thread_set_spu_cfg(u32 id, u64 value);
|
||||
extern int sys_spu_thread_get_spu_cfg(u32 id, mem64_t value);
|
||||
extern int sys_spu_thread_write_snr(u32 id, u32 number, u32 value);
|
||||
extern int sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup);
|
||||
extern int sys_spu_thread_disconnect_event(u32 id, u32 event_type, u8 spup);
|
||||
extern int sys_spu_thread_bind_queue(u32 id, u32 spuq, u32 spuq_num);
|
||||
extern int sys_spu_thread_unbind_queue(u32 id, u32 spuq_num);
|
||||
extern int sys_spu_thread_get_exit_status(u32 id, mem32_t status);
|
||||
extern int sys_raw_spu_create(mem32_t id, u32 attr_addr);
|
||||
extern int sys_raw_spu_destroy(u32 id);
|
||||
extern int sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, mem32_t intrtag);
|
||||
extern int sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask);
|
||||
extern int sys_raw_spu_get_int_mask(u32 id, u32 class_id, mem64_t mask);
|
||||
extern int sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat);
|
||||
extern int sys_raw_spu_get_int_stat(u32 id, u32 class_id, mem64_t stat);
|
||||
extern int sys_raw_spu_read_puint_mb(u32 id, mem32_t value);
|
||||
extern int sys_raw_spu_set_spu_cfg(u32 id, u32 value);
|
||||
extern int sys_raw_spu_get_spu_cfg(u32 id, mem32_t value);
|
||||
|
||||
//sys_interrupt
|
||||
extern int sys_interrupt_tag_destroy(u32 intrtag);
|
||||
extern int sys_interrupt_thread_establish(mem32_t ih, u32 intrtag, u64 intrthread, u64 arg);
|
||||
extern int sys_interrupt_thread_disestablish(u32 ih);
|
||||
extern void sys_interrupt_thread_eoi();
|
||||
|
||||
//sys_time
|
||||
extern int sys_time_get_timezone(mem32_t timezone, mem32_t summertime);
|
||||
extern int sys_time_get_current_time(u32 sec_addr, u32 nsec_addr);
|
||||
extern s64 sys_time_get_system_time();
|
||||
extern u64 sys_time_get_timebase_frequency();
|
||||
|
||||
//sys_timer
|
||||
extern int sys_timer_create(mem32_t timer_id);
|
||||
extern int sys_timer_destroy(u32 timer_id);
|
||||
extern int sys_timer_get_information(u32 timer_id, mem_ptr_t<sys_timer_information_t> info);
|
||||
extern int sys_timer_start(u32 timer_id, s64 basetime, u64 period);
|
||||
extern int sys_timer_stop(u32 timer_id);
|
||||
extern int sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data1, u64 data2);
|
||||
extern int sys_timer_disconnect_event_queue(u32 timer_id);
|
||||
extern int sys_timer_sleep(u32 sleep_time);
|
||||
extern int sys_timer_usleep(u64 sleep_time);
|
||||
|
||||
//sys_trace
|
||||
extern int sys_trace_create();
|
||||
extern int sys_trace_start();
|
||||
extern int sys_trace_stop();
|
||||
extern int sys_trace_update_top_index();
|
||||
extern int sys_trace_destroy();
|
||||
extern int sys_trace_drain();
|
||||
extern int sys_trace_attach_process();
|
||||
extern int sys_trace_allocate_buffer();
|
||||
extern int sys_trace_free_buffer();
|
||||
extern int sys_trace_create2();
|
||||
|
||||
//sys_rsx
|
||||
extern int sys_rsx_device_open();
|
||||
extern int sys_rsx_device_close();
|
||||
extern int sys_rsx_memory_allocate();
|
||||
extern int sys_rsx_memory_free();
|
||||
extern int sys_rsx_context_allocate();
|
||||
extern int sys_rsx_context_free();
|
||||
extern int sys_rsx_context_iomap();
|
||||
extern int sys_rsx_context_iounmap();
|
||||
extern int sys_rsx_context_attribute(s32 context_id, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6);
|
||||
extern int sys_rsx_device_map(mem32_t a1, mem32_t a2, u32 a3);
|
||||
extern int sys_rsx_device_unmap();
|
||||
extern int sys_rsx_attribute();
|
||||
|
||||
#define UNIMPLEMENTED_FUNC(module) module->Error("Unimplemented function: %s", __FUNCTION__)
|
||||
|
||||
|
@ -472,8 +179,6 @@ public:
|
|||
static std::string GetHLEFuncName(const u32 fid);
|
||||
};
|
||||
|
||||
//extern SysCalls SysCallsManager;
|
||||
|
||||
#define REG_SUB(module, group, name, ...) \
|
||||
static const u64 name ## _table[] = {__VA_ARGS__ , 0}; \
|
||||
module->AddFuncSub(group, name ## _table, #name, name)
|
||||
|
@ -481,5 +186,3 @@ public:
|
|||
#define REG_SUB_EMPTY(module, group, name,...) \
|
||||
static const u64 name ## _table[] = {0}; \
|
||||
module->AddFuncSub(group, name ## _table, #name, name)
|
||||
|
||||
extern u64 get_system_time();
|
|
@ -1,370 +0,0 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Event_flag.h"
|
||||
|
||||
SysCallBase sys_event_flag("sys_event_flag");
|
||||
|
||||
int sys_event_flag_create(mem32_t eflag_id, mem_ptr_t<sys_event_flag_attr> attr, u64 init)
|
||||
{
|
||||
sys_event_flag.Warning("sys_event_flag_create(eflag_id_addr=0x%x, attr_addr=0x%x, init=0x%llx)",
|
||||
eflag_id.GetAddr(), attr.GetAddr(), init);
|
||||
|
||||
if(!eflag_id.IsGood() || !attr.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
switch (attr->protocol.ToBE())
|
||||
{
|
||||
case se32(SYS_SYNC_PRIORITY): break;
|
||||
case se32(SYS_SYNC_RETRY): sys_event_flag.Warning("TODO: SYS_SYNC_RETRY attr"); break;
|
||||
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_event_flag.Warning("TODO: SYS_SYNC_PRIORITY_INHERIT attr"); break;
|
||||
case se32(SYS_SYNC_FIFO): break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if (attr->pshared.ToBE() != se32(0x200))
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
switch (attr->type.ToBE())
|
||||
{
|
||||
case se32(SYS_SYNC_WAITER_SINGLE): break;
|
||||
case se32(SYS_SYNC_WAITER_MULTIPLE): break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
eflag_id = sys_event_flag.GetNewId(new EventFlag(init, (u32)attr->protocol, (int)attr->type));
|
||||
|
||||
sys_event_flag.Warning("*** event_flag created [%s] (protocol=0x%x, type=0x%x): id = %d",
|
||||
std::string(attr->name, 8).c_str(), (u32)attr->protocol, (int)attr->type, eflag_id.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_event_flag_destroy(u32 eflag_id)
|
||||
{
|
||||
sys_event_flag.Warning("sys_event_flag_destroy(eflag_id=%d)", eflag_id);
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
if (ef->waiters.size()) // ???
|
||||
{
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().RemoveID(eflag_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64 timeout)
|
||||
{
|
||||
sys_event_flag.Log("sys_event_flag_wait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x, timeout=%lld)",
|
||||
eflag_id, bitptn, mode, result.GetAddr(), timeout);
|
||||
|
||||
if (result.IsGood()) result = 0;
|
||||
|
||||
switch (mode & 0xf)
|
||||
{
|
||||
case SYS_EVENT_FLAG_WAIT_AND: break;
|
||||
case SYS_EVENT_FLAG_WAIT_OR: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
switch (mode & ~0xf)
|
||||
{
|
||||
case 0: break; // ???
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR: break;
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR_ALL: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
u32 tid = GetCurrentPPUThread().GetId();
|
||||
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
if (ef->m_type == SYS_SYNC_WAITER_SINGLE && ef->waiters.size() > 0)
|
||||
{
|
||||
return CELL_EPERM;
|
||||
}
|
||||
EventFlagWaiter rec;
|
||||
rec.bitptn = bitptn;
|
||||
rec.mode = mode;
|
||||
rec.tid = tid;
|
||||
ef->waiters.push_back(rec);
|
||||
|
||||
if (ef->check() == tid)
|
||||
{
|
||||
u64 flags = ef->flags;
|
||||
|
||||
ef->waiters.erase(ef->waiters.end() - 1);
|
||||
|
||||
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
|
||||
{
|
||||
ef->flags &= ~bitptn;
|
||||
}
|
||||
else if (mode & SYS_EVENT_FLAG_WAIT_CLEAR_ALL)
|
||||
{
|
||||
ef->flags = 0;
|
||||
}
|
||||
|
||||
if (result.IsGood())
|
||||
{
|
||||
result = flags;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (!result.GetAddr())
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
u32 counter = 0;
|
||||
const u32 max_counter = timeout ? (timeout / 1000) : ~0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (ef->signal.unlock(tid, tid) == SMR_OK)
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
|
||||
u64 flags = ef->flags;
|
||||
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
if (ef->waiters[i].tid == tid)
|
||||
{
|
||||
ef->waiters.erase(ef->waiters.begin() +i);
|
||||
|
||||
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
|
||||
{
|
||||
ef->flags &= ~bitptn;
|
||||
}
|
||||
else if (mode & SYS_EVENT_FLAG_WAIT_CLEAR_ALL)
|
||||
{
|
||||
ef->flags = 0;
|
||||
}
|
||||
|
||||
if (u32 target = ef->check())
|
||||
{
|
||||
// if signal, leave both mutexes locked...
|
||||
ef->signal.unlock(tid, target);
|
||||
ef->m_mutex.unlock(tid, target);
|
||||
}
|
||||
else
|
||||
{
|
||||
ef->signal.unlock(tid);
|
||||
}
|
||||
|
||||
if (result.IsGood())
|
||||
{
|
||||
result = flags;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (!result.GetAddr())
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
ef->signal.unlock(tid);
|
||||
return CELL_ECANCELED;
|
||||
}
|
||||
|
||||
Sleep(1);
|
||||
|
||||
if (counter++ > max_counter)
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
if (ef->waiters[i].tid == tid)
|
||||
{
|
||||
ef->waiters.erase(ef->waiters.begin() + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CELL_ETIMEDOUT;
|
||||
}
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_event_flag_wait(id=%d) aborted", eflag_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result)
|
||||
{
|
||||
sys_event_flag.Log("sys_event_flag_trywait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x)",
|
||||
eflag_id, bitptn, mode, result.GetAddr());
|
||||
|
||||
if (result.IsGood()) result = 0;
|
||||
|
||||
switch (mode & 0xf)
|
||||
{
|
||||
case SYS_EVENT_FLAG_WAIT_AND: break;
|
||||
case SYS_EVENT_FLAG_WAIT_OR: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
switch (mode & ~0xf)
|
||||
{
|
||||
case 0: break; // ???
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR: break;
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR_ALL: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
|
||||
u64 flags = ef->flags;
|
||||
|
||||
if (((mode & SYS_EVENT_FLAG_WAIT_AND) && (flags & bitptn) == bitptn) ||
|
||||
((mode & SYS_EVENT_FLAG_WAIT_OR) && (flags & bitptn)))
|
||||
{
|
||||
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
|
||||
{
|
||||
ef->flags &= ~bitptn;
|
||||
}
|
||||
else if (mode & SYS_EVENT_FLAG_WAIT_CLEAR_ALL)
|
||||
{
|
||||
ef->flags = 0;
|
||||
}
|
||||
|
||||
if (result.IsGood())
|
||||
{
|
||||
result = flags;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (!result.GetAddr())
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
int sys_event_flag_set(u32 eflag_id, u64 bitptn)
|
||||
{
|
||||
sys_event_flag.Log("sys_event_flag_set(eflag_id=%d, bitptn=0x%llx)", eflag_id, bitptn);
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
u32 tid = GetCurrentPPUThread().GetId();
|
||||
|
||||
ef->m_mutex.lock(tid);
|
||||
ef->flags |= bitptn;
|
||||
if (u32 target = ef->check())
|
||||
{
|
||||
// if signal, leave both mutexes locked...
|
||||
ef->signal.lock(target);
|
||||
ef->m_mutex.unlock(tid, target);
|
||||
}
|
||||
else
|
||||
{
|
||||
ef->m_mutex.unlock(tid);
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_event_flag_clear(u32 eflag_id, u64 bitptn)
|
||||
{
|
||||
sys_event_flag.Log("sys_event_flag_clear(eflag_id=%d, bitptn=0x%llx)", eflag_id, bitptn);
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
ef->flags &= bitptn;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_event_flag_cancel(u32 eflag_id, mem32_t num)
|
||||
{
|
||||
sys_event_flag.Log("sys_event_flag_cancel(eflag_id=%d, num_addr=0x%x)", eflag_id, num.GetAddr());
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
std::vector<u32> tids;
|
||||
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
tids.resize(ef->waiters.size());
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
tids[i] = ef->waiters[i].tid;
|
||||
}
|
||||
ef->waiters.clear();
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < tids.size(); i++)
|
||||
{
|
||||
ef->signal.lock(tids[i]);
|
||||
}
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_event_flag_cancel(id=%d) aborted", eflag_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (num.IsGood())
|
||||
{
|
||||
num = tids.size();
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (!num.GetAddr())
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
int sys_event_flag_get(u32 eflag_id, mem64_t flags)
|
||||
{
|
||||
sys_event_flag.Log("sys_event_flag_get(eflag_id=%d, flags_addr=0x%x)", eflag_id, flags.GetAddr());
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event_flag.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
if (!flags.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
flags = ef->flags;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/GS/GCM.h"
|
||||
|
||||
extern Module cellGcmSys;
|
||||
extern gcmInfo gcm_info;
|
||||
|
||||
int cellGcmCallback(u32 context_addr, u32 count)
|
||||
{
|
||||
GSLockCurrent gslock(GS_LOCK_WAIT_FLUSH);
|
||||
|
||||
CellGcmContextData& ctx = (CellGcmContextData&)Memory[context_addr];
|
||||
CellGcmControl& ctrl = (CellGcmControl&)Memory[gcm_info.control_addr];
|
||||
|
||||
const s32 res = ctx.current - ctx.begin - ctrl.put;
|
||||
|
||||
if(res > 0) Memory.Copy(ctx.begin, ctx.current - res, res);
|
||||
|
||||
ctx.current = ctx.begin + res;
|
||||
|
||||
//InterlockedExchange64((volatile long long*)((u8*)&ctrl + offsetof(CellGcmControl, put)), (u64)(u32)re(res));
|
||||
ctrl.put = res;
|
||||
ctrl.get = 0;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
SysCallBase sc_heap("sys_heap");
|
||||
|
||||
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)
|
||||
{
|
||||
sc_heap.Warning("sys_heap_create_heap(heap_addr=0x%x, align=0x%x, size=0x%x)", heap_addr, align, size);
|
||||
|
||||
u32 heap_id = sc_heap.GetNewId(new HeapInfo(heap_addr, align, size));
|
||||
sc_heap.Warning("*** sys_heap created: id = %d", heap_id);
|
||||
return heap_id;
|
||||
}
|
||||
|
||||
int sys_heap_malloc(const u32 heap_id, const u32 size)
|
||||
{
|
||||
sc_heap.Warning("sys_heap_malloc(heap_id=%d, size=0x%x)", heap_id, size);
|
||||
|
||||
HeapInfo* heap;
|
||||
if(!sc_heap.CheckId(heap_id, heap)) return CELL_ESRCH;
|
||||
|
||||
return Memory.Alloc(size, 1);
|
||||
}
|
||||
|
||||
int _sys_heap_memalign(u32 heap_id, u32 align, u32 size)
|
||||
{
|
||||
sc_heap.Warning("_sys_heap_memalign(heap_id=%d, align=0x%x, size=0x%x)", heap_id, align, size);
|
||||
|
||||
HeapInfo* heap;
|
||||
if(!sc_heap.CheckId(heap_id, heap)) return CELL_ESRCH;
|
||||
|
||||
return Memory.Alloc(size, align);
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
#pragma once
|
|
@ -1,27 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
struct sys_lwcond_attribute_t
|
||||
{
|
||||
union
|
||||
{
|
||||
char name[8];
|
||||
u64 name_u64;
|
||||
};
|
||||
};
|
||||
|
||||
struct sys_lwcond_t
|
||||
{
|
||||
be_t<u32> lwmutex;
|
||||
be_t<u32> lwcond_queue;
|
||||
};
|
||||
|
||||
struct Lwcond
|
||||
{
|
||||
SMutex signal;
|
||||
SleepQueue m_queue;
|
||||
|
||||
Lwcond(u64 name)
|
||||
: m_queue(name)
|
||||
{
|
||||
}
|
||||
};
|
|
@ -1,423 +0,0 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "SC_Memory.h"
|
||||
#include <map>
|
||||
|
||||
SysCallBase sc_mem("memory");
|
||||
std::map<u32, u32> mmapper_info_map;
|
||||
|
||||
int sys_memory_allocate(u32 size, u32 flags, u32 alloc_addr_addr)
|
||||
{
|
||||
sc_mem.Log("sys_memory_allocate(size=0x%x, flags=0x%x)", size, flags);
|
||||
|
||||
// Check page size.
|
||||
u32 addr;
|
||||
switch(flags)
|
||||
{
|
||||
case SYS_MEMORY_PAGE_SIZE_1M:
|
||||
if(size & 0xfffff) return CELL_EALIGN;
|
||||
addr = Memory.Alloc(size, 0x100000);
|
||||
break;
|
||||
|
||||
case SYS_MEMORY_PAGE_SIZE_64K:
|
||||
if(size & 0xffff) return CELL_EALIGN;
|
||||
addr = Memory.Alloc(size, 0x10000);
|
||||
break;
|
||||
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if(!addr)
|
||||
return CELL_ENOMEM;
|
||||
|
||||
// Write back the start address of the allocated area.
|
||||
sc_mem.Log("Memory allocated! [addr: 0x%x, size: 0x%x]", addr, size);
|
||||
Memory.Write32(alloc_addr_addr, addr);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_memory_allocate_from_container(u32 size, u32 cid, u32 flags, u32 alloc_addr_addr)
|
||||
{
|
||||
sc_mem.Log("sys_memory_allocate_from_container(size=0x%x, cid=0x%x, flags=0x%x)", size, cid, flags);
|
||||
|
||||
// Check if this container ID is valid.
|
||||
MemoryContainerInfo* ct;
|
||||
if(!sc_mem.CheckId(cid, ct))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// Check page size.
|
||||
switch(flags)
|
||||
{
|
||||
case SYS_MEMORY_PAGE_SIZE_1M:
|
||||
if(size & 0xfffff) return CELL_EALIGN;
|
||||
ct->addr = Memory.Alloc(size, 0x100000);
|
||||
break;
|
||||
|
||||
case SYS_MEMORY_PAGE_SIZE_64K:
|
||||
if(size & 0xffff) return CELL_EALIGN;
|
||||
ct->addr = Memory.Alloc(size, 0x10000);
|
||||
break;
|
||||
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
// Store the address and size in the container.
|
||||
if(!ct->addr)
|
||||
return CELL_ENOMEM;
|
||||
ct->size = size;
|
||||
|
||||
// Write back the start address of the allocated area.
|
||||
sc_mem.Log("Memory allocated! [addr: 0x%x, size: 0x%x]", ct->addr, ct->size);
|
||||
Memory.Write32(alloc_addr_addr, ct->addr);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_memory_free(u32 start_addr)
|
||||
{
|
||||
sc_mem.Log("sys_memory_free(start_addr=0x%x)", start_addr);
|
||||
|
||||
// Release the allocated memory.
|
||||
if(!Memory.Free(start_addr))
|
||||
return CELL_EFAULT;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_memory_get_page_attribute(u32 addr, mem_ptr_t<sys_page_attr_t> attr)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_get_page_attribute(addr=0x%x, attr_addr=0x%x)", addr, attr.GetAddr());
|
||||
|
||||
if (!attr.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
// TODO: Implement per thread page attribute setting.
|
||||
attr->attribute = 0;
|
||||
attr->page_size = 0;
|
||||
attr->access_right = 0;
|
||||
attr->pad = 0;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_memory_get_user_memory_size(mem_ptr_t<sys_memory_info_t> mem_info)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_get_user_memory_size(mem_info_addr=0x%x)", mem_info.GetAddr());
|
||||
|
||||
// Fetch the user memory available.
|
||||
mem_info->total_user_memory = Memory.GetUserMemTotalSize();
|
||||
mem_info->available_user_memory = Memory.GetUserMemAvailSize();
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_memory_container_create(mem32_t cid, u32 yield_size)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_container_create(cid_addr=0x%x, yield_size=0x%x)", cid.GetAddr(), yield_size);
|
||||
|
||||
if (!cid.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
yield_size &= ~0xfffff; //round down to 1 MB granularity
|
||||
u64 addr = Memory.Alloc(yield_size, 0x100000); //1 MB alignment
|
||||
|
||||
if(!addr)
|
||||
return CELL_ENOMEM;
|
||||
|
||||
// Wrap the allocated memory in a memory container.
|
||||
MemoryContainerInfo *ct = new MemoryContainerInfo(addr, yield_size);
|
||||
cid = sc_mem.GetNewId(ct);
|
||||
procObjects.mem_objects.insert(cid);
|
||||
|
||||
sc_mem.Warning("*** memory_container created(addr=0x%llx): id = %d", addr, cid.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_memory_container_destroy(u32 cid)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_container_destroy(cid=%d)", cid);
|
||||
|
||||
// Check if this container ID is valid.
|
||||
MemoryContainerInfo* ct;
|
||||
if(!sc_mem.CheckId(cid, ct))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// Release the allocated memory and remove the ID.
|
||||
Memory.Free(ct->addr);
|
||||
Emu.GetIdManager().RemoveID(cid);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_memory_container_get_size(mem_ptr_t<sys_memory_info_t> mem_info, u32 cid)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_container_get_size(mem_info_addr=0x%x, cid=%d)", mem_info.GetAddr(), cid);
|
||||
|
||||
// Check if this container ID is valid.
|
||||
MemoryContainerInfo* ct;
|
||||
if(!sc_mem.CheckId(cid, ct))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// HACK: Return all memory.
|
||||
sys_memory_info_t info;
|
||||
mem_info->total_user_memory = ct->size;
|
||||
mem_info->available_user_memory = ct->size;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mmapper_allocate_address(u32 size, u64 flags, u32 alignment, u32 alloc_addr)
|
||||
{
|
||||
sc_mem.Warning("sys_mmapper_allocate_address(size=0x%x, flags=0x%llx, alignment=0x%x, alloc_addr=0x%x)",
|
||||
size, flags, alignment, alloc_addr);
|
||||
|
||||
if(!Memory.IsGoodAddr(alloc_addr))
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Check for valid alignment.
|
||||
if(alignment > 0x80000000)
|
||||
return CELL_EALIGN;
|
||||
|
||||
// Check page size.
|
||||
u32 addr;
|
||||
switch(flags & (SYS_MEMORY_PAGE_SIZE_1M | SYS_MEMORY_PAGE_SIZE_64K))
|
||||
{
|
||||
default:
|
||||
case SYS_MEMORY_PAGE_SIZE_1M:
|
||||
if(Memory.AlignAddr(size, alignment) & 0xfffff)
|
||||
return CELL_EALIGN;
|
||||
addr = Memory.Alloc(size, 0x100000);
|
||||
break;
|
||||
|
||||
case SYS_MEMORY_PAGE_SIZE_64K:
|
||||
if(Memory.AlignAddr(size, alignment) & 0xffff)
|
||||
return CELL_EALIGN;
|
||||
addr = Memory.Alloc(size, 0x10000);
|
||||
break;
|
||||
}
|
||||
|
||||
// Write back the start address of the allocated area.
|
||||
Memory.Write32(alloc_addr, addr);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mmapper_allocate_fixed_address()
|
||||
{
|
||||
sc_mem.Warning("sys_mmapper_allocate_fixed_address");
|
||||
|
||||
// Allocate a fixed size from user memory.
|
||||
if (!Memory.Alloc(SYS_MMAPPER_FIXED_SIZE, 0x100000))
|
||||
return CELL_EEXIST;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mmapper_allocate_memory(u32 size, u64 flags, mem32_t mem_id)
|
||||
{
|
||||
sc_mem.Warning("sys_mmapper_allocate_memory(size=0x%x, flags=0x%llx, mem_id_addr=0x%x)", size, flags, mem_id.GetAddr());
|
||||
|
||||
if(!mem_id.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Check page granularity.
|
||||
u32 addr;
|
||||
switch(flags & (SYS_MEMORY_PAGE_SIZE_1M | SYS_MEMORY_PAGE_SIZE_64K))
|
||||
{
|
||||
case SYS_MEMORY_PAGE_SIZE_1M:
|
||||
if(size & 0xfffff)
|
||||
return CELL_EALIGN;
|
||||
addr = Memory.Alloc(size, 0x100000);
|
||||
break;
|
||||
|
||||
case SYS_MEMORY_PAGE_SIZE_64K:
|
||||
if(size & 0xffff)
|
||||
return CELL_EALIGN;
|
||||
addr = Memory.Alloc(size, 0x10000);
|
||||
break;
|
||||
|
||||
default:
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if(!addr)
|
||||
return CELL_ENOMEM;
|
||||
|
||||
// Generate a new mem ID.
|
||||
mem_id = sc_mem.GetNewId(new mmapper_info(addr, size, flags));
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mmapper_allocate_memory_from_container(u32 size, u32 cid, u64 flags, mem32_t mem_id)
|
||||
{
|
||||
sc_mem.Warning("sys_mmapper_allocate_memory_from_container(size=0x%x, cid=%d, flags=0x%llx, mem_id_addr=0x%x)",
|
||||
size, cid, flags, mem_id.GetAddr());
|
||||
|
||||
if(!mem_id.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Check if this container ID is valid.
|
||||
MemoryContainerInfo* ct;
|
||||
if(!sc_mem.CheckId(cid, ct))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// Check page granularity.
|
||||
switch(flags & (SYS_MEMORY_PAGE_SIZE_1M | SYS_MEMORY_PAGE_SIZE_64K))
|
||||
{
|
||||
case SYS_MEMORY_PAGE_SIZE_1M:
|
||||
if(size & 0xfffff)
|
||||
return CELL_EALIGN;
|
||||
ct->addr = Memory.Alloc(size, 0x100000);
|
||||
break;
|
||||
|
||||
case SYS_MEMORY_PAGE_SIZE_64K:
|
||||
if(size & 0xffff)
|
||||
return CELL_EALIGN;
|
||||
ct->addr = Memory.Alloc(size, 0x10000);
|
||||
break;
|
||||
|
||||
default:
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if(!ct->addr)
|
||||
return CELL_ENOMEM;
|
||||
ct->size = size;
|
||||
|
||||
// Generate a new mem ID.
|
||||
mem_id = sc_mem.GetNewId(new mmapper_info(ct->addr, ct->size, flags));
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mmapper_change_address_access_right(u32 start_addr, u64 flags)
|
||||
{
|
||||
sc_mem.Warning("sys_mmapper_change_address_access_right(start_addr=0x%x, flags=0x%llx)", start_addr, flags);
|
||||
|
||||
if (!Memory.IsGoodAddr(start_addr))
|
||||
return CELL_EINVAL;
|
||||
|
||||
// TODO
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mmapper_free_address(u32 start_addr)
|
||||
{
|
||||
sc_mem.Warning("sys_mmapper_free_address(start_addr=0x%x)", start_addr);
|
||||
|
||||
if(!Memory.IsGoodAddr(start_addr))
|
||||
return CELL_EINVAL;
|
||||
|
||||
// Free the address.
|
||||
Memory.Free(start_addr);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mmapper_free_memory(u32 mem_id)
|
||||
{
|
||||
sc_mem.Warning("sys_mmapper_free_memory(mem_id=0x%x)", mem_id);
|
||||
|
||||
// Check if this mem ID is valid.
|
||||
mmapper_info* info;
|
||||
if(!sc_mem.CheckId(mem_id, info))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// Release the allocated memory and remove the ID.
|
||||
Memory.Free(info->addr);
|
||||
Emu.GetIdManager().RemoveID(mem_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mmapper_map_memory(u32 start_addr, u32 mem_id, u64 flags)
|
||||
{
|
||||
sc_mem.Warning("sys_mmapper_map_memory(start_addr=0x%x, mem_id=0x%x, flags=0x%llx)", start_addr, mem_id, flags);
|
||||
|
||||
// Check if this mem ID is valid.
|
||||
mmapper_info* info;
|
||||
if(!sc_mem.CheckId(mem_id, info))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// Map the memory into the process address.
|
||||
if(!Memory.Map(start_addr, info->addr, info->size))
|
||||
sc_mem.Error("sys_mmapper_map_memory failed!");
|
||||
|
||||
// Keep track of mapped addresses.
|
||||
mmapper_info_map[mem_id] = start_addr;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mmapper_search_and_map(u32 start_addr, u32 mem_id, u64 flags, u32 alloc_addr)
|
||||
{
|
||||
sc_mem.Warning("sys_mmapper_search_and_map(start_addr=0x%x, mem_id=0x%x, flags=0x%llx, alloc_addr=0x%x)",
|
||||
start_addr, mem_id, flags, alloc_addr);
|
||||
|
||||
if(!Memory.IsGoodAddr(alloc_addr))
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Check if this mem ID is valid.
|
||||
mmapper_info* info;
|
||||
if(!sc_mem.CheckId(mem_id, info))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// Search for a mappable address.
|
||||
u32 addr;
|
||||
bool found;
|
||||
for (int i = 0; i < SYS_MMAPPER_FIXED_SIZE; i += 0x100000)
|
||||
{
|
||||
addr = start_addr + i;
|
||||
found = Memory.Map(addr, info->addr, info->size);
|
||||
if(found)
|
||||
{
|
||||
sc_mem.Warning("Found and mapped address 0x%x", addr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the address is valid.
|
||||
if (!Memory.IsGoodAddr(addr) || !found)
|
||||
return CELL_ENOMEM;
|
||||
|
||||
// Write back the start address of the allocated area.
|
||||
Memory.Write32(alloc_addr, addr);
|
||||
|
||||
// Keep track of mapped addresses.
|
||||
mmapper_info_map[mem_id] = addr;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mmapper_unmap_memory(u32 start_addr, u32 mem_id_addr)
|
||||
{
|
||||
sc_mem.Warning("sys_mmapper_unmap_memory(start_addr=0x%x, mem_id_addr=0x%x)", start_addr, mem_id_addr);
|
||||
|
||||
if (!Memory.IsGoodAddr(start_addr))
|
||||
return CELL_EINVAL;
|
||||
|
||||
if (!Memory.IsGoodAddr(mem_id_addr))
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Write back the mem ID of the unmapped area.
|
||||
u32 mem_id = mmapper_info_map.find(start_addr)->first;
|
||||
Memory.Write32(mem_id_addr, mem_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mmapper_enable_page_fault_notification(u32 start_addr, u32 q_id)
|
||||
{
|
||||
sc_mem.Warning("sys_mmapper_enable_page_fault_notification(start_addr=0x%x, q_id=0x%x)", start_addr, q_id);
|
||||
|
||||
if (!Memory.IsGoodAddr(start_addr))
|
||||
return CELL_EINVAL;
|
||||
|
||||
// TODO
|
||||
|
||||
return CELL_OK;
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
u32 LoadSpuImage(vfsStream& stream, u32& spu_ep);
|
||||
|
||||
enum
|
||||
{
|
||||
SYS_SPU_THREAD_GROUP_JOIN_GROUP_EXIT = 0x0001,
|
||||
SYS_SPU_THREAD_GROUP_JOIN_ALL_THREADS_EXIT = 0x0002,
|
||||
SYS_SPU_THREAD_GROUP_JOIN_TERMINATED = 0x0004
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SYS_SPU_SEGMENT_TYPE_COPY = 0x0001,
|
||||
SYS_SPU_SEGMENT_TYPE_FILL = 0x0002,
|
||||
SYS_SPU_SEGMENT_TYPE_INFO = 0x0004,
|
||||
};
|
||||
|
||||
struct sys_spu_thread_group_attribute
|
||||
{
|
||||
be_t<u32> name_len;
|
||||
be_t<u32> name_addr;
|
||||
be_t<int> type;
|
||||
/* struct {} option; */
|
||||
be_t<u32> ct; // memory container id
|
||||
};
|
||||
|
||||
struct sys_spu_thread_attribute
|
||||
{
|
||||
be_t<u32> name_addr;
|
||||
be_t<u32> name_len;
|
||||
be_t<u32> option;
|
||||
};
|
||||
|
||||
struct sys_spu_thread_argument
|
||||
{
|
||||
be_t<u64> arg1;
|
||||
be_t<u64> arg2;
|
||||
be_t<u64> arg3;
|
||||
be_t<u64> arg4;
|
||||
};
|
||||
|
||||
struct sys_spu_image
|
||||
{
|
||||
be_t<u32> type;
|
||||
be_t<u32> entry_point;
|
||||
be_t<u32> segs_addr; //temporarily used as offset of LS image after elf loading
|
||||
be_t<int> nsegs;
|
||||
};
|
||||
|
||||
struct sys_spu_segment
|
||||
{
|
||||
be_t<int> type;
|
||||
be_t<u32> ls_start;
|
||||
be_t<int> size;
|
||||
be_t<u64> src;
|
||||
};
|
||||
|
||||
struct SpuGroupInfo
|
||||
{
|
||||
std::vector<u32> list;
|
||||
std::atomic<u32> lock;
|
||||
std::string m_name;
|
||||
int m_prio;
|
||||
int m_type;
|
||||
int m_ct;
|
||||
|
||||
SpuGroupInfo(const std::string& name, u32 num, int prio, int type, u32 ct)
|
||||
: m_name(name)
|
||||
, m_prio(prio)
|
||||
, m_type(type)
|
||||
, m_ct(ct)
|
||||
, lock(0)
|
||||
{
|
||||
num = 256;
|
||||
list.resize(num);
|
||||
for (u32 i = 0; i < num; i++)
|
||||
{
|
||||
list[i] = 0;
|
||||
}
|
||||
}
|
||||
};
|
|
@ -1,6 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
struct spinlock
|
||||
{
|
||||
SMutexBE mutex;
|
||||
};
|
|
@ -1,4 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
u64 get_time();
|
||||
u64 get_system_time();
|
|
@ -1,23 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
SYS_TIMER_STATE_STOP = 0x00U,
|
||||
SYS_TIMER_STATE_RUN = 0x01U,
|
||||
};
|
||||
|
||||
struct sys_timer_information_t
|
||||
{
|
||||
s64 next_expiration_time; //system_time_t
|
||||
u64 period; //usecond_t
|
||||
u32 timer_state;
|
||||
u32 pad;
|
||||
};
|
||||
|
||||
struct timer
|
||||
{
|
||||
rTimer tmr;
|
||||
sys_timer_information_t timer_information_t;
|
||||
};
|
||||
|
||||
#pragma pack()
|
|
@ -1,23 +0,0 @@
|
|||
#if 0
|
||||
#include "stdafx.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
static SysCallBase sc_spu("sys_spu");
|
||||
|
||||
u32 _max_usable_spu = 0;
|
||||
u32 _max_raw_spu = 0;
|
||||
|
||||
int sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu)
|
||||
{
|
||||
sc_spu.Log("sys_spu_initialize(max_usable_spu=%d, max_raw_spu=%d)", max_usable_spu, max_raw_spu);
|
||||
_max_usable_spu = max_usable_spu;
|
||||
_max_raw_spu = max_raw_spu;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_raw_spu_create(u32 id_addr, u32 attr_addr)
|
||||
{
|
||||
Memory.Write32(id_addr, Emu.GetIdManager().GetNewID("raw_spu"));
|
||||
return CELL_OK;
|
||||
}
|
||||
#endif
|
|
@ -8,7 +8,7 @@
|
|||
#include "Emu/FS/vfsFile.h"
|
||||
#include "Emu/FS/vfsDir.h"
|
||||
|
||||
#include "SC_FileSystem.h"
|
||||
#include "lv2Fs.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
|
||||
extern Module *sys_fs;
|
||||
|
@ -52,7 +52,7 @@ struct FsRingBufferConfig
|
|||
} m_fs_config;
|
||||
|
||||
|
||||
int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
|
||||
s32 cellFsOpen(u32 path_addr, s32 flags, mem32_t fd, mem32_t arg, u64 size)
|
||||
{
|
||||
const std::string& path = Memory.ReadString(path_addr);
|
||||
sys_fs->Log("cellFsOpen(path=\"%s\", flags=0x%x, fd_addr=0x%x, arg_addr=0x%x, size=0x%llx)",
|
||||
|
@ -137,7 +137,7 @@ int cellFsOpen(u32 path_addr, int flags, mem32_t fd, mem32_t arg, u64 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nread)
|
||||
s32 cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nread)
|
||||
{
|
||||
sys_fs->Log("cellFsRead(fd=%d, buf_addr=0x%x, nbytes=0x%llx, nread_addr=0x%x)",
|
||||
fd, buf_addr, nbytes, nread.GetAddr());
|
||||
|
@ -185,7 +185,7 @@ fin:
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nwrite)
|
||||
s32 cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nwrite)
|
||||
{
|
||||
sys_fs->Log("cellFsWrite(fd=%d, buf_addr=0x%x, nbytes=0x%llx, nwrite_addr=0x%x)",
|
||||
fd, buf_addr, nbytes, nwrite.GetAddr());
|
||||
|
@ -206,7 +206,7 @@ int cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nwrite)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsClose(u32 fd)
|
||||
s32 cellFsClose(u32 fd)
|
||||
{
|
||||
sys_fs->Warning("cellFsClose(fd=%d)", fd);
|
||||
|
||||
|
@ -216,7 +216,7 @@ int cellFsClose(u32 fd)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsOpendir(u32 path_addr, mem32_t fd)
|
||||
s32 cellFsOpendir(u32 path_addr, mem32_t fd)
|
||||
{
|
||||
const std::string& path = Memory.ReadString(path_addr);
|
||||
sys_fs->Warning("cellFsOpendir(path=\"%s\", fd_addr=0x%x)", path.c_str(), fd.GetAddr());
|
||||
|
@ -235,7 +235,7 @@ int cellFsOpendir(u32 path_addr, mem32_t fd)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsReaddir(u32 fd, mem_ptr_t<CellFsDirent> dir, mem64_t nread)
|
||||
s32 cellFsReaddir(u32 fd, mem_ptr_t<CellFsDirent> dir, mem64_t nread)
|
||||
{
|
||||
sys_fs->Log("cellFsReaddir(fd=%d, dir_addr=0x%x, nread_addr=0x%x)", fd, dir.GetAddr(), nread.GetAddr());
|
||||
|
||||
|
@ -261,7 +261,7 @@ int cellFsReaddir(u32 fd, mem_ptr_t<CellFsDirent> dir, mem64_t nread)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsClosedir(u32 fd)
|
||||
s32 cellFsClosedir(u32 fd)
|
||||
{
|
||||
sys_fs->Log("cellFsClosedir(fd=%d)", fd);
|
||||
|
||||
|
@ -271,7 +271,7 @@ int cellFsClosedir(u32 fd)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsStat(const u32 path_addr, mem_ptr_t<CellFsStat> sb)
|
||||
s32 cellFsStat(const u32 path_addr, mem_ptr_t<CellFsStat> sb)
|
||||
{
|
||||
const std::string& path = Memory.ReadString(path_addr);
|
||||
sys_fs->Log("cellFsStat(path=\"%s\", sb_addr: 0x%x)", path.c_str(), sb.GetAddr());
|
||||
|
@ -311,7 +311,7 @@ int cellFsStat(const u32 path_addr, mem_ptr_t<CellFsStat> sb)
|
|||
return CELL_ENOENT;
|
||||
}
|
||||
|
||||
int cellFsFstat(u32 fd, mem_ptr_t<CellFsStat> sb)
|
||||
s32 cellFsFstat(u32 fd, mem_ptr_t<CellFsStat> sb)
|
||||
{
|
||||
sys_fs->Log("cellFsFstat(fd=%d, sb_addr: 0x%x)", fd, sb.GetAddr());
|
||||
|
||||
|
@ -336,7 +336,7 @@ int cellFsFstat(u32 fd, mem_ptr_t<CellFsStat> sb)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsMkdir(u32 path_addr, u32 mode)
|
||||
s32 cellFsMkdir(u32 path_addr, u32 mode)
|
||||
{
|
||||
const std::string& ps3_path = Memory.ReadString(path_addr);
|
||||
sys_fs->Log("cellFsMkdir(path=\"%s\", mode=0x%x)", ps3_path.c_str(), mode);
|
||||
|
@ -355,7 +355,7 @@ int cellFsMkdir(u32 path_addr, u32 mode)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsRename(u32 from_addr, u32 to_addr)
|
||||
s32 cellFsRename(u32 from_addr, u32 to_addr)
|
||||
{
|
||||
const std::string& ps3_from = Memory.ReadString(from_addr);
|
||||
const std::string& ps3_to = Memory.ReadString(to_addr);
|
||||
|
@ -385,7 +385,7 @@ int cellFsRename(u32 from_addr, u32 to_addr)
|
|||
return CELL_ENOENT;
|
||||
}
|
||||
|
||||
int cellFsRmdir(u32 path_addr)
|
||||
s32 cellFsRmdir(u32 path_addr)
|
||||
{
|
||||
const std::string& ps3_path = Memory.ReadString(path_addr);
|
||||
sys_fs->Log("cellFsRmdir(path=\"%s\")", ps3_path.c_str());
|
||||
|
@ -400,7 +400,7 @@ int cellFsRmdir(u32 path_addr)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsUnlink(u32 path_addr)
|
||||
s32 cellFsUnlink(u32 path_addr)
|
||||
{
|
||||
const std::string& ps3_path = Memory.ReadString(path_addr);
|
||||
sys_fs->Warning("cellFsUnlink(path=\"%s\")", ps3_path.c_str());
|
||||
|
@ -420,7 +420,7 @@ int cellFsUnlink(u32 path_addr)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsLseek(u32 fd, s64 offset, u32 whence, mem64_t pos)
|
||||
s32 cellFsLseek(u32 fd, s64 offset, u32 whence, mem64_t pos)
|
||||
{
|
||||
vfsSeekMode seek_mode;
|
||||
sys_fs->Log("cellFsLseek(fd=%d, offset=0x%llx, whence=0x%x, pos_addr=0x%x)", fd, offset, whence, pos.GetAddr());
|
||||
|
@ -441,7 +441,7 @@ int cellFsLseek(u32 fd, s64 offset, u32 whence, mem64_t pos)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsFtruncate(u32 fd, u64 size)
|
||||
s32 cellFsFtruncate(u32 fd, u64 size)
|
||||
{
|
||||
sys_fs->Log("cellFsFtruncate(fd=%d, size=%lld)", fd, size);
|
||||
u32 attr;
|
||||
|
@ -467,7 +467,7 @@ int cellFsFtruncate(u32 fd, u64 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsTruncate(u32 path_addr, u64 size)
|
||||
s32 cellFsTruncate(u32 path_addr, u64 size)
|
||||
{
|
||||
const std::string& path = Memory.ReadString(path_addr);
|
||||
sys_fs->Log("cellFsTruncate(path=\"%s\", size=%lld)", path.c_str(), size);
|
||||
|
@ -498,7 +498,7 @@ int cellFsTruncate(u32 path_addr, u64 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsFGetBlockSize(u32 fd, mem64_t sector_size, mem64_t block_size)
|
||||
s32 cellFsFGetBlockSize(u32 fd, mem64_t sector_size, mem64_t block_size)
|
||||
{
|
||||
sys_fs->Log("cellFsFGetBlockSize(fd=%d, sector_size_addr: 0x%x, block_size_addr: 0x%x)", fd, sector_size.GetAddr(), block_size.GetAddr());
|
||||
|
||||
|
@ -511,7 +511,7 @@ int cellFsFGetBlockSize(u32 fd, mem64_t sector_size, mem64_t block_size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsGetBlockSize(u32 path_addr, mem64_t sector_size, mem64_t block_size)
|
||||
s32 cellFsGetBlockSize(u32 path_addr, mem64_t sector_size, mem64_t block_size)
|
||||
{
|
||||
sys_fs->Log("cellFsGetBlockSize(file: %s, sector_size_addr: 0x%x, block_size_addr: 0x%x)", Memory.ReadString(path_addr).c_str(), sector_size.GetAddr(), block_size.GetAddr());
|
||||
|
||||
|
@ -521,7 +521,7 @@ int cellFsGetBlockSize(u32 path_addr, mem64_t sector_size, mem64_t block_size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count)
|
||||
s32 cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count)
|
||||
{
|
||||
const std::string& ps3_path = Memory.ReadString(path_addr);
|
||||
sys_fs->Warning("cellFsGetFreeSize(path=\"%s\", block_size_addr=0x%x, block_count_addr=0x%x)",
|
||||
|
@ -540,7 +540,7 @@ int cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsGetDirectoryEntries(u32 fd, mem_ptr_t<CellFsDirectoryEntry> entries, u32 entries_size, mem32_t data_count)
|
||||
s32 cellFsGetDirectoryEntries(u32 fd, mem_ptr_t<CellFsDirectoryEntry> entries, u32 entries_size, mem32_t data_count)
|
||||
{
|
||||
sys_fs->Log("cellFsGetDirectoryEntries(fd=%d, entries_addr=0x%x, entries_size = 0x%x, data_count_addr=0x%x)", fd, entries.GetAddr(), entries_size, data_count.GetAddr());
|
||||
|
||||
|
@ -578,7 +578,7 @@ int cellFsGetDirectoryEntries(u32 fd, mem_ptr_t<CellFsDirectoryEntry> entries, u
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsStReadInit(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf)
|
||||
s32 cellFsStReadInit(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf)
|
||||
{
|
||||
sys_fs->Warning("cellFsStReadInit(fd=%d, ringbuf_addr=0x%x)", fd, ringbuf.GetAddr());
|
||||
|
||||
|
@ -608,7 +608,7 @@ int cellFsStReadInit(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsStReadFinish(u32 fd)
|
||||
s32 cellFsStReadFinish(u32 fd)
|
||||
{
|
||||
sys_fs->Warning("cellFsStReadFinish(fd=%d)", fd);
|
||||
|
||||
|
@ -621,7 +621,7 @@ int cellFsStReadFinish(u32 fd)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsStReadGetRingBuf(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf)
|
||||
s32 cellFsStReadGetRingBuf(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf)
|
||||
{
|
||||
sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, ringbuf_addr=0x%x)", fd, ringbuf.GetAddr());
|
||||
|
||||
|
@ -643,7 +643,7 @@ int cellFsStReadGetRingBuf(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsStReadGetStatus(u32 fd, mem64_t status)
|
||||
s32 cellFsStReadGetStatus(u32 fd, mem64_t status)
|
||||
{
|
||||
sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, status_addr=0x%x)", fd, status.GetAddr());
|
||||
|
||||
|
@ -655,7 +655,7 @@ int cellFsStReadGetStatus(u32 fd, mem64_t status)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsStReadGetRegid(u32 fd, mem64_t regid)
|
||||
s32 cellFsStReadGetRegid(u32 fd, mem64_t regid)
|
||||
{
|
||||
sys_fs->Warning("cellFsStReadGetRingBuf(fd=%d, regid_addr=0x%x)", fd, regid.GetAddr());
|
||||
|
||||
|
@ -667,7 +667,7 @@ int cellFsStReadGetRegid(u32 fd, mem64_t regid)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsStReadStart(u32 fd, u64 offset, u64 size)
|
||||
s32 cellFsStReadStart(u32 fd, u64 offset, u64 size)
|
||||
{
|
||||
sys_fs->Warning("TODO: cellFsStReadStart(fd=%d, offset=0x%llx, size=0x%llx)", fd, offset, size);
|
||||
|
||||
|
@ -680,7 +680,7 @@ int cellFsStReadStart(u32 fd, u64 offset, u64 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsStReadStop(u32 fd)
|
||||
s32 cellFsStReadStop(u32 fd)
|
||||
{
|
||||
sys_fs->Warning("cellFsStReadStop(fd=%d)", fd);
|
||||
|
||||
|
@ -692,7 +692,7 @@ int cellFsStReadStop(u32 fd)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsStRead(u32 fd, u32 buf_addr, u64 size, mem64_t rsize)
|
||||
s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, mem64_t rsize)
|
||||
{
|
||||
sys_fs->Warning("TODO: cellFsStRead(fd=%d, buf_addr=0x%x, size=0x%llx, rsize_addr = 0x%x)", fd, buf_addr, size, rsize.GetAddr());
|
||||
|
||||
|
@ -707,7 +707,7 @@ int cellFsStRead(u32 fd, u32 buf_addr, u64 size, mem64_t rsize)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, mem64_t size)
|
||||
s32 cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, mem64_t size)
|
||||
{
|
||||
sys_fs->Warning("TODO: cellFsStReadGetCurrentAddr(fd=%d, addr_addr=0x%x, size_addr = 0x%x)", fd, addr_addr.GetAddr(), size.GetAddr());
|
||||
|
||||
|
@ -719,7 +719,7 @@ int cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, mem64_t size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size)
|
||||
s32 cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size)
|
||||
{
|
||||
sys_fs->Warning("TODO: cellFsStReadPutCurrentAddr(fd=%d, addr_addr=0x%x, size = 0x%llx)", fd, addr_addr, size);
|
||||
|
||||
|
@ -731,7 +731,7 @@ int cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsStReadWait(u32 fd, u64 size)
|
||||
s32 cellFsStReadWait(u32 fd, u64 size)
|
||||
{
|
||||
sys_fs->Warning("TODO: cellFsStReadWait(fd=%d, size = 0x%llx)", fd, size);
|
||||
|
||||
|
@ -741,7 +741,7 @@ int cellFsStReadWait(u32 fd, u64 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int cellFsStReadWaitCallback(u32 fd, u64 size, mem_func_ptr_t<void (*)(int xfd, u64 xsize)> func)
|
||||
s32 cellFsStReadWaitCallback(u32 fd, u64 size, mem_func_ptr_t<void (*)(int xfd, u64 xsize)> func)
|
||||
{
|
||||
sys_fs->Warning("TODO: cellFsStReadWaitCallback(fd=%d, size = 0x%llx, func_addr = 0x%x)", fd, size, func.GetAddr());
|
||||
|
||||
|
@ -752,4 +752,4 @@ int cellFsStReadWaitCallback(u32 fd, u64 size, mem_func_ptr_t<void (*)(int xfd,
|
|||
if(!sys_fs->CheckId(fd, file)) return CELL_ESRCH;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
|
@ -122,3 +122,37 @@ struct CellFsRingBuffer
|
|||
be_t<u64> transfer_rate;
|
||||
be_t<u32> copy;
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
s32 cellFsOpen(u32 path_addr, s32 flags, mem32_t fd, mem32_t arg, u64 size);
|
||||
s32 cellFsRead(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nread);
|
||||
s32 cellFsWrite(u32 fd, u32 buf_addr, u64 nbytes, mem64_t nwrite);
|
||||
s32 cellFsClose(u32 fd);
|
||||
s32 cellFsOpendir(u32 path_addr, mem32_t fd);
|
||||
s32 cellFsReaddir(u32 fd, mem_ptr_t<CellFsDirent> dir, mem64_t nread);
|
||||
s32 cellFsClosedir(u32 fd);
|
||||
s32 cellFsStat(u32 path_addr, mem_ptr_t<CellFsStat> sb);
|
||||
s32 cellFsFstat(u32 fd, mem_ptr_t<CellFsStat> sb);
|
||||
s32 cellFsMkdir(u32 path_addr, u32 mode);
|
||||
s32 cellFsRename(u32 from_addr, u32 to_addr);
|
||||
s32 cellFsRmdir(u32 path_addr);
|
||||
s32 cellFsUnlink(u32 path_addr);
|
||||
s32 cellFsLseek(u32 fd, s64 offset, u32 whence, mem64_t pos);
|
||||
s32 cellFsFtruncate(u32 fd, u64 size);
|
||||
s32 cellFsTruncate(u32 path_addr, u64 size);
|
||||
s32 cellFsFGetBlockSize(u32 fd, mem64_t sector_size, mem64_t block_size);
|
||||
s32 cellFsGetBlockSize(u32 path_addr, mem64_t sector_size, mem64_t block_size);
|
||||
s32 cellFsGetFreeSize(u32 path_addr, mem32_t block_size, mem64_t block_count);
|
||||
s32 cellFsGetDirectoryEntries(u32 fd, mem_ptr_t<CellFsDirectoryEntry> entries, u32 entries_size, mem32_t data_count);
|
||||
s32 cellFsStReadInit(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf);
|
||||
s32 cellFsStReadFinish(u32 fd);
|
||||
s32 cellFsStReadGetRingBuf(u32 fd, mem_ptr_t<CellFsRingBuffer> ringbuf);
|
||||
s32 cellFsStReadGetStatus(u32 fd, mem64_t status);
|
||||
s32 cellFsStReadGetRegid(u32 fd, mem64_t regid);
|
||||
s32 cellFsStReadStart(u32 fd, u64 offset, u64 size);
|
||||
s32 cellFsStReadStop(u32 fd);
|
||||
s32 cellFsStRead(u32 fd, u32 buf_addr, u64 size, mem64_t rsize);
|
||||
s32 cellFsStReadGetCurrentAddr(u32 fd, mem32_t addr_addr, mem64_t size);
|
||||
s32 cellFsStReadPutCurrentAddr(u32 fd, u32 addr_addr, u64 size);
|
||||
s32 cellFsStReadWait(u32 fd, u64 size);
|
||||
s32 cellFsStReadWaitCallback(u32 fd, u64 size, mem_func_ptr_t<void (*)(int xfd, u64 xsize)> func);
|
|
@ -5,11 +5,11 @@
|
|||
#include "Emu/Cell/PPUThread.h"
|
||||
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Condition.h"
|
||||
#include "sys_cond.h"
|
||||
|
||||
SysCallBase sys_cond("sys_cond");
|
||||
|
||||
int sys_cond_create(mem32_t cond_id, u32 mutex_id, mem_ptr_t<sys_cond_attribute> attr)
|
||||
s32 sys_cond_create(mem32_t cond_id, u32 mutex_id, mem_ptr_t<sys_cond_attribute> attr)
|
||||
{
|
||||
sys_cond.Log("sys_cond_create(cond_id_addr=0x%x, mutex_id=%d, attr_addr=0x%x)",
|
||||
cond_id.GetAddr(), mutex_id, attr.GetAddr());
|
||||
|
@ -45,7 +45,7 @@ int sys_cond_create(mem32_t cond_id, u32 mutex_id, mem_ptr_t<sys_cond_attribute>
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_cond_destroy(u32 cond_id)
|
||||
s32 sys_cond_destroy(u32 cond_id)
|
||||
{
|
||||
sys_cond.Warning("sys_cond_destroy(cond_id=%d)", cond_id);
|
||||
|
||||
|
@ -65,7 +65,7 @@ int sys_cond_destroy(u32 cond_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_cond_signal(u32 cond_id)
|
||||
s32 sys_cond_signal(u32 cond_id)
|
||||
{
|
||||
sys_cond.Log("sys_cond_signal(cond_id=%d)", cond_id);
|
||||
|
||||
|
@ -92,7 +92,7 @@ int sys_cond_signal(u32 cond_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_cond_signal_all(u32 cond_id)
|
||||
s32 sys_cond_signal_all(u32 cond_id)
|
||||
{
|
||||
sys_cond.Log("sys_cond_signal_all(cond_id=%d)", cond_id);
|
||||
|
||||
|
@ -122,7 +122,7 @@ int sys_cond_signal_all(u32 cond_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_cond_signal_to(u32 cond_id, u32 thread_id)
|
||||
s32 sys_cond_signal_to(u32 cond_id, u32 thread_id)
|
||||
{
|
||||
sys_cond.Log("sys_cond_signal_to(cond_id=%d, thread_id=%d)", cond_id, thread_id);
|
||||
|
||||
|
@ -159,7 +159,7 @@ int sys_cond_signal_to(u32 cond_id, u32 thread_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_cond_wait(u32 cond_id, u64 timeout)
|
||||
s32 sys_cond_wait(u32 cond_id, u64 timeout)
|
||||
{
|
||||
sys_cond.Log("sys_cond_wait(cond_id=%d, timeout=%lld)", cond_id, timeout);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "SC_Mutex.h"
|
||||
#include "sys_mutex.h"
|
||||
|
||||
struct sys_cond_attribute
|
||||
{
|
||||
|
@ -28,4 +28,12 @@ struct Cond
|
|||
, signaler(0)
|
||||
{
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
s32 sys_cond_create(mem32_t cond_id, u32 mutex_id, mem_ptr_t<sys_cond_attribute> attr);
|
||||
s32 sys_cond_destroy(u32 cond_id);
|
||||
s32 sys_cond_wait(u32 cond_id, u64 timeout);
|
||||
s32 sys_cond_signal(u32 cond_id);
|
||||
s32 sys_cond_signal_all(u32 cond_id);
|
||||
s32 sys_cond_signal_to(u32 cond_id, u32 thread_id);
|
|
@ -6,12 +6,14 @@
|
|||
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/Cell/SPUThread.h"
|
||||
#include "Emu/event.h"
|
||||
#include "Emu/Event.h"
|
||||
|
||||
#include "sys_lwmutex.h"
|
||||
#include "sys_event.h"
|
||||
|
||||
SysCallBase sys_event("sys_event");
|
||||
|
||||
//128
|
||||
int sys_event_queue_create(mem32_t equeue_id, mem_ptr_t<sys_event_queue_attr> attr, u64 event_queue_key, int size)
|
||||
s32 sys_event_queue_create(mem32_t equeue_id, mem_ptr_t<sys_event_queue_attr> attr, u64 event_queue_key, int size)
|
||||
{
|
||||
sys_event.Warning("sys_event_queue_create(equeue_id_addr=0x%x, attr_addr=0x%x, event_queue_key=0x%llx, size=%d)",
|
||||
equeue_id.GetAddr(), attr.GetAddr(), event_queue_key, size);
|
||||
|
@ -62,7 +64,7 @@ int sys_event_queue_create(mem32_t equeue_id, mem_ptr_t<sys_event_queue_attr> at
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_event_queue_destroy(u32 equeue_id, int mode)
|
||||
s32 sys_event_queue_destroy(u32 equeue_id, int mode)
|
||||
{
|
||||
sys_event.Error("sys_event_queue_destroy(equeue_id=%d, mode=0x%x)", equeue_id, mode);
|
||||
|
||||
|
@ -107,7 +109,7 @@ int sys_event_queue_destroy(u32 equeue_id, int mode)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_event_queue_tryreceive(u32 equeue_id, mem_ptr_t<sys_event_data> event_array, int size, mem32_t number)
|
||||
s32 sys_event_queue_tryreceive(u32 equeue_id, mem_ptr_t<sys_event_data> event_array, int size, mem32_t number)
|
||||
{
|
||||
sys_event.Error("sys_event_queue_tryreceive(equeue_id=%d, event_array_addr=0x%x, size=%d, number_addr=0x%x)",
|
||||
equeue_id, event_array.GetAddr(), size, number.GetAddr());
|
||||
|
@ -156,7 +158,7 @@ int sys_event_queue_tryreceive(u32 equeue_id, mem_ptr_t<sys_event_data> event_ar
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_event_queue_receive(u32 equeue_id, mem_ptr_t<sys_event_data> event, u64 timeout)
|
||||
s32 sys_event_queue_receive(u32 equeue_id, mem_ptr_t<sys_event_data> event, u64 timeout)
|
||||
{
|
||||
sys_event.Log("sys_event_queue_receive(equeue_id=%d, event_addr=0x%x, timeout=%lld)",
|
||||
equeue_id, event.GetAddr(), timeout);
|
||||
|
@ -230,7 +232,7 @@ int sys_event_queue_receive(u32 equeue_id, mem_ptr_t<sys_event_data> event, u64
|
|||
}
|
||||
}
|
||||
|
||||
int sys_event_queue_drain(u32 equeue_id)
|
||||
s32 sys_event_queue_drain(u32 equeue_id)
|
||||
{
|
||||
sys_event.Log("sys_event_queue_drain(equeue_id=%d)", equeue_id);
|
||||
|
||||
|
@ -245,7 +247,7 @@ int sys_event_queue_drain(u32 equeue_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_event_port_create(mem32_t eport_id, int port_type, u64 name)
|
||||
s32 sys_event_port_create(mem32_t eport_id, int port_type, u64 name)
|
||||
{
|
||||
sys_event.Warning("sys_event_port_create(eport_id_addr=0x%x, port_type=0x%x, name=0x%llx)",
|
||||
eport_id.GetAddr(), port_type, name);
|
||||
|
@ -270,7 +272,7 @@ int sys_event_port_create(mem32_t eport_id, int port_type, u64 name)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_event_port_destroy(u32 eport_id)
|
||||
s32 sys_event_port_destroy(u32 eport_id)
|
||||
{
|
||||
sys_event.Warning("sys_event_port_destroy(eport_id=%d)", eport_id);
|
||||
|
||||
|
@ -296,7 +298,7 @@ int sys_event_port_destroy(u32 eport_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_event_port_connect_local(u32 eport_id, u32 equeue_id)
|
||||
s32 sys_event_port_connect_local(u32 eport_id, u32 equeue_id)
|
||||
{
|
||||
sys_event.Warning("sys_event_port_connect_local(eport_id=%d, equeue_id=%d)", eport_id, equeue_id);
|
||||
|
||||
|
@ -334,7 +336,7 @@ int sys_event_port_connect_local(u32 eport_id, u32 equeue_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_event_port_disconnect(u32 eport_id)
|
||||
s32 sys_event_port_disconnect(u32 eport_id)
|
||||
{
|
||||
sys_event.Warning("sys_event_port_disconnect(eport_id=%d)", eport_id);
|
||||
|
||||
|
@ -360,7 +362,7 @@ int sys_event_port_disconnect(u32 eport_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_event_port_send(u32 eport_id, u64 data1, u64 data2, u64 data3)
|
||||
s32 sys_event_port_send(u32 eport_id, u64 data1, u64 data2, u64 data3)
|
||||
{
|
||||
sys_event.Log("sys_event_port_send(eport_id=%d, data1=0x%llx, data2=0x%llx, data3=0x%llx)",
|
||||
eport_id, data1, data2, data3);
|
||||
|
@ -386,3 +388,364 @@ int sys_event_port_send(u32 eport_id, u64 data1, u64 data2, u64 data3)
|
|||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
// sys_event_flag
|
||||
s32 sys_event_flag_create(mem32_t eflag_id, mem_ptr_t<sys_event_flag_attr> attr, u64 init)
|
||||
{
|
||||
sys_event.Warning("sys_event_flag_create(eflag_id_addr=0x%x, attr_addr=0x%x, init=0x%llx)",
|
||||
eflag_id.GetAddr(), attr.GetAddr(), init);
|
||||
|
||||
if(!eflag_id.IsGood() || !attr.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
switch (attr->protocol.ToBE())
|
||||
{
|
||||
case se32(SYS_SYNC_PRIORITY): break;
|
||||
case se32(SYS_SYNC_RETRY): sys_event.Warning("TODO: SYS_SYNC_RETRY attr"); break;
|
||||
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_event.Warning("TODO: SYS_SYNC_PRIORITY_INHERIT attr"); break;
|
||||
case se32(SYS_SYNC_FIFO): break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if (attr->pshared.ToBE() != se32(0x200))
|
||||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
switch (attr->type.ToBE())
|
||||
{
|
||||
case se32(SYS_SYNC_WAITER_SINGLE): break;
|
||||
case se32(SYS_SYNC_WAITER_MULTIPLE): break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
eflag_id = sys_event.GetNewId(new EventFlag(init, (u32)attr->protocol, (int)attr->type));
|
||||
|
||||
sys_event.Warning("*** event_flag created [%s] (protocol=0x%x, type=0x%x): id = %d",
|
||||
std::string(attr->name, 8).c_str(), (u32)attr->protocol, (int)attr->type, eflag_id.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_destroy(u32 eflag_id)
|
||||
{
|
||||
sys_event.Warning("sys_event_flag_destroy(eflag_id=%d)", eflag_id);
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
if (ef->waiters.size()) // ???
|
||||
{
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
Emu.GetIdManager().RemoveID(eflag_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64 timeout)
|
||||
{
|
||||
sys_event.Log("sys_event_flag_wait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x, timeout=%lld)",
|
||||
eflag_id, bitptn, mode, result.GetAddr(), timeout);
|
||||
|
||||
if (result.IsGood()) result = 0;
|
||||
|
||||
switch (mode & 0xf)
|
||||
{
|
||||
case SYS_EVENT_FLAG_WAIT_AND: break;
|
||||
case SYS_EVENT_FLAG_WAIT_OR: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
switch (mode & ~0xf)
|
||||
{
|
||||
case 0: break; // ???
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR: break;
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR_ALL: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
u32 tid = GetCurrentPPUThread().GetId();
|
||||
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
if (ef->m_type == SYS_SYNC_WAITER_SINGLE && ef->waiters.size() > 0)
|
||||
{
|
||||
return CELL_EPERM;
|
||||
}
|
||||
EventFlagWaiter rec;
|
||||
rec.bitptn = bitptn;
|
||||
rec.mode = mode;
|
||||
rec.tid = tid;
|
||||
ef->waiters.push_back(rec);
|
||||
|
||||
if (ef->check() == tid)
|
||||
{
|
||||
u64 flags = ef->flags;
|
||||
|
||||
ef->waiters.erase(ef->waiters.end() - 1);
|
||||
|
||||
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
|
||||
{
|
||||
ef->flags &= ~bitptn;
|
||||
}
|
||||
else if (mode & SYS_EVENT_FLAG_WAIT_CLEAR_ALL)
|
||||
{
|
||||
ef->flags = 0;
|
||||
}
|
||||
|
||||
if (result.IsGood())
|
||||
{
|
||||
result = flags;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (!result.GetAddr())
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
u32 counter = 0;
|
||||
const u32 max_counter = timeout ? (timeout / 1000) : ~0;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (ef->signal.unlock(tid, tid) == SMR_OK)
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
|
||||
u64 flags = ef->flags;
|
||||
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
if (ef->waiters[i].tid == tid)
|
||||
{
|
||||
ef->waiters.erase(ef->waiters.begin() +i);
|
||||
|
||||
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
|
||||
{
|
||||
ef->flags &= ~bitptn;
|
||||
}
|
||||
else if (mode & SYS_EVENT_FLAG_WAIT_CLEAR_ALL)
|
||||
{
|
||||
ef->flags = 0;
|
||||
}
|
||||
|
||||
if (u32 target = ef->check())
|
||||
{
|
||||
// if signal, leave both mutexes locked...
|
||||
ef->signal.unlock(tid, target);
|
||||
ef->m_mutex.unlock(tid, target);
|
||||
}
|
||||
else
|
||||
{
|
||||
ef->signal.unlock(tid);
|
||||
}
|
||||
|
||||
if (result.IsGood())
|
||||
{
|
||||
result = flags;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (!result.GetAddr())
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
ef->signal.unlock(tid);
|
||||
return CELL_ECANCELED;
|
||||
}
|
||||
|
||||
Sleep(1);
|
||||
|
||||
if (counter++ > max_counter)
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
if (ef->waiters[i].tid == tid)
|
||||
{
|
||||
ef->waiters.erase(ef->waiters.begin() + i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CELL_ETIMEDOUT;
|
||||
}
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_event_flag_wait(id=%d) aborted", eflag_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result)
|
||||
{
|
||||
sys_event.Log("sys_event_flag_trywait(eflag_id=%d, bitptn=0x%llx, mode=0x%x, result_addr=0x%x)",
|
||||
eflag_id, bitptn, mode, result.GetAddr());
|
||||
|
||||
if (result.IsGood()) result = 0;
|
||||
|
||||
switch (mode & 0xf)
|
||||
{
|
||||
case SYS_EVENT_FLAG_WAIT_AND: break;
|
||||
case SYS_EVENT_FLAG_WAIT_OR: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
switch (mode & ~0xf)
|
||||
{
|
||||
case 0: break; // ???
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR: break;
|
||||
case SYS_EVENT_FLAG_WAIT_CLEAR_ALL: break;
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
|
||||
u64 flags = ef->flags;
|
||||
|
||||
if (((mode & SYS_EVENT_FLAG_WAIT_AND) && (flags & bitptn) == bitptn) ||
|
||||
((mode & SYS_EVENT_FLAG_WAIT_OR) && (flags & bitptn)))
|
||||
{
|
||||
if (mode & SYS_EVENT_FLAG_WAIT_CLEAR)
|
||||
{
|
||||
ef->flags &= ~bitptn;
|
||||
}
|
||||
else if (mode & SYS_EVENT_FLAG_WAIT_CLEAR_ALL)
|
||||
{
|
||||
ef->flags = 0;
|
||||
}
|
||||
|
||||
if (result.IsGood())
|
||||
{
|
||||
result = flags;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (!result.GetAddr())
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_set(u32 eflag_id, u64 bitptn)
|
||||
{
|
||||
sys_event.Log("sys_event_flag_set(eflag_id=%d, bitptn=0x%llx)", eflag_id, bitptn);
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
u32 tid = GetCurrentPPUThread().GetId();
|
||||
|
||||
ef->m_mutex.lock(tid);
|
||||
ef->flags |= bitptn;
|
||||
if (u32 target = ef->check())
|
||||
{
|
||||
// if signal, leave both mutexes locked...
|
||||
ef->signal.lock(target);
|
||||
ef->m_mutex.unlock(tid, target);
|
||||
}
|
||||
else
|
||||
{
|
||||
ef->m_mutex.unlock(tid);
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_clear(u32 eflag_id, u64 bitptn)
|
||||
{
|
||||
sys_event.Log("sys_event_flag_clear(eflag_id=%d, bitptn=0x%llx)", eflag_id, bitptn);
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
ef->flags &= bitptn;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_cancel(u32 eflag_id, mem32_t num)
|
||||
{
|
||||
sys_event.Log("sys_event_flag_cancel(eflag_id=%d, num_addr=0x%x)", eflag_id, num.GetAddr());
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
std::vector<u32> tids;
|
||||
|
||||
{
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
tids.resize(ef->waiters.size());
|
||||
for (u32 i = 0; i < ef->waiters.size(); i++)
|
||||
{
|
||||
tids[i] = ef->waiters[i].tid;
|
||||
}
|
||||
ef->waiters.clear();
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < tids.size(); i++)
|
||||
{
|
||||
ef->signal.lock(tids[i]);
|
||||
}
|
||||
|
||||
if (Emu.IsStopped())
|
||||
{
|
||||
LOG_WARNING(HLE, "sys_event_flag_cancel(id=%d) aborted", eflag_id);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (num.IsGood())
|
||||
{
|
||||
num = tids.size();
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (!num.GetAddr())
|
||||
{
|
||||
return CELL_OK;
|
||||
}
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
s32 sys_event_flag_get(u32 eflag_id, mem64_t flags)
|
||||
{
|
||||
sys_event.Log("sys_event_flag_get(eflag_id=%d, flags_addr=0x%x)", eflag_id, flags.GetAddr());
|
||||
|
||||
EventFlag* ef;
|
||||
if(!sys_event.CheckId(eflag_id, ef)) return CELL_ESRCH;
|
||||
|
||||
if (!flags.IsGood())
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
SMutexLocker lock(ef->m_mutex);
|
||||
flags = ef->flags;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include "Emu/Event.h"
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -73,3 +74,25 @@ struct EventFlag
|
|||
return target;
|
||||
}
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
s32 sys_event_queue_create(mem32_t equeue_id, mem_ptr_t<sys_event_queue_attr> attr, u64 event_queue_key, int size);
|
||||
s32 sys_event_queue_destroy(u32 equeue_id, int mode);
|
||||
s32 sys_event_queue_receive(u32 equeue_id, mem_ptr_t<sys_event_data> event, u64 timeout);
|
||||
s32 sys_event_queue_tryreceive(u32 equeue_id, mem_ptr_t<sys_event_data> event_array, int size, mem32_t number);
|
||||
s32 sys_event_queue_drain(u32 event_queue_id);
|
||||
|
||||
s32 sys_event_port_create(mem32_t eport_id, int port_type, u64 name);
|
||||
s32 sys_event_port_destroy(u32 eport_id);
|
||||
s32 sys_event_port_connect_local(u32 event_port_id, u32 event_queue_id);
|
||||
s32 sys_event_port_disconnect(u32 eport_id);
|
||||
s32 sys_event_port_send(u32 event_port_id, u64 data1, u64 data2, u64 data3);
|
||||
|
||||
s32 sys_event_flag_create(mem32_t eflag_id, mem_ptr_t<sys_event_flag_attr> attr, u64 init);
|
||||
s32 sys_event_flag_destroy(u32 eflag_id);
|
||||
s32 sys_event_flag_wait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result, u64 timeout);
|
||||
s32 sys_event_flag_trywait(u32 eflag_id, u64 bitptn, u32 mode, mem64_t result);
|
||||
s32 sys_event_flag_set(u32 eflag_id, u64 bitptn);
|
||||
s32 sys_event_flag_clear(u32 eflag_id, u64 bitptn);
|
||||
s32 sys_event_flag_cancel(u32 eflag_id, mem32_t num);
|
||||
s32 sys_event_flag_get(u32 eflag_id, mem64_t flags);
|
|
@ -7,11 +7,11 @@
|
|||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "SC_Interrupt.h"
|
||||
#include "sys_interrupt.h"
|
||||
|
||||
static SysCallBase sc_int("sys_interrupt");
|
||||
|
||||
int sys_interrupt_tag_destroy(u32 intrtag)
|
||||
s32 sys_interrupt_tag_destroy(u32 intrtag)
|
||||
{
|
||||
sc_int.Warning("sys_interrupt_tag_destroy(intrtag=%d)", intrtag);
|
||||
|
||||
|
@ -38,7 +38,7 @@ int sys_interrupt_tag_destroy(u32 intrtag)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_interrupt_thread_establish(mem32_t ih, u32 intrtag, u64 intrthread, u64 arg)
|
||||
s32 sys_interrupt_thread_establish(mem32_t ih, u32 intrtag, u64 intrthread, u64 arg)
|
||||
{
|
||||
sc_int.Warning("sys_interrupt_thread_establish(ih_addr=0x%x, intrtag=%d, intrthread=%lld, arg=0x%llx)", ih.GetAddr(), intrtag, intrthread, arg);
|
||||
|
||||
|
@ -82,7 +82,7 @@ int sys_interrupt_thread_establish(mem32_t ih, u32 intrtag, u64 intrthread, u64
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_interrupt_thread_disestablish(u32 ih)
|
||||
s32 sys_interrupt_thread_disestablish(u32 ih)
|
||||
{
|
||||
sc_int.Error("sys_interrupt_thread_disestablish(ih=%d)", ih);
|
||||
|
7
rpcs3/Emu/SysCalls/lv2/sys_interrupt.h
Normal file
7
rpcs3/Emu/SysCalls/lv2/sys_interrupt.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
// SysCalls
|
||||
s32 sys_interrupt_tag_destroy(u32 intrtag);
|
||||
s32 sys_interrupt_thread_establish(mem32_t ih, u32 intrtag, u64 intrthread, u64 arg);
|
||||
s32 sys_interrupt_thread_disestablish(u32 ih);
|
||||
void sys_interrupt_thread_eoi();
|
|
@ -4,12 +4,12 @@
|
|||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "SC_Lwmutex.h"
|
||||
#include "SC_Lwcond.h"
|
||||
#include "sys_lwmutex.h"
|
||||
#include "sys_lwcond.h"
|
||||
|
||||
SysCallBase sys_lwcond("sys_lwcond");
|
||||
|
||||
int sys_lwcond_create(mem_ptr_t<sys_lwcond_t> lwcond, mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwcond_attribute_t> attr)
|
||||
s32 sys_lwcond_create(mem_ptr_t<sys_lwcond_t> lwcond, mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwcond_attribute_t> attr)
|
||||
{
|
||||
sys_lwcond.Log("sys_lwcond_create(lwcond_addr=0x%x, lwmutex_addr=0x%x, attr_addr=0x%x)",
|
||||
lwcond.GetAddr(), lwmutex.GetAddr(), attr.GetAddr());
|
||||
|
@ -22,7 +22,6 @@ int sys_lwcond_create(mem_ptr_t<sys_lwcond_t> lwcond, mem_ptr_t<sys_lwmutex_t> l
|
|||
u32 id = sys_lwcond.GetNewId(new Lwcond(attr->name_u64));
|
||||
lwcond->lwmutex = lwmutex.GetAddr();
|
||||
lwcond->lwcond_queue = id;
|
||||
procObjects.lwcond_objects.insert(id);
|
||||
|
||||
if (lwmutex.IsGood())
|
||||
{
|
||||
|
@ -46,7 +45,7 @@ int sys_lwcond_create(mem_ptr_t<sys_lwcond_t> lwcond, mem_ptr_t<sys_lwmutex_t> l
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_lwcond_destroy(mem_ptr_t<sys_lwcond_t> lwcond)
|
||||
s32 sys_lwcond_destroy(mem_ptr_t<sys_lwcond_t> lwcond)
|
||||
{
|
||||
sys_lwcond.Warning("sys_lwcond_destroy(lwcond_addr=0x%x)", lwcond.GetAddr());
|
||||
|
||||
|
@ -72,7 +71,7 @@ int sys_lwcond_destroy(mem_ptr_t<sys_lwcond_t> lwcond)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_lwcond_signal(mem_ptr_t<sys_lwcond_t> lwcond)
|
||||
s32 sys_lwcond_signal(mem_ptr_t<sys_lwcond_t> lwcond)
|
||||
{
|
||||
sys_lwcond.Log("sys_lwcond_signal(lwcond_addr=0x%x)", lwcond.GetAddr());
|
||||
|
||||
|
@ -103,7 +102,7 @@ int sys_lwcond_signal(mem_ptr_t<sys_lwcond_t> lwcond)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_lwcond_signal_all(mem_ptr_t<sys_lwcond_t> lwcond)
|
||||
s32 sys_lwcond_signal_all(mem_ptr_t<sys_lwcond_t> lwcond)
|
||||
{
|
||||
sys_lwcond.Log("sys_lwcond_signal_all(lwcond_addr=0x%x)", lwcond.GetAddr());
|
||||
|
||||
|
@ -134,7 +133,7 @@ int sys_lwcond_signal_all(mem_ptr_t<sys_lwcond_t> lwcond)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_lwcond_signal_to(mem_ptr_t<sys_lwcond_t> lwcond, u32 ppu_thread_id)
|
||||
s32 sys_lwcond_signal_to(mem_ptr_t<sys_lwcond_t> lwcond, u32 ppu_thread_id)
|
||||
{
|
||||
sys_lwcond.Log("sys_lwcond_signal_to(lwcond_addr=0x%x, ppu_thread_id=%d)", lwcond.GetAddr(), ppu_thread_id);
|
||||
|
||||
|
@ -173,7 +172,7 @@ int sys_lwcond_signal_to(mem_ptr_t<sys_lwcond_t> lwcond, u32 ppu_thread_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout)
|
||||
s32 sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout)
|
||||
{
|
||||
sys_lwcond.Log("sys_lwcond_wait(lwcond_addr=0x%x, timeout=%lld)", lwcond.GetAddr(), timeout);
|
||||
|
35
rpcs3/Emu/SysCalls/lv2/sys_lwcond.h
Normal file
35
rpcs3/Emu/SysCalls/lv2/sys_lwcond.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
struct sys_lwcond_attribute_t
|
||||
{
|
||||
union
|
||||
{
|
||||
char name[8];
|
||||
u64 name_u64;
|
||||
};
|
||||
};
|
||||
|
||||
struct sys_lwcond_t
|
||||
{
|
||||
be_t<u32> lwmutex;
|
||||
be_t<u32> lwcond_queue;
|
||||
};
|
||||
|
||||
struct Lwcond
|
||||
{
|
||||
SMutex signal;
|
||||
SleepQueue m_queue;
|
||||
|
||||
Lwcond(u64 name)
|
||||
: m_queue(name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
s32 sys_lwcond_create(mem_ptr_t<sys_lwcond_t> lwcond, mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwcond_attribute_t> attr);
|
||||
s32 sys_lwcond_destroy(mem_ptr_t<sys_lwcond_t> lwcond);
|
||||
s32 sys_lwcond_signal(mem_ptr_t<sys_lwcond_t> lwcond);
|
||||
s32 sys_lwcond_signal_all(mem_ptr_t<sys_lwcond_t> lwcond);
|
||||
s32 sys_lwcond_signal_to(mem_ptr_t<sys_lwcond_t> lwcond, u32 ppu_thread_id);
|
||||
s32 sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout);
|
|
@ -4,11 +4,11 @@
|
|||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Lwmutex.h"
|
||||
#include "sys_lwmutex.h"
|
||||
|
||||
SysCallBase sc_lwmutex("sys_lwmutex");
|
||||
|
||||
int sys_lwmutex_create(mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwmutex_attribute_t> attr)
|
||||
s32 sys_lwmutex_create(mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwmutex_attribute_t> attr)
|
||||
{
|
||||
sc_lwmutex.Log("sys_lwmutex_create(lwmutex_addr=0x%x, lwmutex_attr_addr=0x%x)",
|
||||
lwmutex.GetAddr(), attr.GetAddr());
|
||||
|
@ -40,7 +40,6 @@ int sys_lwmutex_create(mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwmutex_a
|
|||
|
||||
u32 sq_id = sc_lwmutex.GetNewId(new SleepQueue(attr->name_u64));
|
||||
lwmutex->sleep_queue = sq_id;
|
||||
procObjects.lwmutex_objects.insert(sq_id);
|
||||
|
||||
sc_lwmutex.Warning("*** lwmutex created [%s] (attribute=0x%x): sq_id = %d",
|
||||
std::string(attr->name, 8).c_str(), (u32) lwmutex->attribute, sq_id);
|
||||
|
@ -48,7 +47,7 @@ int sys_lwmutex_create(mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwmutex_a
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_lwmutex_destroy(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
||||
s32 sys_lwmutex_destroy(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
||||
{
|
||||
sc_lwmutex.Warning("sys_lwmutex_destroy(lwmutex_addr=0x%x)", lwmutex.GetAddr());
|
||||
|
||||
|
@ -69,7 +68,7 @@ int sys_lwmutex_destroy(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
|||
}
|
||||
}
|
||||
|
||||
int sys_lwmutex_lock(mem_ptr_t<sys_lwmutex_t> lwmutex, u64 timeout)
|
||||
s32 sys_lwmutex_lock(mem_ptr_t<sys_lwmutex_t> lwmutex, u64 timeout)
|
||||
{
|
||||
sc_lwmutex.Log("sys_lwmutex_lock(lwmutex_addr=0x%x, timeout=%lld)", lwmutex.GetAddr(), timeout);
|
||||
|
||||
|
@ -81,7 +80,7 @@ int sys_lwmutex_lock(mem_ptr_t<sys_lwmutex_t> lwmutex, u64 timeout)
|
|||
return lwmutex->lock(GetCurrentPPUThread().GetId(), timeout ? ((timeout < 1000) ? 1 : (timeout / 1000)) : 0);
|
||||
}
|
||||
|
||||
int sys_lwmutex_trylock(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
||||
s32 sys_lwmutex_trylock(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
||||
{
|
||||
sc_lwmutex.Log("sys_lwmutex_trylock(lwmutex_addr=0x%x)", lwmutex.GetAddr());
|
||||
|
||||
|
@ -90,7 +89,7 @@ int sys_lwmutex_trylock(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
|||
return lwmutex->trylock(GetCurrentPPUThread().GetId());
|
||||
}
|
||||
|
||||
int sys_lwmutex_unlock(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
||||
s32 sys_lwmutex_unlock(mem_ptr_t<sys_lwmutex_t> lwmutex)
|
||||
{
|
||||
sc_lwmutex.Log("sys_lwmutex_unlock(lwmutex_addr=0x%x)", lwmutex.GetAddr());
|
||||
|
|
@ -78,3 +78,10 @@ struct sys_lwmutex_t
|
|||
int unlock(be_t<u32> tid);
|
||||
int lock(be_t<u32> tid, u64 timeout);
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
s32 sys_lwmutex_create(mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwmutex_attribute_t> attr);
|
||||
s32 sys_lwmutex_destroy(mem_ptr_t<sys_lwmutex_t> lwmutex);
|
||||
s32 sys_lwmutex_lock(mem_ptr_t<sys_lwmutex_t> lwmutex, u64 timeout);
|
||||
s32 sys_lwmutex_trylock(mem_ptr_t<sys_lwmutex_t> lwmutex);
|
||||
s32 sys_lwmutex_unlock(mem_ptr_t<sys_lwmutex_t> lwmutex);
|
168
rpcs3/Emu/SysCalls/lv2/sys_memory.cpp
Normal file
168
rpcs3/Emu/SysCalls/lv2/sys_memory.cpp
Normal file
|
@ -0,0 +1,168 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "sys_memory.h"
|
||||
#include <map>
|
||||
|
||||
SysCallBase sc_mem("memory");
|
||||
|
||||
s32 sys_memory_allocate(u32 size, u32 flags, u32 alloc_addr_addr)
|
||||
{
|
||||
sc_mem.Log("sys_memory_allocate(size=0x%x, flags=0x%x)", size, flags);
|
||||
|
||||
// Check page size.
|
||||
u32 addr;
|
||||
switch(flags)
|
||||
{
|
||||
case SYS_MEMORY_PAGE_SIZE_1M:
|
||||
if(size & 0xfffff) return CELL_EALIGN;
|
||||
addr = Memory.Alloc(size, 0x100000);
|
||||
break;
|
||||
|
||||
case SYS_MEMORY_PAGE_SIZE_64K:
|
||||
if(size & 0xffff) return CELL_EALIGN;
|
||||
addr = Memory.Alloc(size, 0x10000);
|
||||
break;
|
||||
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if(!addr)
|
||||
return CELL_ENOMEM;
|
||||
|
||||
// Write back the start address of the allocated area.
|
||||
sc_mem.Log("Memory allocated! [addr: 0x%x, size: 0x%x]", addr, size);
|
||||
Memory.Write32(alloc_addr_addr, addr);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_memory_allocate_from_container(u32 size, u32 cid, u32 flags, u32 alloc_addr_addr)
|
||||
{
|
||||
sc_mem.Log("sys_memory_allocate_from_container(size=0x%x, cid=0x%x, flags=0x%x)", size, cid, flags);
|
||||
|
||||
// Check if this container ID is valid.
|
||||
MemoryContainerInfo* ct;
|
||||
if(!sc_mem.CheckId(cid, ct))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// Check page size.
|
||||
switch(flags)
|
||||
{
|
||||
case SYS_MEMORY_PAGE_SIZE_1M:
|
||||
if(size & 0xfffff) return CELL_EALIGN;
|
||||
ct->addr = Memory.Alloc(size, 0x100000);
|
||||
break;
|
||||
|
||||
case SYS_MEMORY_PAGE_SIZE_64K:
|
||||
if(size & 0xffff) return CELL_EALIGN;
|
||||
ct->addr = Memory.Alloc(size, 0x10000);
|
||||
break;
|
||||
|
||||
default: return CELL_EINVAL;
|
||||
}
|
||||
|
||||
// Store the address and size in the container.
|
||||
if(!ct->addr)
|
||||
return CELL_ENOMEM;
|
||||
ct->size = size;
|
||||
|
||||
// Write back the start address of the allocated area.
|
||||
sc_mem.Log("Memory allocated! [addr: 0x%x, size: 0x%x]", ct->addr, ct->size);
|
||||
Memory.Write32(alloc_addr_addr, ct->addr);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_memory_free(u32 start_addr)
|
||||
{
|
||||
sc_mem.Log("sys_memory_free(start_addr=0x%x)", start_addr);
|
||||
|
||||
// Release the allocated memory.
|
||||
if(!Memory.Free(start_addr))
|
||||
return CELL_EFAULT;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_memory_get_page_attribute(u32 addr, mem_ptr_t<sys_page_attr_t> attr)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_get_page_attribute(addr=0x%x, attr_addr=0x%x)", addr, attr.GetAddr());
|
||||
|
||||
if (!attr.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
// TODO: Implement per thread page attribute setting.
|
||||
attr->attribute = 0;
|
||||
attr->page_size = 0;
|
||||
attr->access_right = 0;
|
||||
attr->pad = 0;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_memory_get_user_memory_size(mem_ptr_t<sys_memory_info_t> mem_info)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_get_user_memory_size(mem_info_addr=0x%x)", mem_info.GetAddr());
|
||||
|
||||
// Fetch the user memory available.
|
||||
mem_info->total_user_memory = Memory.GetUserMemTotalSize();
|
||||
mem_info->available_user_memory = Memory.GetUserMemAvailSize();
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_memory_container_create(mem32_t cid, u32 yield_size)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_container_create(cid_addr=0x%x, yield_size=0x%x)", cid.GetAddr(), yield_size);
|
||||
|
||||
if (!cid.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
yield_size &= ~0xfffff; //round down to 1 MB granularity
|
||||
u64 addr = Memory.Alloc(yield_size, 0x100000); //1 MB alignment
|
||||
|
||||
if(!addr)
|
||||
return CELL_ENOMEM;
|
||||
|
||||
// Wrap the allocated memory in a memory container.
|
||||
MemoryContainerInfo *ct = new MemoryContainerInfo(addr, yield_size);
|
||||
cid = sc_mem.GetNewId(ct);
|
||||
|
||||
sc_mem.Warning("*** memory_container created(addr=0x%llx): id = %d", addr, cid.GetValue());
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_memory_container_destroy(u32 cid)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_container_destroy(cid=%d)", cid);
|
||||
|
||||
// Check if this container ID is valid.
|
||||
MemoryContainerInfo* ct;
|
||||
if(!sc_mem.CheckId(cid, ct))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// Release the allocated memory and remove the ID.
|
||||
Memory.Free(ct->addr);
|
||||
Emu.GetIdManager().RemoveID(cid);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_memory_container_get_size(mem_ptr_t<sys_memory_info_t> mem_info, u32 cid)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_container_get_size(mem_info_addr=0x%x, cid=%d)", mem_info.GetAddr(), cid);
|
||||
|
||||
// Check if this container ID is valid.
|
||||
MemoryContainerInfo* ct;
|
||||
if(!sc_mem.CheckId(cid, ct))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// HACK: Return all memory.
|
||||
sys_memory_info_t info;
|
||||
mem_info->total_user_memory = ct->size;
|
||||
mem_info->available_user_memory = ct->size;
|
||||
return CELL_OK;
|
||||
}
|
|
@ -1,77 +1,53 @@
|
|||
#pragma once
|
||||
|
||||
#define SYS_MEMORY_CONTAINER_ID_INVALID 0xFFFFFFFF
|
||||
#define SYS_MEMORY_ACCESS_RIGHT_NONE 0x00000000000000F0ULL
|
||||
#define SYS_MEMORY_ACCESS_RIGHT_PPU_THREAD 0x0000000000000008ULL
|
||||
#define SYS_MEMORY_ACCESS_RIGHT_HANDLER 0x0000000000000004ULL
|
||||
#define SYS_MEMORY_ACCESS_RIGHT_SPU_THREAD 0x0000000000000002ULL
|
||||
#define SYS_MEMORY_ACCESS_RIGHT_SPU_RAW 0x0000000000000001ULL
|
||||
#define SYS_MEMORY_ATTR_READ_ONLY 0x0000000000080000ULL
|
||||
#define SYS_MEMORY_ATTR_READ_WRITE 0x0000000000040000ULL
|
||||
#define SYS_MMAPPER_FIXED_ADDR 0xB0000000
|
||||
#define SYS_MMAPPER_FIXED_SIZE 0x10000000
|
||||
#define SYS_VM_TEST_INVALID 0x0000ULL
|
||||
#define SYS_VM_TEST_UNUSED 0x0001ULL
|
||||
#define SYS_VM_TEST_ALLOCATED 0x0002ULL
|
||||
#define SYS_VM_TEST_STORED 0x0004ULL
|
||||
|
||||
enum
|
||||
{
|
||||
SYS_MEMORY_PAGE_SIZE_1M = 0x400,
|
||||
SYS_MEMORY_PAGE_SIZE_64K = 0x200,
|
||||
};
|
||||
|
||||
struct sys_memory_info_t
|
||||
{
|
||||
be_t<u32> total_user_memory;
|
||||
be_t<u32> available_user_memory;
|
||||
};
|
||||
|
||||
|
||||
struct sys_page_attr_t
|
||||
{
|
||||
u64 attribute;
|
||||
u64 access_right;
|
||||
u32 page_size;
|
||||
u32 pad;
|
||||
};
|
||||
|
||||
struct MemoryContainerInfo
|
||||
{
|
||||
u64 addr;
|
||||
u32 size;
|
||||
|
||||
MemoryContainerInfo(u64 addr, u32 size)
|
||||
: addr(addr)
|
||||
, size(size)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct mmapper_info
|
||||
{
|
||||
u64 addr;
|
||||
u32 size;
|
||||
u32 flags;
|
||||
|
||||
mmapper_info(u64 _addr, u32 _size, u32 _flags)
|
||||
: addr(_addr)
|
||||
, size(_size)
|
||||
, flags(_flags)
|
||||
{
|
||||
}
|
||||
|
||||
mmapper_info()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
struct sys_vm_statistics {
|
||||
u64 vm_crash_ppu;
|
||||
u64 vm_crash_spu;
|
||||
u64 vm_read;
|
||||
u64 vm_write;
|
||||
u32 physical_mem_size;
|
||||
u32 physical_mem_used;
|
||||
u64 timestamp;
|
||||
};
|
||||
#pragma once
|
||||
|
||||
#define SYS_MEMORY_CONTAINER_ID_INVALID 0xFFFFFFFF
|
||||
#define SYS_MEMORY_ACCESS_RIGHT_NONE 0x00000000000000F0ULL
|
||||
#define SYS_MEMORY_ACCESS_RIGHT_PPU_THREAD 0x0000000000000008ULL
|
||||
#define SYS_MEMORY_ACCESS_RIGHT_HANDLER 0x0000000000000004ULL
|
||||
#define SYS_MEMORY_ACCESS_RIGHT_SPU_THREAD 0x0000000000000002ULL
|
||||
#define SYS_MEMORY_ACCESS_RIGHT_SPU_RAW 0x0000000000000001ULL
|
||||
#define SYS_MEMORY_ATTR_READ_ONLY 0x0000000000080000ULL
|
||||
#define SYS_MEMORY_ATTR_READ_WRITE 0x0000000000040000ULL
|
||||
|
||||
enum
|
||||
{
|
||||
SYS_MEMORY_PAGE_SIZE_1M = 0x400,
|
||||
SYS_MEMORY_PAGE_SIZE_64K = 0x200,
|
||||
};
|
||||
|
||||
struct sys_memory_info_t
|
||||
{
|
||||
be_t<u32> total_user_memory;
|
||||
be_t<u32> available_user_memory;
|
||||
};
|
||||
|
||||
|
||||
struct sys_page_attr_t
|
||||
{
|
||||
u64 attribute;
|
||||
u64 access_right;
|
||||
u32 page_size;
|
||||
u32 pad;
|
||||
};
|
||||
|
||||
struct MemoryContainerInfo
|
||||
{
|
||||
u64 addr;
|
||||
u32 size;
|
||||
|
||||
MemoryContainerInfo(u64 addr, u32 size)
|
||||
: addr(addr)
|
||||
, size(size)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
s32 sys_memory_allocate(u32 size, u32 flags, u32 alloc_addr_addr);
|
||||
s32 sys_memory_allocate_from_container(u32 size, u32 cid, u32 flags, u32 alloc_addr_addr);
|
||||
s32 sys_memory_free(u32 start_addr);
|
||||
s32 sys_memory_get_page_attribute(u32 addr, mem_ptr_t<sys_page_attr_t> attr);
|
||||
s32 sys_memory_get_user_memory_size(mem_ptr_t<sys_memory_info_t> mem_info);
|
||||
s32 sys_memory_container_create(mem32_t cid, u32 yield_size);
|
||||
s32 sys_memory_container_destroy(u32 cid);
|
||||
s32 sys_memory_container_get_size(mem_ptr_t<sys_memory_info_t> mem_info, u32 cid);
|
264
rpcs3/Emu/SysCalls/lv2/sys_mmapper.cpp
Normal file
264
rpcs3/Emu/SysCalls/lv2/sys_mmapper.cpp
Normal file
|
@ -0,0 +1,264 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "sys_memory.h"
|
||||
#include "sys_mmapper.h"
|
||||
#include <map>
|
||||
|
||||
SysCallBase sys_mmapper("sys_mmapper");
|
||||
std::map<u32, u32> mmapper_info_map;
|
||||
|
||||
s32 sys_mmapper_allocate_address(u32 size, u64 flags, u32 alignment, u32 alloc_addr)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_allocate_address(size=0x%x, flags=0x%llx, alignment=0x%x, alloc_addr=0x%x)",
|
||||
size, flags, alignment, alloc_addr);
|
||||
|
||||
if(!Memory.IsGoodAddr(alloc_addr))
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Check for valid alignment.
|
||||
if(alignment > 0x80000000)
|
||||
return CELL_EALIGN;
|
||||
|
||||
// Check page size.
|
||||
u32 addr;
|
||||
switch(flags & (SYS_MEMORY_PAGE_SIZE_1M | SYS_MEMORY_PAGE_SIZE_64K))
|
||||
{
|
||||
default:
|
||||
case SYS_MEMORY_PAGE_SIZE_1M:
|
||||
if(Memory.AlignAddr(size, alignment) & 0xfffff)
|
||||
return CELL_EALIGN;
|
||||
addr = Memory.Alloc(size, 0x100000);
|
||||
break;
|
||||
|
||||
case SYS_MEMORY_PAGE_SIZE_64K:
|
||||
if(Memory.AlignAddr(size, alignment) & 0xffff)
|
||||
return CELL_EALIGN;
|
||||
addr = Memory.Alloc(size, 0x10000);
|
||||
break;
|
||||
}
|
||||
|
||||
// Write back the start address of the allocated area.
|
||||
Memory.Write32(alloc_addr, addr);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_mmapper_allocate_fixed_address()
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_allocate_fixed_address");
|
||||
|
||||
// Allocate a fixed size from user memory.
|
||||
if (!Memory.Alloc(SYS_MMAPPER_FIXED_SIZE, 0x100000))
|
||||
return CELL_EEXIST;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_mmapper_allocate_memory(u32 size, u64 flags, mem32_t mem_id)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_allocate_memory(size=0x%x, flags=0x%llx, mem_id_addr=0x%x)", size, flags, mem_id.GetAddr());
|
||||
|
||||
if(!mem_id.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Check page granularity.
|
||||
u32 addr;
|
||||
switch(flags & (SYS_MEMORY_PAGE_SIZE_1M | SYS_MEMORY_PAGE_SIZE_64K))
|
||||
{
|
||||
case SYS_MEMORY_PAGE_SIZE_1M:
|
||||
if(size & 0xfffff)
|
||||
return CELL_EALIGN;
|
||||
addr = Memory.Alloc(size, 0x100000);
|
||||
break;
|
||||
|
||||
case SYS_MEMORY_PAGE_SIZE_64K:
|
||||
if(size & 0xffff)
|
||||
return CELL_EALIGN;
|
||||
addr = Memory.Alloc(size, 0x10000);
|
||||
break;
|
||||
|
||||
default:
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if(!addr)
|
||||
return CELL_ENOMEM;
|
||||
|
||||
// Generate a new mem ID.
|
||||
mem_id = sys_mmapper.GetNewId(new mmapper_info(addr, size, flags));
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_mmapper_allocate_memory_from_container(u32 size, u32 cid, u64 flags, mem32_t mem_id)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_allocate_memory_from_container(size=0x%x, cid=%d, flags=0x%llx, mem_id_addr=0x%x)",
|
||||
size, cid, flags, mem_id.GetAddr());
|
||||
|
||||
if(!mem_id.IsGood())
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Check if this container ID is valid.
|
||||
MemoryContainerInfo* ct;
|
||||
if(!sys_mmapper.CheckId(cid, ct))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// Check page granularity.
|
||||
switch(flags & (SYS_MEMORY_PAGE_SIZE_1M | SYS_MEMORY_PAGE_SIZE_64K))
|
||||
{
|
||||
case SYS_MEMORY_PAGE_SIZE_1M:
|
||||
if(size & 0xfffff)
|
||||
return CELL_EALIGN;
|
||||
ct->addr = Memory.Alloc(size, 0x100000);
|
||||
break;
|
||||
|
||||
case SYS_MEMORY_PAGE_SIZE_64K:
|
||||
if(size & 0xffff)
|
||||
return CELL_EALIGN;
|
||||
ct->addr = Memory.Alloc(size, 0x10000);
|
||||
break;
|
||||
|
||||
default:
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
if(!ct->addr)
|
||||
return CELL_ENOMEM;
|
||||
ct->size = size;
|
||||
|
||||
// Generate a new mem ID.
|
||||
mem_id = sys_mmapper.GetNewId(new mmapper_info(ct->addr, ct->size, flags));
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_mmapper_change_address_access_right(u32 start_addr, u64 flags)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_change_address_access_right(start_addr=0x%x, flags=0x%llx)", start_addr, flags);
|
||||
|
||||
if (!Memory.IsGoodAddr(start_addr))
|
||||
return CELL_EINVAL;
|
||||
|
||||
// TODO
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_mmapper_free_address(u32 start_addr)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_free_address(start_addr=0x%x)", start_addr);
|
||||
|
||||
if(!Memory.IsGoodAddr(start_addr))
|
||||
return CELL_EINVAL;
|
||||
|
||||
// Free the address.
|
||||
Memory.Free(start_addr);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_mmapper_free_memory(u32 mem_id)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_free_memory(mem_id=0x%x)", mem_id);
|
||||
|
||||
// Check if this mem ID is valid.
|
||||
mmapper_info* info;
|
||||
if(!sys_mmapper.CheckId(mem_id, info))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// Release the allocated memory and remove the ID.
|
||||
Memory.Free(info->addr);
|
||||
Emu.GetIdManager().RemoveID(mem_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_mmapper_map_memory(u32 start_addr, u32 mem_id, u64 flags)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_map_memory(start_addr=0x%x, mem_id=0x%x, flags=0x%llx)", start_addr, mem_id, flags);
|
||||
|
||||
// Check if this mem ID is valid.
|
||||
mmapper_info* info;
|
||||
if(!sys_mmapper.CheckId(mem_id, info))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// Map the memory into the process address.
|
||||
if(!Memory.Map(start_addr, info->addr, info->size))
|
||||
sys_mmapper.Error("sys_mmapper_map_memory failed!");
|
||||
|
||||
// Keep track of mapped addresses.
|
||||
mmapper_info_map[mem_id] = start_addr;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_mmapper_search_and_map(u32 start_addr, u32 mem_id, u64 flags, u32 alloc_addr)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_search_and_map(start_addr=0x%x, mem_id=0x%x, flags=0x%llx, alloc_addr=0x%x)",
|
||||
start_addr, mem_id, flags, alloc_addr);
|
||||
|
||||
if(!Memory.IsGoodAddr(alloc_addr))
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Check if this mem ID is valid.
|
||||
mmapper_info* info;
|
||||
if(!sys_mmapper.CheckId(mem_id, info))
|
||||
return CELL_ESRCH;
|
||||
|
||||
// Search for a mappable address.
|
||||
u32 addr;
|
||||
bool found;
|
||||
for (int i = 0; i < SYS_MMAPPER_FIXED_SIZE; i += 0x100000)
|
||||
{
|
||||
addr = start_addr + i;
|
||||
found = Memory.Map(addr, info->addr, info->size);
|
||||
if(found)
|
||||
{
|
||||
sys_mmapper.Warning("Found and mapped address 0x%x", addr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the address is valid.
|
||||
if (!Memory.IsGoodAddr(addr) || !found)
|
||||
return CELL_ENOMEM;
|
||||
|
||||
// Write back the start address of the allocated area.
|
||||
Memory.Write32(alloc_addr, addr);
|
||||
|
||||
// Keep track of mapped addresses.
|
||||
mmapper_info_map[mem_id] = addr;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_mmapper_unmap_memory(u32 start_addr, u32 mem_id_addr)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_unmap_memory(start_addr=0x%x, mem_id_addr=0x%x)", start_addr, mem_id_addr);
|
||||
|
||||
if (!Memory.IsGoodAddr(start_addr))
|
||||
return CELL_EINVAL;
|
||||
|
||||
if (!Memory.IsGoodAddr(mem_id_addr))
|
||||
return CELL_EFAULT;
|
||||
|
||||
// Write back the mem ID of the unmapped area.
|
||||
u32 mem_id = mmapper_info_map.find(start_addr)->first;
|
||||
Memory.Write32(mem_id_addr, mem_id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_mmapper_enable_page_fault_notification(u32 start_addr, u32 q_id)
|
||||
{
|
||||
sys_mmapper.Warning("sys_mmapper_enable_page_fault_notification(start_addr=0x%x, q_id=0x%x)", start_addr, q_id);
|
||||
|
||||
if (!Memory.IsGoodAddr(start_addr))
|
||||
return CELL_EINVAL;
|
||||
|
||||
// TODO
|
||||
|
||||
return CELL_OK;
|
||||
}
|
35
rpcs3/Emu/SysCalls/lv2/sys_mmapper.h
Normal file
35
rpcs3/Emu/SysCalls/lv2/sys_mmapper.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
|
||||
#define SYS_MMAPPER_FIXED_ADDR 0xB0000000
|
||||
#define SYS_MMAPPER_FIXED_SIZE 0x10000000
|
||||
|
||||
struct mmapper_info
|
||||
{
|
||||
u64 addr;
|
||||
u32 size;
|
||||
u32 flags;
|
||||
|
||||
mmapper_info(u64 _addr, u32 _size, u32 _flags)
|
||||
: addr(_addr)
|
||||
, size(_size)
|
||||
, flags(_flags)
|
||||
{
|
||||
}
|
||||
|
||||
mmapper_info()
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
s32 sys_mmapper_allocate_address(u32 size, u64 flags, u32 alignment, u32 alloc_addr);
|
||||
s32 sys_mmapper_allocate_fixed_address();
|
||||
s32 sys_mmapper_allocate_memory(u32 size, u64 flags, mem32_t mem_id);
|
||||
s32 sys_mmapper_allocate_memory_from_container(u32 size, u32 cid, u64 flags, mem32_t mem_id);
|
||||
s32 sys_mmapper_change_address_access_right(u32 start_addr, u64 flags);
|
||||
s32 sys_mmapper_free_address(u32 start_addr);
|
||||
s32 sys_mmapper_free_memory(u32 mem_id);
|
||||
s32 sys_mmapper_map_memory(u32 start_addr, u32 mem_id, u64 flags);
|
||||
s32 sys_mmapper_search_and_map(u32 start_addr, u32 mem_id, u64 flags, u32 alloc_addr);
|
||||
s32 sys_mmapper_unmap_memory(u32 start_addr, u32 mem_id_addr);
|
||||
s32 sys_mmapper_enable_page_fault_notification(u32 start_addr, u32 q_id);
|
|
@ -4,12 +4,12 @@
|
|||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "SC_Mutex.h"
|
||||
#include "Utilities/SMutex.h"
|
||||
#include "sys_mutex.h"
|
||||
|
||||
SysCallBase sys_mtx("sys_mutex");
|
||||
|
||||
int sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr)
|
||||
s32 sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr)
|
||||
{
|
||||
sys_mtx.Log("sys_mutex_create(mutex_id_addr=0x%x, attr_addr=0x%x)", mutex_id.GetAddr(), attr.GetAddr());
|
||||
|
||||
|
@ -44,7 +44,6 @@ int sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr)
|
|||
u32 tid = GetCurrentPPUThread().GetId();
|
||||
Mutex* mutex = new Mutex((u32)attr->protocol, is_recursive, attr->name_u64);
|
||||
u32 id = sys_mtx.GetNewId(mutex);
|
||||
procObjects.mutex_objects.insert(id);
|
||||
mutex->m_mutex.lock(tid);
|
||||
mutex->id = id;
|
||||
mutex_id = id;
|
||||
|
@ -58,7 +57,7 @@ int sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mutex_destroy(u32 mutex_id)
|
||||
s32 sys_mutex_destroy(u32 mutex_id)
|
||||
{
|
||||
sys_mtx.Warning("sys_mutex_destroy(mutex_id=%d)", mutex_id);
|
||||
|
||||
|
@ -91,7 +90,7 @@ int sys_mutex_destroy(u32 mutex_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mutex_lock(u32 mutex_id, u64 timeout)
|
||||
s32 sys_mutex_lock(u32 mutex_id, u64 timeout)
|
||||
{
|
||||
sys_mtx.Log("sys_mutex_lock(mutex_id=%d, timeout=%lld)", mutex_id, timeout);
|
||||
|
||||
|
@ -160,7 +159,7 @@ abort:
|
|||
return CELL_ESRCH;
|
||||
}
|
||||
|
||||
int sys_mutex_trylock(u32 mutex_id)
|
||||
s32 sys_mutex_trylock(u32 mutex_id)
|
||||
{
|
||||
sys_mtx.Log("sys_mutex_trylock(mutex_id=%d)", mutex_id);
|
||||
|
||||
|
@ -207,7 +206,7 @@ int sys_mutex_trylock(u32 mutex_id)
|
|||
return CELL_EBUSY;
|
||||
}
|
||||
|
||||
int sys_mutex_unlock(u32 mutex_id)
|
||||
s32 sys_mutex_unlock(u32 mutex_id)
|
||||
{
|
||||
sys_mtx.Log("sys_mutex_unlock(mutex_id=%d)", mutex_id);
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include "sys_lwmutex.h"
|
||||
|
||||
struct sys_mutex_attribute
|
||||
{
|
||||
|
@ -52,3 +53,10 @@ struct Mutex
|
|||
m_queue.m_mutex.unlock();
|
||||
}
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
s32 sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr);
|
||||
s32 sys_mutex_destroy(u32 mutex_id);
|
||||
s32 sys_mutex_lock(u32 mutex_id, u64 timeout);
|
||||
s32 sys_mutex_trylock(u32 mutex_id);
|
||||
s32 sys_mutex_unlock(u32 mutex_id);
|
|
@ -6,23 +6,12 @@
|
|||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Emu/SysCalls/Modules.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "sys_ppu_thread.h"
|
||||
|
||||
extern Module *sysPrxForUser;
|
||||
|
||||
static const u32 PPU_THREAD_ID_INVALID = 0xFFFFFFFFU;
|
||||
|
||||
enum
|
||||
{
|
||||
SYS_PPU_THREAD_ONCE_INIT,
|
||||
SYS_PPU_THREAD_DONE_INIT,
|
||||
};
|
||||
|
||||
enum ppu_thread_flags : u64
|
||||
{
|
||||
SYS_PPU_THREAD_CREATE_JOINABLE = 0x1,
|
||||
SYS_PPU_THREAD_CREATE_INTERRUPT = 0x2,
|
||||
};
|
||||
|
||||
void sys_ppu_thread_exit(u64 errorcode)
|
||||
{
|
||||
sysPrxForUser->Log("sys_ppu_thread_exit(0x%llx)", errorcode);
|
||||
|
@ -40,14 +29,14 @@ void sys_ppu_thread_exit(u64 errorcode)
|
|||
thr.Stop();
|
||||
}
|
||||
|
||||
int sys_ppu_thread_yield()
|
||||
s32 sys_ppu_thread_yield()
|
||||
{
|
||||
sysPrxForUser->Log("sys_ppu_thread_yield()");
|
||||
Sleep(1);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_ppu_thread_join(u64 thread_id, mem64_t vptr)
|
||||
s32 sys_ppu_thread_join(u64 thread_id, mem64_t vptr)
|
||||
{
|
||||
sysPrxForUser->Warning("sys_ppu_thread_join(thread_id=%lld, vptr_addr=0x%x)", thread_id, vptr.GetAddr());
|
||||
|
||||
|
@ -68,7 +57,7 @@ int sys_ppu_thread_join(u64 thread_id, mem64_t vptr)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_ppu_thread_detach(u64 thread_id)
|
||||
s32 sys_ppu_thread_detach(u64 thread_id)
|
||||
{
|
||||
sysPrxForUser->Error("sys_ppu_thread_detach(thread_id=%lld)", thread_id);
|
||||
|
||||
|
@ -88,7 +77,7 @@ void sys_ppu_thread_get_join_state(u32 isjoinable_addr)
|
|||
Memory.Write32(isjoinable_addr, GetCurrentPPUThread().IsJoinable());
|
||||
}
|
||||
|
||||
int sys_ppu_thread_set_priority(u64 thread_id, int prio)
|
||||
s32 sys_ppu_thread_set_priority(u64 thread_id, s32 prio)
|
||||
{
|
||||
sysPrxForUser->Log("sys_ppu_thread_set_priority(thread_id=%lld, prio=%d)", thread_id, prio);
|
||||
|
||||
|
@ -100,7 +89,7 @@ int sys_ppu_thread_set_priority(u64 thread_id, int prio)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_ppu_thread_get_priority(u64 thread_id, u32 prio_addr)
|
||||
s32 sys_ppu_thread_get_priority(u64 thread_id, u32 prio_addr)
|
||||
{
|
||||
sysPrxForUser->Log("sys_ppu_thread_get_priority(thread_id=%lld, prio_addr=0x%x)", thread_id, prio_addr);
|
||||
|
||||
|
@ -113,7 +102,7 @@ int sys_ppu_thread_get_priority(u64 thread_id, u32 prio_addr)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_ppu_thread_get_stack_information(u32 info_addr)
|
||||
s32 sys_ppu_thread_get_stack_information(u32 info_addr)
|
||||
{
|
||||
sysPrxForUser->Log("sys_ppu_thread_get_stack_information(info_addr=0x%x)", info_addr);
|
||||
|
||||
|
@ -127,7 +116,7 @@ int sys_ppu_thread_get_stack_information(u32 info_addr)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_ppu_thread_stop(u64 thread_id)
|
||||
s32 sys_ppu_thread_stop(u64 thread_id)
|
||||
{
|
||||
sysPrxForUser->Warning("sys_ppu_thread_stop(thread_id=%lld)", thread_id);
|
||||
|
||||
|
@ -139,7 +128,7 @@ int sys_ppu_thread_stop(u64 thread_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_ppu_thread_restart(u64 thread_id)
|
||||
s32 sys_ppu_thread_restart(u64 thread_id)
|
||||
{
|
||||
sysPrxForUser->Warning("sys_ppu_thread_restart(thread_id=%lld)", thread_id);
|
||||
|
||||
|
@ -152,7 +141,7 @@ int sys_ppu_thread_restart(u64 thread_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_ppu_thread_create(mem64_t thread_id, u32 entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr)
|
||||
s32 sys_ppu_thread_create(mem64_t thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, u32 threadname_addr)
|
||||
{
|
||||
std::string threadname = "";
|
||||
if (Memory.IsGoodAddr(threadname_addr))
|
||||
|
@ -232,7 +221,7 @@ void sys_ppu_thread_once(u32 once_ctrl_addr, u32 entry)
|
|||
}
|
||||
}
|
||||
|
||||
int sys_ppu_thread_get_id(const u32 id_addr)
|
||||
s32 sys_ppu_thread_get_id(const u32 id_addr)
|
||||
{
|
||||
sysPrxForUser->Log("sys_ppu_thread_get_id(id_addr=0x%x)", id_addr);
|
||||
|
28
rpcs3/Emu/SysCalls/lv2/sys_ppu_thread.h
Normal file
28
rpcs3/Emu/SysCalls/lv2/sys_ppu_thread.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
SYS_PPU_THREAD_ONCE_INIT,
|
||||
SYS_PPU_THREAD_DONE_INIT,
|
||||
};
|
||||
|
||||
enum ppu_thread_flags : u64
|
||||
{
|
||||
SYS_PPU_THREAD_CREATE_JOINABLE = 0x1,
|
||||
SYS_PPU_THREAD_CREATE_INTERRUPT = 0x2,
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
void sys_ppu_thread_exit(u64 errorcode);
|
||||
s32 sys_ppu_thread_yield();
|
||||
s32 sys_ppu_thread_join(u64 thread_id, mem64_t vptr);
|
||||
s32 sys_ppu_thread_detach(u64 thread_id);
|
||||
void sys_ppu_thread_get_join_state(u32 isjoinable_addr);
|
||||
s32 sys_ppu_thread_set_priority(u64 thread_id, s32 prio);
|
||||
s32 sys_ppu_thread_get_priority(u64 thread_id, u32 prio_addr);
|
||||
s32 sys_ppu_thread_get_stack_information(u32 info_addr);
|
||||
s32 sys_ppu_thread_stop(u64 thread_id);
|
||||
s32 sys_ppu_thread_restart(u64 thread_id);
|
||||
s32 sys_ppu_thread_create(mem64_t thread_id, u32 entry, u64 arg, s32 prio, u32 stacksize, u64 flags, u32 threadname_addr);
|
||||
void sys_ppu_thread_once(u32 once_ctrl_addr, u32 entry);
|
||||
s32 sys_ppu_thread_get_id(const u32 id_addr);
|
|
@ -3,24 +3,24 @@
|
|||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "SC_Process.h"
|
||||
#include "sys_process.h"
|
||||
|
||||
SysCallBase sc_p("Process");
|
||||
|
||||
sysProcessObjects_t procObjects;
|
||||
|
||||
int sys_process_getpid()
|
||||
s32 sys_process_getpid()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sys_process_getppid()
|
||||
s32 sys_process_getppid()
|
||||
{
|
||||
sc_p.Warning("TODO: sys_process_getppid() returns 0");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sys_process_exit(s32 errorcode)
|
||||
s32 sys_process_exit(s32 errorcode)
|
||||
{
|
||||
sc_p.Warning("sys_process_exit(%d)", errorcode);
|
||||
Emu.Pause(); // Emu.Stop() does crash
|
||||
|
@ -130,7 +130,7 @@ void sys_game_process_exitspawn2(
|
|||
return;
|
||||
}
|
||||
|
||||
int sys_process_get_number_of_object(u32 object, mem32_t nump)
|
||||
s32 sys_process_get_number_of_object(u32 object, mem32_t nump)
|
||||
{
|
||||
sc_p.Warning("sys_process_get_number_of_object(object=%d, nump_addr=0x%x)",
|
||||
object, nump.GetAddr());
|
||||
|
@ -165,7 +165,7 @@ int sys_process_get_number_of_object(u32 object, mem32_t nump)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_process_get_id(u32 object, mem32_ptr_t buffer, u32 size, mem32_t set_size)
|
||||
s32 sys_process_get_id(u32 object, mem32_ptr_t buffer, u32 size, mem32_t set_size)
|
||||
{
|
||||
sc_p.Warning("TODO: sys_process_get_id(object=%d, buffer_addr=0x%x, size=%d, set_size_addr=0x%x)",
|
||||
object, buffer.GetAddr(), size, set_size.GetAddr());
|
||||
|
@ -208,7 +208,7 @@ int sys_process_get_id(u32 object, mem32_ptr_t buffer, u32 size, mem32_t set_siz
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_process_get_paramsfo(mem8_ptr_t buffer)
|
||||
s32 sys_process_get_paramsfo(mem8_ptr_t buffer)
|
||||
{
|
||||
sc_p.Warning("TODO: sys_process_get_paramsfo(buffer_addr=0x%x) returns CELL_ENOENT", buffer.GetAddr());
|
||||
return CELL_ENOENT;
|
||||
|
@ -227,7 +227,7 @@ int sys_process_get_paramsfo(mem8_ptr_t buffer)
|
|||
return CELL_OK;*/
|
||||
}
|
||||
|
||||
int sys_process_get_sdk_version(u32 pid, mem32_t version)
|
||||
s32 sys_process_get_sdk_version(u32 pid, mem32_t version)
|
||||
{
|
||||
sc_p.Warning("sys_process_get_sdk_version(pid=%d, version_addr=0x%x)", pid, version.GetAddr());
|
||||
|
||||
|
@ -238,34 +238,34 @@ int sys_process_get_sdk_version(u32 pid, mem32_t version)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_process_kill(u32 pid)
|
||||
s32 sys_process_kill(u32 pid)
|
||||
{
|
||||
sc_p.Error("TODO: sys_process_kill(pid=%d)", pid);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_process_wait_for_child(u32 pid, mem32_t status, u64 unk)
|
||||
s32 sys_process_wait_for_child(u32 pid, mem32_t status, u64 unk)
|
||||
{
|
||||
sc_p.Error("TODO: sys_process_wait_for_child(pid=%d, status_addr=0x%x, unk=0x%llx",
|
||||
pid, status.GetAddr(), unk);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_process_wait_for_child2(u64 unk1, u64 unk2, u64 unk3, u64 unk4, u64 unk5, u64 unk6)
|
||||
s32 sys_process_wait_for_child2(u64 unk1, u64 unk2, u64 unk3, u64 unk4, u64 unk5, u64 unk6)
|
||||
{
|
||||
sc_p.Error("TODO: sys_process_wait_for_child2(unk1=0x%llx, unk2=0x%llx, unk3=0x%llx, unk4=0x%llx, unk5=0x%llx, unk6=0x%llx)",
|
||||
unk1, unk2, unk3, unk4, unk5, unk6);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_process_get_status(u64 unk)
|
||||
s32 sys_process_get_status(u64 unk)
|
||||
{
|
||||
sc_p.Error("TODO: sys_process_get_status(unk=0x%llx)", unk);
|
||||
//Memory.Write32(CPU.GPR[4], GetPPUThreadStatus(CPU));
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_process_detach_child(u64 unk)
|
||||
s32 sys_process_detach_child(u64 unk)
|
||||
{
|
||||
sc_p.Error("TODO: sys_process_detach_child(unk=0x%llx)", unk);
|
||||
return CELL_OK;
|
|
@ -52,18 +52,18 @@ struct sysProcessObjects_t
|
|||
extern sysProcessObjects_t procObjects;
|
||||
|
||||
// SysCalls
|
||||
int sys_process_getpid();
|
||||
int sys_process_getppid();
|
||||
int sys_process_get_number_of_object(u32 object, mem32_t nump);
|
||||
int sys_process_get_id(u32 object, mem32_ptr_t buffer, u32 size, mem32_t set_size);
|
||||
int sys_process_get_paramsfo(mem8_ptr_t buffer);
|
||||
int sys_process_get_sdk_version(u32 pid, mem32_t version);
|
||||
int sys_process_get_status(u64 unk);
|
||||
int sys_process_exit(s32 errorcode);
|
||||
int sys_process_kill(u32 pid);
|
||||
int sys_process_wait_for_child(u32 pid, mem32_t status, u64 unk);
|
||||
int sys_process_wait_for_child2(u64 unk1, u64 unk2, u64 unk3, u64 unk4, u64 unk5, u64 unk6);
|
||||
int sys_process_detach_child(u64 unk);
|
||||
s32 sys_process_getpid();
|
||||
s32 sys_process_getppid();
|
||||
s32 sys_process_get_number_of_object(u32 object, mem32_t nump);
|
||||
s32 sys_process_get_id(u32 object, mem32_ptr_t buffer, u32 size, mem32_t set_size);
|
||||
s32 sys_process_get_paramsfo(mem8_ptr_t buffer);
|
||||
s32 sys_process_get_sdk_version(u32 pid, mem32_t version);
|
||||
s32 sys_process_get_status(u64 unk);
|
||||
s32 sys_process_exit(s32 errorcode);
|
||||
s32 sys_process_kill(u32 pid);
|
||||
s32 sys_process_wait_for_child(u32 pid, mem32_t status, u64 unk);
|
||||
s32 sys_process_wait_for_child2(u64 unk1, u64 unk2, u64 unk3, u64 unk4, u64 unk5, u64 unk6);
|
||||
s32 sys_process_detach_child(u64 unk);
|
||||
void sys_game_process_exitspawn(u32 path_addr, u32 argv_addr, u32 envp_addr,
|
||||
u32 data_addr, u32 data_size, u32 prio, u64 flags);
|
||||
void sys_game_process_exitspawn2(u32 path_addr, u32 argv_addr, u32 envp_addr,
|
|
@ -3,7 +3,7 @@
|
|||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "SC_PRX.h"
|
||||
#include "sys_prx.h"
|
||||
|
||||
SysCallBase sys_prx("sys_prx");
|
||||
|
|
@ -3,76 +3,77 @@
|
|||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "sys_rsx.h"
|
||||
|
||||
SysCallBase sys_rsx("sys_rsx");
|
||||
|
||||
int sys_rsx_device_open()
|
||||
s32 sys_rsx_device_open()
|
||||
{
|
||||
sys_rsx.Error("TODO: sys_rsx_device_open()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rsx_device_close()
|
||||
s32 sys_rsx_device_close()
|
||||
{
|
||||
sys_rsx.Error("TODO: sys_rsx_device_close()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rsx_memory_allocate()
|
||||
s32 sys_rsx_memory_allocate()
|
||||
{
|
||||
sys_rsx.Error("TODO: sys_rsx_memory_allocate()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rsx_memory_free()
|
||||
s32 sys_rsx_memory_free()
|
||||
{
|
||||
sys_rsx.Error("TODO: sys_rsx_memory_free()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rsx_context_allocate()
|
||||
s32 sys_rsx_context_allocate()
|
||||
{
|
||||
sys_rsx.Error("TODO: sys_rsx_context_allocate()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rsx_context_free()
|
||||
s32 sys_rsx_context_free()
|
||||
{
|
||||
sys_rsx.Error("TODO: sys_rsx_context_free()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rsx_context_iomap()
|
||||
s32 sys_rsx_context_iomap()
|
||||
{
|
||||
sys_rsx.Error("TODO: sys_rsx_context_iomap()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rsx_context_iounmap()
|
||||
s32 sys_rsx_context_iounmap()
|
||||
{
|
||||
sys_rsx.Error("TODO: sys_rsx_context_iounmap()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rsx_context_attribute(s32 context_id, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6)
|
||||
s32 sys_rsx_context_attribute(s32 context_id, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6)
|
||||
{
|
||||
sys_rsx.Error("TODO: sys_rsx_context_attribute(context_id=%d, a2=%llu, a3=%llu, a4=%llu, a5=%llu, a6=%llu)", context_id, a2, a3, a4, a5, a6);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rsx_device_map(mem32_t a1, mem32_t a2, u32 a3)
|
||||
s32 sys_rsx_device_map(mem32_t a1, mem32_t a2, u32 a3)
|
||||
{
|
||||
sys_rsx.Error("TODO: sys_rsx_device_map(a1_addr=0x%x, a2_addr=0x%x, a3=%d)", a1.GetAddr(), a2.GetAddr(), a3);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rsx_device_unmap()
|
||||
s32 sys_rsx_device_unmap()
|
||||
{
|
||||
sys_rsx.Error("TODO: sys_rsx_device_unmap()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rsx_attribute()
|
||||
s32 sys_rsx_attribute()
|
||||
{
|
||||
sys_rsx.Error("TODO: sys_rsx_attribute()");
|
||||
return CELL_OK;
|
15
rpcs3/Emu/SysCalls/lv2/sys_rsx.h
Normal file
15
rpcs3/Emu/SysCalls/lv2/sys_rsx.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
// SysCalls
|
||||
s32 sys_rsx_device_open();
|
||||
s32 sys_rsx_device_close();
|
||||
s32 sys_rsx_memory_allocate();
|
||||
s32 sys_rsx_memory_free();
|
||||
s32 sys_rsx_context_allocate();
|
||||
s32 sys_rsx_context_free();
|
||||
s32 sys_rsx_context_iomap();
|
||||
s32 sys_rsx_context_iounmap();
|
||||
s32 sys_rsx_context_attribute(s32 context_id, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6);
|
||||
s32 sys_rsx_device_map(mem32_t a1, mem32_t a2, u32 a3);
|
||||
s32 sys_rsx_device_unmap();
|
||||
s32 sys_rsx_attribute();
|
|
@ -3,12 +3,12 @@
|
|||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "SC_Rwlock.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "sys_rwlock.h"
|
||||
|
||||
SysCallBase sys_rwlock("sys_rwlock");
|
||||
|
||||
int sys_rwlock_create(mem32_t rw_lock_id, mem_ptr_t<sys_rwlock_attribute_t> attr)
|
||||
s32 sys_rwlock_create(mem32_t rw_lock_id, mem_ptr_t<sys_rwlock_attribute_t> attr)
|
||||
{
|
||||
sys_rwlock.Warning("sys_rwlock_create(rw_lock_id_addr=0x%x, attr_addr=0x%x)", rw_lock_id.GetAddr(), attr.GetAddr());
|
||||
|
||||
|
@ -37,7 +37,7 @@ int sys_rwlock_create(mem32_t rw_lock_id, mem_ptr_t<sys_rwlock_attribute_t> attr
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rwlock_destroy(u32 rw_lock_id)
|
||||
s32 sys_rwlock_destroy(u32 rw_lock_id)
|
||||
{
|
||||
sys_rwlock.Warning("sys_rwlock_destroy(rw_lock_id=%d)", rw_lock_id);
|
||||
|
||||
|
@ -53,7 +53,7 @@ int sys_rwlock_destroy(u32 rw_lock_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rwlock_rlock(u32 rw_lock_id, u64 timeout)
|
||||
s32 sys_rwlock_rlock(u32 rw_lock_id, u64 timeout)
|
||||
{
|
||||
sys_rwlock.Log("sys_rwlock_rlock(rw_lock_id=%d, timeout=%lld)", rw_lock_id, timeout);
|
||||
|
||||
|
@ -90,7 +90,7 @@ int sys_rwlock_rlock(u32 rw_lock_id, u64 timeout)
|
|||
} while (true);
|
||||
}
|
||||
|
||||
int sys_rwlock_tryrlock(u32 rw_lock_id)
|
||||
s32 sys_rwlock_tryrlock(u32 rw_lock_id)
|
||||
{
|
||||
sys_rwlock.Log("sys_rwlock_tryrlock(rw_lock_id=%d)", rw_lock_id);
|
||||
|
||||
|
@ -102,7 +102,7 @@ int sys_rwlock_tryrlock(u32 rw_lock_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rwlock_runlock(u32 rw_lock_id)
|
||||
s32 sys_rwlock_runlock(u32 rw_lock_id)
|
||||
{
|
||||
sys_rwlock.Log("sys_rwlock_runlock(rw_lock_id=%d)", rw_lock_id);
|
||||
|
||||
|
@ -114,7 +114,7 @@ int sys_rwlock_runlock(u32 rw_lock_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rwlock_wlock(u32 rw_lock_id, u64 timeout)
|
||||
s32 sys_rwlock_wlock(u32 rw_lock_id, u64 timeout)
|
||||
{
|
||||
sys_rwlock.Log("sys_rwlock_wlock(rw_lock_id=%d, timeout=%lld)", rw_lock_id, timeout);
|
||||
|
||||
|
@ -153,7 +153,7 @@ int sys_rwlock_wlock(u32 rw_lock_id, u64 timeout)
|
|||
} while (true);
|
||||
}
|
||||
|
||||
int sys_rwlock_trywlock(u32 rw_lock_id)
|
||||
s32 sys_rwlock_trywlock(u32 rw_lock_id)
|
||||
{
|
||||
sys_rwlock.Log("sys_rwlock_trywlock(rw_lock_id=%d)", rw_lock_id);
|
||||
|
||||
|
@ -168,7 +168,7 @@ int sys_rwlock_trywlock(u32 rw_lock_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_rwlock_wunlock(u32 rw_lock_id)
|
||||
s32 sys_rwlock_wunlock(u32 rw_lock_id)
|
||||
{
|
||||
sys_rwlock.Log("sys_rwlock_wunlock(rw_lock_id=%d)", rw_lock_id);
|
||||
|
|
@ -150,3 +150,13 @@ struct RWLock
|
|||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
s32 sys_rwlock_create(mem32_t rw_lock_id, mem_ptr_t<sys_rwlock_attribute_t> attr);
|
||||
s32 sys_rwlock_destroy(u32 rw_lock_id);
|
||||
s32 sys_rwlock_rlock(u32 rw_lock_id, u64 timeout);
|
||||
s32 sys_rwlock_tryrlock(u32 rw_lock_id);
|
||||
s32 sys_rwlock_runlock(u32 rw_lock_id);
|
||||
s32 sys_rwlock_wlock(u32 rw_lock_id, u64 timeout);
|
||||
s32 sys_rwlock_trywlock(u32 rw_lock_id);
|
||||
s32 sys_rwlock_wunlock(u32 rw_lock_id);
|
|
@ -3,11 +3,12 @@
|
|||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "SC_Semaphore.h"
|
||||
#include "sys_semaphore.h"
|
||||
#include "sys_time.h"
|
||||
|
||||
SysCallBase sys_sem("sys_semaphore");
|
||||
|
||||
int sys_semaphore_create(mem32_t sem, mem_ptr_t<sys_semaphore_attribute> attr, int initial_count, int max_count)
|
||||
s32 sys_semaphore_create(mem32_t sem, mem_ptr_t<sys_semaphore_attribute> attr, int initial_count, int max_count)
|
||||
{
|
||||
sys_sem.Warning("sys_semaphore_create(sem_addr=0x%x, attr_addr=0x%x, initial_count=%d, max_count=%d)",
|
||||
sem.GetAddr(), attr.GetAddr(), initial_count, max_count);
|
||||
|
@ -45,7 +46,7 @@ int sys_semaphore_create(mem32_t sem, mem_ptr_t<sys_semaphore_attribute> attr, i
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_semaphore_destroy(u32 sem_id)
|
||||
s32 sys_semaphore_destroy(u32 sem_id)
|
||||
{
|
||||
sys_sem.Warning("sys_semaphore_destroy(sem_id=%d)", sem_id);
|
||||
|
||||
|
@ -64,7 +65,7 @@ int sys_semaphore_destroy(u32 sem_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_semaphore_wait(u32 sem_id, u64 timeout)
|
||||
s32 sys_semaphore_wait(u32 sem_id, u64 timeout)
|
||||
{
|
||||
sys_sem.Log("sys_semaphore_wait(sem_id=%d, timeout=%lld)", sem_id, timeout);
|
||||
|
||||
|
@ -118,7 +119,7 @@ int sys_semaphore_wait(u32 sem_id, u64 timeout)
|
|||
}
|
||||
}
|
||||
|
||||
int sys_semaphore_trywait(u32 sem_id)
|
||||
s32 sys_semaphore_trywait(u32 sem_id)
|
||||
{
|
||||
sys_sem.Log("sys_semaphore_trywait(sem_id=%d)", sem_id);
|
||||
|
||||
|
@ -141,7 +142,7 @@ int sys_semaphore_trywait(u32 sem_id)
|
|||
}
|
||||
}
|
||||
|
||||
int sys_semaphore_post(u32 sem_id, int count)
|
||||
s32 sys_semaphore_post(u32 sem_id, int count)
|
||||
{
|
||||
sys_sem.Log("sys_semaphore_post(sem_id=%d, count=%d)", sem_id, count);
|
||||
|
||||
|
@ -193,7 +194,7 @@ int sys_semaphore_post(u32 sem_id, int count)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_semaphore_get_value(u32 sem_id, mem32_t count)
|
||||
s32 sys_semaphore_get_value(u32 sem_id, mem32_t count)
|
||||
{
|
||||
sys_sem.Log("sys_semaphore_get_value(sem_id=%d, count_addr=0x%x)", sem_id, count.GetAddr());
|
||||
|
|
@ -33,4 +33,12 @@ struct Semaphore
|
|||
, name(name)
|
||||
{
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
s32 sys_semaphore_create(mem32_t sem, mem_ptr_t<sys_semaphore_attribute> attr, int initial_count, int max_count);
|
||||
s32 sys_semaphore_destroy(u32 sem_id);
|
||||
s32 sys_semaphore_wait(u32 sem_id, u64 timeout);
|
||||
s32 sys_semaphore_trywait(u32 sem_id);
|
||||
s32 sys_semaphore_post(u32 sem_id, int count);
|
||||
s32 sys_semaphore_get_value(u32 sem_id, mem32_t count);
|
|
@ -4,7 +4,7 @@
|
|||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Spinlock.h"
|
||||
#include "sys_spinlock.h"
|
||||
|
||||
SysCallBase sys_spinlock("sys_spinlock");
|
||||
|
||||
|
@ -28,7 +28,7 @@ void sys_spinlock_lock(mem_ptr_t<spinlock> lock)
|
|||
}
|
||||
}
|
||||
|
||||
int sys_spinlock_trylock(mem_ptr_t<spinlock> lock)
|
||||
s32 sys_spinlock_trylock(mem_ptr_t<spinlock> lock)
|
||||
{
|
||||
sys_spinlock.Log("sys_spinlock_trylock(lock_addr=0x%x)", lock.GetAddr());
|
||||
|
12
rpcs3/Emu/SysCalls/lv2/sys_spinlock.h
Normal file
12
rpcs3/Emu/SysCalls/lv2/sys_spinlock.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
struct spinlock
|
||||
{
|
||||
SMutexBE mutex;
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
void sys_spinlock_initialize(mem_ptr_t<spinlock> lock);
|
||||
void sys_spinlock_lock(mem_ptr_t<spinlock> lock);
|
||||
s32 sys_spinlock_trylock(mem_ptr_t<spinlock> lock);
|
||||
void sys_spinlock_unlock(mem_ptr_t<spinlock> lock);
|
|
@ -4,7 +4,7 @@
|
|||
#include "Emu/System.h"
|
||||
#include "Emu/Cell/PPUThread.h"
|
||||
#include "Emu/FS/vfsFile.h"
|
||||
#include "SC_SPU_Thread.h"
|
||||
#include "sys_spu.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
#include "Loader/ELF.h"
|
||||
|
@ -42,8 +42,25 @@ u32 LoadSpuImage(vfsStream& stream)
|
|||
return LoadSpuImage(stream, g_last_spu_offset);
|
||||
}*/
|
||||
|
||||
/*u32 _max_usable_spu = 0;
|
||||
u32 _max_raw_spu = 0;
|
||||
|
||||
s32 sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu)
|
||||
{
|
||||
sc_spu.Log("sys_spu_initialize(max_usable_spu=%d, max_raw_spu=%d)", max_usable_spu, max_raw_spu);
|
||||
_max_usable_spu = max_usable_spu;
|
||||
_max_raw_spu = max_raw_spu;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
s32 sys_raw_spu_create(u32 id_addr, u32 attr_addr)
|
||||
{
|
||||
Memory.Write32(id_addr, Emu.GetIdManager().GetNewID("raw_spu"));
|
||||
return CELL_OK;
|
||||
}*/
|
||||
|
||||
//156
|
||||
int sys_spu_image_open(mem_ptr_t<sys_spu_image> img, u32 path_addr)
|
||||
s32 sys_spu_image_open(mem_ptr_t<sys_spu_image> img, u32 path_addr)
|
||||
{
|
||||
const std::string path = Memory.ReadString(path_addr).c_str();
|
||||
sc_spu.Warning("sys_spu_image_open(img_addr=0x%x, path_addr=0x%x [%s])", img.GetAddr(), path_addr, path.c_str());
|
||||
|
@ -72,7 +89,7 @@ int sys_spu_image_open(mem_ptr_t<sys_spu_image> img, u32 path_addr)
|
|||
}
|
||||
|
||||
//172
|
||||
int sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<sys_spu_image> img, mem_ptr_t<sys_spu_thread_attribute> attr, mem_ptr_t<sys_spu_thread_argument> arg)
|
||||
s32 sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<sys_spu_image> img, mem_ptr_t<sys_spu_thread_attribute> attr, mem_ptr_t<sys_spu_thread_argument> arg)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_initialize(thread_addr=0x%x, group=0x%x, spu_num=%d, img_addr=0x%x, attr_addr=0x%x, arg_addr=0x%x)",
|
||||
thread.GetAddr(), group, spu_num, img.GetAddr(), attr.GetAddr(), arg.GetAddr());
|
||||
|
@ -143,7 +160,7 @@ int sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<
|
|||
}
|
||||
|
||||
//166
|
||||
int sys_spu_thread_set_argument(u32 id, mem_ptr_t<sys_spu_thread_argument> arg)
|
||||
s32 sys_spu_thread_set_argument(u32 id, mem_ptr_t<sys_spu_thread_argument> arg)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_set_argument(id=%d, arg_addr=0x%x)", id, arg.GetAddr());
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
@ -167,7 +184,7 @@ int sys_spu_thread_set_argument(u32 id, mem_ptr_t<sys_spu_thread_argument> arg)
|
|||
}
|
||||
|
||||
//165
|
||||
int sys_spu_thread_get_exit_status(u32 id, mem32_t status)
|
||||
s32 sys_spu_thread_get_exit_status(u32 id, mem32_t status)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_get_exit_status(id=%d, status_addr=0x%x)", id, status.GetAddr());
|
||||
|
||||
|
@ -194,7 +211,7 @@ int sys_spu_thread_get_exit_status(u32 id, mem32_t status)
|
|||
}
|
||||
|
||||
//171
|
||||
int sys_spu_thread_group_destroy(u32 id)
|
||||
s32 sys_spu_thread_group_destroy(u32 id)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_group_destroy(id=%d)", id);
|
||||
|
||||
|
@ -221,7 +238,7 @@ int sys_spu_thread_group_destroy(u32 id)
|
|||
}
|
||||
|
||||
//173
|
||||
int sys_spu_thread_group_start(u32 id)
|
||||
s32 sys_spu_thread_group_start(u32 id)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_group_start(id=%d)", id);
|
||||
|
||||
|
@ -246,7 +263,7 @@ int sys_spu_thread_group_start(u32 id)
|
|||
}
|
||||
|
||||
//174
|
||||
int sys_spu_thread_group_suspend(u32 id)
|
||||
s32 sys_spu_thread_group_suspend(u32 id)
|
||||
{
|
||||
sc_spu.Log("sys_spu_thread_group_suspend(id=%d)", id);
|
||||
|
||||
|
@ -270,7 +287,7 @@ int sys_spu_thread_group_suspend(u32 id)
|
|||
}
|
||||
|
||||
//175
|
||||
int sys_spu_thread_group_resume(u32 id)
|
||||
s32 sys_spu_thread_group_resume(u32 id)
|
||||
{
|
||||
sc_spu.Log("sys_spu_thread_group_resume(id=%d)", id);
|
||||
|
||||
|
@ -294,7 +311,7 @@ int sys_spu_thread_group_resume(u32 id)
|
|||
}
|
||||
|
||||
//170
|
||||
int sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu_thread_group_attribute> attr)
|
||||
s32 sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu_thread_group_attribute> attr)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_group_create(id_addr=0x%x, num=%d, prio=%d, attr_addr=0x%x)",
|
||||
id.GetAddr(), num, prio, attr.GetAddr());
|
||||
|
@ -318,7 +335,7 @@ int sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu
|
|||
}
|
||||
|
||||
//178
|
||||
int sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
|
||||
s32 sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_group_join(id=%d, cause_addr=0x%x, status_addr=0x%x)", id, cause.GetAddr(), status.GetAddr());
|
||||
|
||||
|
@ -357,7 +374,7 @@ int sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_spu_thread_create(mem32_t thread_id, mem32_t entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr)
|
||||
s32 sys_spu_thread_create(mem32_t thread_id, mem32_t entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_create(thread_id_addr=0x%x, entry_addr=0x%x, arg=0x%llx, prio=%d, stacksize=0x%x, flags=0x%llx, threadname_addr=0x%x",
|
||||
thread_id.GetAddr(), entry.GetAddr(), arg, prio, stacksize, flags, threadname_addr);
|
||||
|
@ -365,7 +382,7 @@ int sys_spu_thread_create(mem32_t thread_id, mem32_t entry, u64 arg, int prio, u
|
|||
}
|
||||
|
||||
//169
|
||||
int sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu)
|
||||
s32 sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_initialize(max_usable_spu=%d, max_raw_spu=%d)", max_usable_spu, max_raw_spu);
|
||||
|
||||
|
@ -386,7 +403,7 @@ int sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu)
|
|||
}
|
||||
|
||||
//181
|
||||
int sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type)
|
||||
s32 sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type)
|
||||
{
|
||||
sc_spu.Log("sys_spu_thread_write_ls(id=%d, address=0x%x, value=0x%llx, type=0x%x)",
|
||||
id, address, value, type);
|
||||
|
@ -419,7 +436,7 @@ int sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type)
|
|||
}
|
||||
|
||||
//182
|
||||
int sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type)
|
||||
s32 sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type)
|
||||
{
|
||||
sc_spu.Log("sys_spu_thread_read_ls(id=%d, address=0x%x, value_addr=0x%x, type=0x%x)",
|
||||
id, address, value.GetAddr(), type);
|
||||
|
@ -457,7 +474,7 @@ int sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type)
|
|||
}
|
||||
|
||||
//190
|
||||
int sys_spu_thread_write_spu_mb(u32 id, u32 value)
|
||||
s32 sys_spu_thread_write_spu_mb(u32 id, u32 value)
|
||||
{
|
||||
sc_spu.Log("sys_spu_thread_write_spu_mb(id=%d, value=0x%x)", id, value);
|
||||
|
||||
|
@ -474,7 +491,7 @@ int sys_spu_thread_write_spu_mb(u32 id, u32 value)
|
|||
}
|
||||
|
||||
//187
|
||||
int sys_spu_thread_set_spu_cfg(u32 id, u64 value)
|
||||
s32 sys_spu_thread_set_spu_cfg(u32 id, u64 value)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_set_spu_cfg(id=%d, value=0x%x)", id, value);
|
||||
|
||||
|
@ -496,7 +513,7 @@ int sys_spu_thread_set_spu_cfg(u32 id, u64 value)
|
|||
}
|
||||
|
||||
//188
|
||||
int sys_spu_thread_get_spu_cfg(u32 id, mem64_t value)
|
||||
s32 sys_spu_thread_get_spu_cfg(u32 id, mem64_t value)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_get_spu_cfg(id=%d, value_addr=0x%x)", id, value.GetAddr());
|
||||
|
||||
|
@ -513,7 +530,7 @@ int sys_spu_thread_get_spu_cfg(u32 id, mem64_t value)
|
|||
}
|
||||
|
||||
//184
|
||||
int sys_spu_thread_write_snr(u32 id, u32 number, u32 value)
|
||||
s32 sys_spu_thread_write_snr(u32 id, u32 number, u32 value)
|
||||
{
|
||||
sc_spu.Log("sys_spu_thread_write_snr(id=%d, number=%d, value=0x%x)", id, number, value);
|
||||
CPUThread* thr = Emu.GetCPU().GetThread(id);
|
||||
|
@ -533,14 +550,14 @@ int sys_spu_thread_write_snr(u32 id, u32 number, u32 value)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et)
|
||||
s32 sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_group_connect_event(id=%d, eq=%d, et=0x%x)", id, eq, et);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_spu_thread_group_disconnect_event(u32 id, u32 et)
|
||||
s32 sys_spu_thread_group_disconnect_event(u32 id, u32 et)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_group_disconnect_event(id=%d, et=0x%x)", id, et);
|
||||
|
||||
|
@ -549,13 +566,13 @@ int sys_spu_thread_group_disconnect_event(u32 id, u32 et)
|
|||
|
||||
/*
|
||||
SPU-Side functions:
|
||||
int sys_spu_thread_receive_event(u32 spuq_num, mem32_t d1, mem32_t d2, mem32_t d3);
|
||||
int sys_spu_thread_send_event(u8 spup, u24 data0, u32 data1);
|
||||
int sys_spu_thread_throw_event(u8 spup, u24 data0, u32 data1);
|
||||
int sys_spu_thread_tryreceive_event(u32 spuq_num, mem32_t d1, mem32_t d2, mem32_t d3);
|
||||
s32 sys_spu_thread_receive_event(u32 spuq_num, mem32_t d1, mem32_t d2, mem32_t d3);
|
||||
s32 sys_spu_thread_send_event(u8 spup, u24 data0, u32 data1);
|
||||
s32 sys_spu_thread_throw_event(u8 spup, u24 data0, u32 data1);
|
||||
s32 sys_spu_thread_tryreceive_event(u32 spuq_num, mem32_t d1, mem32_t d2, mem32_t d3);
|
||||
*/
|
||||
|
||||
int sys_spu_thread_connect_event(u32 id, u32 eq_id, u32 et, u8 spup)
|
||||
s32 sys_spu_thread_connect_event(u32 id, u32 eq_id, u32 et, u8 spup)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_connect_event(id=%d, eq_id=%d, event_type=0x%x, spup=%d)", id, eq_id, et, spup);
|
||||
|
||||
|
@ -604,7 +621,7 @@ int sys_spu_thread_connect_event(u32 id, u32 eq_id, u32 et, u8 spup)
|
|||
}
|
||||
|
||||
//
|
||||
int sys_spu_thread_disconnect_event(u32 id, u32 et, u8 spup)
|
||||
s32 sys_spu_thread_disconnect_event(u32 id, u32 et, u8 spup)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_disconnect_event(id=%d, event_type=0x%x, spup=%d)", id, et, spup);
|
||||
|
||||
|
@ -644,7 +661,7 @@ int sys_spu_thread_disconnect_event(u32 id, u32 et, u8 spup)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_spu_thread_bind_queue(u32 id, u32 eq_id, u32 spuq_num)
|
||||
s32 sys_spu_thread_bind_queue(u32 id, u32 eq_id, u32 spuq_num)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_bind_queue(id=%d, equeue_id=%d, spuq_num=0x%x)", id, eq_id, spuq_num);
|
||||
|
||||
|
@ -674,7 +691,7 @@ int sys_spu_thread_bind_queue(u32 id, u32 eq_id, u32 spuq_num)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_spu_thread_unbind_queue(u32 id, u32 spuq_num)
|
||||
s32 sys_spu_thread_unbind_queue(u32 id, u32 spuq_num)
|
||||
{
|
||||
sc_spu.Warning("sys_spu_thread_unbind_queue(id=0x%x, spuq_num=0x%x)", id, spuq_num);
|
||||
|
||||
|
@ -693,7 +710,7 @@ int sys_spu_thread_unbind_queue(u32 id, u32 spuq_num)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, u32 spup_addr)
|
||||
s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, u32 spup_addr)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_group_connect_event_all_threads(id=%d, eq=%d, req=0x%llx, spup_addr=0x%x)",
|
||||
id, eq, req, spup_addr);
|
||||
|
@ -740,7 +757,7 @@ int sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, u32
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup)
|
||||
s32 sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup)
|
||||
{
|
||||
sc_spu.Error("sys_spu_thread_group_disconnect_event_all_threads(id=%d, spup=%d)", id, spup);
|
||||
|
||||
|
@ -748,7 +765,7 @@ int sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup)
|
|||
}
|
||||
|
||||
//160
|
||||
int sys_raw_spu_create(mem32_t id, u32 attr_addr)
|
||||
s32 sys_raw_spu_create(mem32_t id, u32 attr_addr)
|
||||
{
|
||||
sc_spu.Warning("sys_raw_spu_create(id_addr=0x%x, attr_addr=0x%x)", id.GetAddr(), attr_addr);
|
||||
|
||||
|
@ -761,14 +778,14 @@ int sys_raw_spu_create(mem32_t id, u32 attr_addr)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_raw_spu_destroy(u32 id)
|
||||
s32 sys_raw_spu_destroy(u32 id)
|
||||
{
|
||||
sc_spu.Error("sys_raw_spu_destroy(id=%d)", id);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, mem32_t intrtag)
|
||||
s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, mem32_t intrtag)
|
||||
{
|
||||
sc_spu.Error("sys_raw_spu_create_interrupt_tag(id=%d, class_id=%d, hwthread=0x%x, intrtag_addr=0x%x)", id, class_id, hwthread, intrtag.GetAddr());
|
||||
|
||||
|
@ -800,7 +817,7 @@ int sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, mem32_t
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask)
|
||||
s32 sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask)
|
||||
{
|
||||
sc_spu.Warning("sys_raw_spu_set_int_mask(id=%d, class_id=%d, mask=0x%llx)", id, class_id, mask);
|
||||
|
||||
|
@ -819,7 +836,7 @@ int sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_raw_spu_get_int_mask(u32 id, u32 class_id, mem64_t mask)
|
||||
s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, mem64_t mask)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_get_int_mask(id=%d, class_id=%d, mask_addr=0x%x)", id, class_id, mask.GetAddr());
|
||||
|
||||
|
@ -843,7 +860,7 @@ int sys_raw_spu_get_int_mask(u32 id, u32 class_id, mem64_t mask)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat)
|
||||
s32 sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_set_int_stat(id=%d, class_id=%d, stat=0x%llx)", id, class_id, stat);
|
||||
|
||||
|
@ -862,7 +879,7 @@ int sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_raw_spu_get_int_stat(u32 id, u32 class_id, mem64_t stat)
|
||||
s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, mem64_t stat)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_get_int_stat(id=%d, class_id=%d, stat_addr=0xx)", id, class_id, stat.GetAddr());
|
||||
|
||||
|
@ -886,7 +903,7 @@ int sys_raw_spu_get_int_stat(u32 id, u32 class_id, mem64_t stat)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_raw_spu_read_puint_mb(u32 id, mem32_t value)
|
||||
s32 sys_raw_spu_read_puint_mb(u32 id, mem32_t value)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_read_puint_mb(id=%d, value_addr=0x%x)", id, value.GetAddr());
|
||||
|
||||
|
@ -907,7 +924,7 @@ int sys_raw_spu_read_puint_mb(u32 id, mem32_t value)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_raw_spu_set_spu_cfg(u32 id, u32 value)
|
||||
s32 sys_raw_spu_set_spu_cfg(u32 id, u32 value)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_set_spu_cfg(id=%d, value=0x%x)", id, value);
|
||||
|
||||
|
@ -921,7 +938,7 @@ int sys_raw_spu_set_spu_cfg(u32 id, u32 value)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_raw_spu_get_spu_cfg(u32 id, mem32_t value)
|
||||
s32 sys_raw_spu_get_spu_cfg(u32 id, mem32_t value)
|
||||
{
|
||||
sc_spu.Log("sys_raw_spu_get_spu_afg(id=%d, value_addr=0x%x)", id, value.GetAddr());
|
||||
|
121
rpcs3/Emu/SysCalls/lv2/sys_spu.h
Normal file
121
rpcs3/Emu/SysCalls/lv2/sys_spu.h
Normal file
|
@ -0,0 +1,121 @@
|
|||
#pragma once
|
||||
|
||||
u32 LoadSpuImage(vfsStream& stream, u32& spu_ep);
|
||||
|
||||
enum
|
||||
{
|
||||
SYS_SPU_THREAD_GROUP_JOIN_GROUP_EXIT = 0x0001,
|
||||
SYS_SPU_THREAD_GROUP_JOIN_ALL_THREADS_EXIT = 0x0002,
|
||||
SYS_SPU_THREAD_GROUP_JOIN_TERMINATED = 0x0004
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
SYS_SPU_SEGMENT_TYPE_COPY = 0x0001,
|
||||
SYS_SPU_SEGMENT_TYPE_FILL = 0x0002,
|
||||
SYS_SPU_SEGMENT_TYPE_INFO = 0x0004,
|
||||
};
|
||||
|
||||
struct sys_spu_thread_group_attribute
|
||||
{
|
||||
be_t<u32> name_len;
|
||||
be_t<u32> name_addr;
|
||||
be_t<int> type;
|
||||
/* struct {} option; */
|
||||
be_t<u32> ct; // memory container id
|
||||
};
|
||||
|
||||
struct sys_spu_thread_attribute
|
||||
{
|
||||
be_t<u32> name_addr;
|
||||
be_t<u32> name_len;
|
||||
be_t<u32> option;
|
||||
};
|
||||
|
||||
struct sys_spu_thread_argument
|
||||
{
|
||||
be_t<u64> arg1;
|
||||
be_t<u64> arg2;
|
||||
be_t<u64> arg3;
|
||||
be_t<u64> arg4;
|
||||
};
|
||||
|
||||
struct sys_spu_image
|
||||
{
|
||||
be_t<u32> type;
|
||||
be_t<u32> entry_point;
|
||||
be_t<u32> segs_addr; //temporarily used as offset of LS image after elf loading
|
||||
be_t<int> nsegs;
|
||||
};
|
||||
|
||||
struct sys_spu_segment
|
||||
{
|
||||
be_t<int> type;
|
||||
be_t<u32> ls_start;
|
||||
be_t<int> size;
|
||||
be_t<u64> src;
|
||||
};
|
||||
|
||||
struct SpuGroupInfo
|
||||
{
|
||||
std::vector<u32> list;
|
||||
std::atomic<u32> lock;
|
||||
std::string m_name;
|
||||
int m_prio;
|
||||
int m_type;
|
||||
int m_ct;
|
||||
|
||||
SpuGroupInfo(const std::string& name, u32 num, int prio, int type, u32 ct)
|
||||
: m_name(name)
|
||||
, m_prio(prio)
|
||||
, m_type(type)
|
||||
, m_ct(ct)
|
||||
, lock(0)
|
||||
{
|
||||
num = 256;
|
||||
list.resize(num);
|
||||
for (u32 i = 0; i < num; i++)
|
||||
{
|
||||
list[i] = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
s32 sys_spu_initialize(u32 max_usable_spu, u32 max_raw_spu);
|
||||
s32 sys_spu_image_open(mem_ptr_t<sys_spu_image> img, u32 path_addr);
|
||||
s32 sys_spu_thread_initialize(mem32_t thread, u32 group, u32 spu_num, mem_ptr_t<sys_spu_image> img, mem_ptr_t<sys_spu_thread_attribute> attr, mem_ptr_t<sys_spu_thread_argument> arg);
|
||||
s32 sys_spu_thread_set_argument(u32 id, mem_ptr_t<sys_spu_thread_argument> arg);
|
||||
s32 sys_spu_thread_group_destroy(u32 id);
|
||||
s32 sys_spu_thread_group_start(u32 id);
|
||||
s32 sys_spu_thread_group_suspend(u32 id);
|
||||
s32 sys_spu_thread_group_resume(u32 id);
|
||||
s32 sys_spu_thread_group_create(mem32_t id, u32 num, int prio, mem_ptr_t<sys_spu_thread_group_attribute> attr);
|
||||
s32 sys_spu_thread_create(mem32_t thread_id, mem32_t entry, u64 arg, int prio, u32 stacksize, u64 flags, u32 threadname_addr);
|
||||
s32 sys_spu_thread_group_join(u32 id, mem32_t cause, mem32_t status);
|
||||
s32 sys_spu_thread_group_connect_event(u32 id, u32 eq, u32 et);
|
||||
s32 sys_spu_thread_group_disconnect_event(u32 id, u32 et);
|
||||
s32 sys_spu_thread_group_connect_event_all_threads(u32 id, u32 eq, u64 req, u32 spup_addr);
|
||||
s32 sys_spu_thread_group_disconnect_event_all_threads(u32 id, u8 spup);
|
||||
s32 sys_spu_thread_write_ls(u32 id, u32 address, u64 value, u32 type);
|
||||
s32 sys_spu_thread_read_ls(u32 id, u32 address, mem64_t value, u32 type);
|
||||
s32 sys_spu_thread_write_spu_mb(u32 id, u32 value);
|
||||
s32 sys_spu_thread_set_spu_cfg(u32 id, u64 value);
|
||||
s32 sys_spu_thread_get_spu_cfg(u32 id, mem64_t value);
|
||||
s32 sys_spu_thread_write_snr(u32 id, u32 number, u32 value);
|
||||
s32 sys_spu_thread_connect_event(u32 id, u32 eq, u32 et, u8 spup);
|
||||
s32 sys_spu_thread_disconnect_event(u32 id, u32 event_type, u8 spup);
|
||||
s32 sys_spu_thread_bind_queue(u32 id, u32 spuq, u32 spuq_num);
|
||||
s32 sys_spu_thread_unbind_queue(u32 id, u32 spuq_num);
|
||||
s32 sys_spu_thread_get_exit_status(u32 id, mem32_t status);
|
||||
|
||||
s32 sys_raw_spu_create(mem32_t id, u32 attr_addr);
|
||||
s32 sys_raw_spu_destroy(u32 id);
|
||||
s32 sys_raw_spu_create_interrupt_tag(u32 id, u32 class_id, u32 hwthread, mem32_t intrtag);
|
||||
s32 sys_raw_spu_set_int_mask(u32 id, u32 class_id, u64 mask);
|
||||
s32 sys_raw_spu_get_int_mask(u32 id, u32 class_id, mem64_t mask);
|
||||
s32 sys_raw_spu_set_int_stat(u32 id, u32 class_id, u64 stat);
|
||||
s32 sys_raw_spu_get_int_stat(u32 id, u32 class_id, mem64_t stat);
|
||||
s32 sys_raw_spu_read_puint_mb(u32 id, mem32_t value);
|
||||
s32 sys_raw_spu_set_spu_cfg(u32 id, u32 value);
|
||||
s32 sys_raw_spu_get_spu_cfg(u32 id, mem32_t value);
|
|
@ -10,7 +10,7 @@
|
|||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "SC_Time.h"
|
||||
#include "sys_time.h"
|
||||
|
||||
SysCallBase sys_time("sys_time");
|
||||
|
||||
|
@ -45,7 +45,7 @@ u64 get_system_time()
|
|||
|
||||
|
||||
// Functions
|
||||
int sys_time_get_timezone(mem32_t timezone, mem32_t summertime)
|
||||
s32 sys_time_get_timezone(mem32_t timezone, mem32_t summertime)
|
||||
{
|
||||
int ret;
|
||||
ret = cellSysutilGetSystemParamInt(0x0116, timezone); //0x0116 = CELL_SYSUTIL_SYSTEMPARAM_ID_TIMEZONE
|
||||
|
@ -55,7 +55,7 @@ int sys_time_get_timezone(mem32_t timezone, mem32_t summertime)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_time_get_current_time(u32 sec_addr, u32 nsec_addr)
|
||||
s32 sys_time_get_current_time(u32 sec_addr, u32 nsec_addr)
|
||||
{
|
||||
sys_time.Log("sys_time_get_current_time(sec_addr=0x%x, nsec_addr=0x%x)", sec_addr, nsec_addr);
|
||||
|
11
rpcs3/Emu/SysCalls/lv2/sys_time.h
Normal file
11
rpcs3/Emu/SysCalls/lv2/sys_time.h
Normal file
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
// Auxiliary functions
|
||||
u64 get_time();
|
||||
u64 get_system_time();
|
||||
|
||||
// SysCalls
|
||||
s32 sys_time_get_timezone(mem32_t timezone, mem32_t summertime);
|
||||
s32 sys_time_get_current_time(u32 sec_addr, u32 nsec_addr);
|
||||
s64 sys_time_get_system_time();
|
||||
u64 sys_time_get_timebase_frequency();
|
|
@ -2,13 +2,13 @@
|
|||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "SC_Timer.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/event.h"
|
||||
#include "Emu/Event.h"
|
||||
#include "sys_timer.h"
|
||||
|
||||
SysCallBase sys_timer("sys_timer");
|
||||
|
||||
int sys_timer_create(mem32_t timer_id)
|
||||
s32 sys_timer_create(mem32_t timer_id)
|
||||
{
|
||||
sys_timer.Warning("sys_timer_create(timer_id_addr=0x%x)", timer_id.GetAddr());
|
||||
|
||||
|
@ -18,7 +18,7 @@ int sys_timer_create(mem32_t timer_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_timer_destroy(u32 timer_id)
|
||||
s32 sys_timer_destroy(u32 timer_id)
|
||||
{
|
||||
sys_timer.Warning("TODO: sys_timer_destroy(timer_id=%d)", timer_id);
|
||||
|
||||
|
@ -28,7 +28,7 @@ int sys_timer_destroy(u32 timer_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_timer_get_information(u32 timer_id, mem_ptr_t<sys_timer_information_t> info)
|
||||
s32 sys_timer_get_information(u32 timer_id, mem_ptr_t<sys_timer_information_t> info)
|
||||
{
|
||||
sys_timer.Warning("sys_timer_get_information(timer_id=%d, info_addr=0x%x)", timer_id, info.GetAddr());
|
||||
|
||||
|
@ -39,7 +39,7 @@ int sys_timer_get_information(u32 timer_id, mem_ptr_t<sys_timer_information_t> i
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_timer_start(u32 timer_id, s64 base_time, u64 period)
|
||||
s32 sys_timer_start(u32 timer_id, s64 base_time, u64 period)
|
||||
{
|
||||
sys_timer.Warning("sys_timer_start_periodic_absolute(timer_id=%d, basetime=%lld, period=%llu)", timer_id, base_time, period);
|
||||
|
||||
|
@ -58,7 +58,7 @@ int sys_timer_start(u32 timer_id, s64 base_time, u64 period)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_timer_stop(u32 timer_id)
|
||||
s32 sys_timer_stop(u32 timer_id)
|
||||
{
|
||||
sys_timer.Warning("TODO: sys_timer_stop()");
|
||||
|
||||
|
@ -70,7 +70,7 @@ int sys_timer_stop(u32 timer_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data1, u64 data2)
|
||||
s32 sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data1, u64 data2)
|
||||
{
|
||||
sys_timer.Warning("sys_timer_connect_event_queue(timer_id=%d, queue_id=%d, name=%llu, data1=%llu, data2=%llu)",
|
||||
timer_id, queue_id, name, data1, data2);
|
||||
|
@ -85,7 +85,7 @@ int sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_timer_disconnect_event_queue(u32 timer_id)
|
||||
s32 sys_timer_disconnect_event_queue(u32 timer_id)
|
||||
{
|
||||
sys_timer.Warning("TODO: sys_timer_disconnect_event_queue(timer_id=%d)", timer_id);
|
||||
|
||||
|
@ -97,14 +97,14 @@ int sys_timer_disconnect_event_queue(u32 timer_id)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_timer_sleep(u32 sleep_time)
|
||||
s32 sys_timer_sleep(u32 sleep_time)
|
||||
{
|
||||
sys_timer.Warning("sys_timer_sleep(sleep_time=%d)", sleep_time);
|
||||
rSleep(sleep_time);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_timer_usleep(u64 sleep_time)
|
||||
s32 sys_timer_usleep(u64 sleep_time)
|
||||
{
|
||||
sys_timer.Log("sys_timer_usleep(sleep_time=%lld)", sleep_time);
|
||||
if (sleep_time > 0xFFFFFFFFFFFF) sleep_time = 0xFFFFFFFFFFFF; //2^48-1
|
33
rpcs3/Emu/SysCalls/lv2/sys_timer.h
Normal file
33
rpcs3/Emu/SysCalls/lv2/sys_timer.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#pragma once
|
||||
|
||||
enum
|
||||
{
|
||||
SYS_TIMER_STATE_STOP = 0x00U,
|
||||
SYS_TIMER_STATE_RUN = 0x01U,
|
||||
};
|
||||
|
||||
struct sys_timer_information_t
|
||||
{
|
||||
s64 next_expiration_time; //system_time_t
|
||||
u64 period; //usecond_t
|
||||
u32 timer_state;
|
||||
u32 pad;
|
||||
};
|
||||
|
||||
struct timer
|
||||
{
|
||||
rTimer tmr;
|
||||
sys_timer_information_t timer_information_t;
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
s32 sys_timer_create(mem32_t timer_id);
|
||||
s32 sys_timer_destroy(u32 timer_id);
|
||||
s32 sys_timer_get_information(u32 timer_id, mem_ptr_t<sys_timer_information_t> info);
|
||||
s32 sys_timer_start(u32 timer_id, s64 basetime, u64 period);
|
||||
s32 sys_timer_stop(u32 timer_id);
|
||||
s32 sys_timer_connect_event_queue(u32 timer_id, u32 queue_id, u64 name, u64 data1, u64 data2);
|
||||
s32 sys_timer_disconnect_event_queue(u32 timer_id);
|
||||
s32 sys_timer_sleep(u32 sleep_time);
|
||||
s32 sys_timer_usleep(u64 sleep_time);
|
|
@ -3,64 +3,65 @@
|
|||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "sys_trace.h"
|
||||
|
||||
SysCallBase sys_trace("sys_trace");
|
||||
|
||||
int sys_trace_create()
|
||||
s32 sys_trace_create()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_create()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_trace_start()
|
||||
s32 sys_trace_start()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_start()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_trace_stop()
|
||||
s32 sys_trace_stop()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_stop()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_trace_update_top_index()
|
||||
s32 sys_trace_update_top_index()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_update_top_index()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_trace_destroy()
|
||||
s32 sys_trace_destroy()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_destroy()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_trace_drain()
|
||||
s32 sys_trace_drain()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_drain()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_trace_attach_process()
|
||||
s32 sys_trace_attach_process()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_attach_process()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_trace_allocate_buffer()
|
||||
s32 sys_trace_allocate_buffer()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_allocate_buffer()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_trace_free_buffer()
|
||||
s32 sys_trace_free_buffer()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_free_buffer()");
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_trace_create2()
|
||||
s32 sys_trace_create2()
|
||||
{
|
||||
sys_trace.Warning("Unimplemented function: sys_trace_create2()");
|
||||
return CELL_OK;
|
13
rpcs3/Emu/SysCalls/lv2/sys_trace.h
Normal file
13
rpcs3/Emu/SysCalls/lv2/sys_trace.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
// SysCalls
|
||||
s32 sys_trace_create();
|
||||
s32 sys_trace_start();
|
||||
s32 sys_trace_stop();
|
||||
s32 sys_trace_update_top_index();
|
||||
s32 sys_trace_destroy();
|
||||
s32 sys_trace_drain();
|
||||
s32 sys_trace_attach_process();
|
||||
s32 sys_trace_allocate_buffer();
|
||||
s32 sys_trace_free_buffer();
|
||||
s32 sys_trace_create2();
|
|
@ -3,10 +3,11 @@
|
|||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "sys_tty.h"
|
||||
|
||||
int sys_tty_read(u32 ch, u64 buf_addr, u32 len, u64 preadlen_addr)
|
||||
s32 sys_tty_read(u32 ch, u64 buf_addr, u32 len, u64 preadlen_addr)
|
||||
{
|
||||
//we currently do not support reading from the Console
|
||||
// We currently do not support reading from the Console
|
||||
LOG_WARNING(HLE, "sys_tty_read: ch: %d, buf addr: %llx, len: %d", ch, buf_addr, len);
|
||||
Memory.Write32NN(preadlen_addr, len);
|
||||
Emu.Pause();
|
||||
|
@ -14,20 +15,17 @@ int sys_tty_read(u32 ch, u64 buf_addr, u32 len, u64 preadlen_addr)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_tty_write(u32 ch, u64 buf_addr, u32 len, u64 pwritelen_addr)
|
||||
s32 sys_tty_write(u32 ch, u64 buf_addr, u32 len, u64 pwritelen_addr)
|
||||
{
|
||||
if(ch > 15 || (s32)len <= 0) return CELL_EINVAL;
|
||||
if(!Memory.IsGoodAddr(buf_addr)) return CELL_EFAULT;
|
||||
|
||||
//ch 0 seems to be stdout and ch 1 stderr
|
||||
if (ch == 1)
|
||||
{
|
||||
LOG_ERROR(TTY, Memory.ReadString(buf_addr, len));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ch == SYS_TTYP_PPU_STDOUT || ch == SYS_TTYP_SPU_STDOUT || (ch >= SYS_TTYP_USER1 && ch <= SYS_TTYP_USER13)) {
|
||||
LOG_NOTICE(TTY, Memory.ReadString(buf_addr, len));
|
||||
}
|
||||
if (ch == SYS_TTYP_PPU_STDERR) {
|
||||
LOG_ERROR(TTY, Memory.ReadString(buf_addr, len));
|
||||
}
|
||||
|
||||
if(!Memory.IsGoodAddr(pwritelen_addr)) return CELL_EFAULT;
|
||||
|
27
rpcs3/Emu/SysCalls/lv2/sys_tty.h
Normal file
27
rpcs3/Emu/SysCalls/lv2/sys_tty.h
Normal file
|
@ -0,0 +1,27 @@
|
|||
#pragma once
|
||||
|
||||
// TTY channels
|
||||
enum
|
||||
{
|
||||
SYS_TTYP_PPU_STDIN = 0,
|
||||
SYS_TTYP_PPU_STDOUT = 0,
|
||||
SYS_TTYP_PPU_STDERR = 1,
|
||||
SYS_TTYP_SPU_STDOUT = 2,
|
||||
SYS_TTYP_USER1 = 3,
|
||||
SYS_TTYP_USER2 = 4,
|
||||
SYS_TTYP_USER3 = 5,
|
||||
SYS_TTYP_USER4 = 6,
|
||||
SYS_TTYP_USER5 = 7,
|
||||
SYS_TTYP_USER6 = 8,
|
||||
SYS_TTYP_USER7 = 9,
|
||||
SYS_TTYP_USER8 = 10,
|
||||
SYS_TTYP_USER9 = 11,
|
||||
SYS_TTYP_USER10 = 12,
|
||||
SYS_TTYP_USER11 = 13,
|
||||
SYS_TTYP_USER12 = 14,
|
||||
SYS_TTYP_USER13 = 15,
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
s32 sys_tty_read(u32 ch, u64 buf_addr, u32 len, u64 preadlen_addr);
|
||||
s32 sys_tty_write(u32 ch, u64 buf_addr, u32 len, u64 pwritelen_addr);
|
|
@ -3,12 +3,12 @@
|
|||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "SC_Memory.h"
|
||||
#include "sys_memory.h"
|
||||
|
||||
SysCallBase sc_vm("vm");
|
||||
MemoryContainerInfo* current_ct;
|
||||
|
||||
int sys_vm_memory_map(u32 vsize, u32 psize, u32 cid, u64 flag, u64 policy, u32 addr)
|
||||
s32 sys_vm_memory_map(u32 vsize, u32 psize, u32 cid, u64 flag, u64 policy, u32 addr)
|
||||
{
|
||||
sc_vm.Warning("sys_vm_memory_map(vsize=0x%x,psize=0x%x,cidr=0x%x,flags=0x%llx,policy=0x%llx,addr=0x%x)",
|
||||
vsize, psize, cid, flag, policy, addr);
|
||||
|
@ -68,7 +68,7 @@ int sys_vm_memory_map(u32 vsize, u32 psize, u32 cid, u64 flag, u64 policy, u32 a
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_vm_unmap(u32 addr)
|
||||
s32 sys_vm_unmap(u32 addr)
|
||||
{
|
||||
sc_vm.Warning("sys_vm_unmap(addr=0x%x)", addr);
|
||||
|
||||
|
@ -78,7 +78,7 @@ int sys_vm_unmap(u32 addr)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_vm_append_memory(u32 addr, u32 size)
|
||||
s32 sys_vm_append_memory(u32 addr, u32 size)
|
||||
{
|
||||
sc_vm.Warning("sys_vm_append_memory(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
|
@ -100,7 +100,7 @@ int sys_vm_append_memory(u32 addr, u32 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_vm_return_memory(u32 addr, u32 size)
|
||||
s32 sys_vm_return_memory(u32 addr, u32 size)
|
||||
{
|
||||
sc_vm.Warning("sys_vm_return_memory(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
|
@ -122,7 +122,7 @@ int sys_vm_return_memory(u32 addr, u32 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_vm_lock(u32 addr, u32 size)
|
||||
s32 sys_vm_lock(u32 addr, u32 size)
|
||||
{
|
||||
sc_vm.Warning("sys_vm_lock(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
|
@ -144,7 +144,7 @@ int sys_vm_lock(u32 addr, u32 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_vm_unlock(u32 addr, u32 size)
|
||||
s32 sys_vm_unlock(u32 addr, u32 size)
|
||||
{
|
||||
sc_vm.Warning("sys_vm_unlock(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
|
@ -159,7 +159,7 @@ int sys_vm_unlock(u32 addr, u32 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_vm_touch(u32 addr, u32 size)
|
||||
s32 sys_vm_touch(u32 addr, u32 size)
|
||||
{
|
||||
sc_vm.Warning("Unimplemented function: sys_vm_touch(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
|
@ -176,7 +176,7 @@ int sys_vm_touch(u32 addr, u32 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_vm_flush(u32 addr, u32 size)
|
||||
s32 sys_vm_flush(u32 addr, u32 size)
|
||||
{
|
||||
sc_vm.Warning("Unimplemented function: sys_vm_flush(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
|
@ -193,7 +193,7 @@ int sys_vm_flush(u32 addr, u32 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_vm_invalidate(u32 addr, u32 size)
|
||||
s32 sys_vm_invalidate(u32 addr, u32 size)
|
||||
{
|
||||
sc_vm.Warning("Unimplemented function: sys_vm_invalidate(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
|
@ -210,7 +210,7 @@ int sys_vm_invalidate(u32 addr, u32 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_vm_store(u32 addr, u32 size)
|
||||
s32 sys_vm_store(u32 addr, u32 size)
|
||||
{
|
||||
sc_vm.Warning("Unimplemented function: sys_vm_store(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
|
@ -227,7 +227,7 @@ int sys_vm_store(u32 addr, u32 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_vm_sync(u32 addr, u32 size)
|
||||
s32 sys_vm_sync(u32 addr, u32 size)
|
||||
{
|
||||
sc_vm.Warning("Unimplemented function: sys_vm_sync(addr=0x%x,size=0x%x)", addr, size);
|
||||
|
||||
|
@ -243,7 +243,7 @@ int sys_vm_sync(u32 addr, u32 size)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_vm_test(u32 addr, u32 size, u32 result_addr)
|
||||
s32 sys_vm_test(u32 addr, u32 size, u32 result_addr)
|
||||
{
|
||||
sc_vm.Warning("Unimplemented function: sys_vm_test(addr=0x%x,size=0x%x,result_addr=0x%x)", addr, size, result_addr);
|
||||
|
||||
|
@ -262,7 +262,7 @@ int sys_vm_test(u32 addr, u32 size, u32 result_addr)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_vm_get_statistics(u32 addr, u32 stat_addr)
|
||||
s32 sys_vm_get_statistics(u32 addr, u32 stat_addr)
|
||||
{
|
||||
sc_vm.Warning("Unimplemented function: sys_vm_get_statistics(addr=0x%x,stat_addr=0x%x)", addr, stat_addr);
|
||||
|
31
rpcs3/Emu/SysCalls/lv2/sys_vm.h
Normal file
31
rpcs3/Emu/SysCalls/lv2/sys_vm.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
#pragma pack
|
||||
|
||||
#define SYS_VM_TEST_INVALID 0x0000ULL
|
||||
#define SYS_VM_TEST_UNUSED 0x0001ULL
|
||||
#define SYS_VM_TEST_ALLOCATED 0x0002ULL
|
||||
#define SYS_VM_TEST_STORED 0x0004ULL
|
||||
|
||||
struct sys_vm_statistics {
|
||||
u64 vm_crash_ppu;
|
||||
u64 vm_crash_spu;
|
||||
u64 vm_read;
|
||||
u64 vm_write;
|
||||
u32 physical_mem_size;
|
||||
u32 physical_mem_used;
|
||||
u64 timestamp;
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
s32 sys_vm_memory_map(u32 vsize, u32 psize, u32 cid, u64 flag, u64 policy, u32 addr);
|
||||
s32 sys_vm_unmap(u32 addr);
|
||||
s32 sys_vm_append_memory(u32 addr, u32 size);
|
||||
s32 sys_vm_return_memory(u32 addr, u32 size);
|
||||
s32 sys_vm_lock(u32 addr, u32 size);
|
||||
s32 sys_vm_unlock(u32 addr, u32 size);
|
||||
s32 sys_vm_touch(u32 addr, u32 size);
|
||||
s32 sys_vm_flush(u32 addr, u32 size);
|
||||
s32 sys_vm_invalidate(u32 addr, u32 size);
|
||||
s32 sys_vm_store(u32 addr, u32 size);
|
||||
s32 sys_vm_sync(u32 addr, u32 size);
|
||||
s32 sys_vm_test(u32 addr, u32 size, u32 result_addr);
|
||||
s32 sys_vm_get_statistics(u32 addr, u32 stat_addr);
|
|
@ -407,7 +407,6 @@ void Emulator::Stop()
|
|||
GetAudioManager().Close();
|
||||
GetEventManager().Clear();
|
||||
GetCPU().Close();
|
||||
//SysCallsManager.Close();
|
||||
GetIdManager().Clear();
|
||||
GetPadManager().Close();
|
||||
GetKeyboardManager().Close();
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Event_flag.h"
|
||||
#include "Emu/SysCalls/lv2/sys_lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/sys_event.h"
|
||||
#include "DisAsmFrame.h"
|
||||
#include "Emu/FS/vfsLocalFile.h"
|
||||
#include "Emu/Cell/PPCThread.h"
|
||||
|
|
|
@ -1,102 +0,0 @@
|
|||
#include "stdafx.h"
|
||||
#include "Utilities/Log.h"
|
||||
#include "Emu/Memory/Memory.h"
|
||||
#include "FnIdGenerator.h"
|
||||
|
||||
FnIdGenerator::FnIdGenerator(wxWindow* parent)
|
||||
: wxDialog(parent, wxID_ANY, "FunctionID Generator")
|
||||
, m_list(nullptr)
|
||||
{
|
||||
wxBoxSizer* s_panel = new wxBoxSizer(wxHORIZONTAL);
|
||||
wxBoxSizer* s_subpanel = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer* s_subpanel2 = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
m_list = new wxListView(this, wxID_ANY, wxDefaultPosition, wxSize(300, 450));
|
||||
m_list->InsertColumn(0, "Function Name", 0, 200);
|
||||
m_list->InsertColumn(1, "Function ID", 0, 100);
|
||||
|
||||
wxButton *b_input_name = new wxButton(this, wxID_ANY, "Input Function Name", wxDefaultPosition, wxSize(140, -1));
|
||||
b_input_name->Bind(wxEVT_BUTTON, &FnIdGenerator::OnInput, this);
|
||||
|
||||
wxButton *b_clear = new wxButton(this, wxID_ANY, "Clear List", wxDefaultPosition, wxSize(140, -1));
|
||||
b_clear->Bind(wxEVT_BUTTON, &FnIdGenerator::OnClear, this);
|
||||
|
||||
s_subpanel2->Add(b_input_name);
|
||||
s_subpanel2->AddSpacer(10);
|
||||
s_subpanel2->Add(b_clear);
|
||||
|
||||
s_subpanel->AddSpacer(5);
|
||||
s_subpanel->Add(m_list);
|
||||
s_subpanel->AddSpacer(5);
|
||||
s_subpanel->Add(s_subpanel2);
|
||||
|
||||
s_panel->AddSpacer(5);
|
||||
s_panel->Add(s_subpanel);
|
||||
s_panel->AddSpacer(5);
|
||||
|
||||
SetSizerAndFit(s_panel);
|
||||
}
|
||||
|
||||
FnIdGenerator::~FnIdGenerator()
|
||||
{
|
||||
delete m_list;
|
||||
m_list = nullptr;
|
||||
}
|
||||
|
||||
void FnIdGenerator::OnInput(wxCommandEvent &event)
|
||||
{
|
||||
PrintId();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void FnIdGenerator::OnClear(wxCommandEvent &event)
|
||||
{
|
||||
m_list->DeleteAllItems();
|
||||
m_func_name.clear();
|
||||
m_func_id.clear();
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
u32 FnIdGenerator::GenerateFnId(const std::string& func_name)
|
||||
{
|
||||
static const char* suffix = "\x67\x59\x65\x99\x04\x25\x04\x90\x56\x64\x27\x49\x94\x89\x74\x1A"; //symbol name suffix
|
||||
std::string input = func_name + suffix;
|
||||
unsigned char output[20];
|
||||
|
||||
sha1((unsigned char*)input.c_str(), input.length(), output); //compute SHA-1 hash
|
||||
|
||||
return (be_t<u32>&) output[0];
|
||||
}
|
||||
|
||||
void FnIdGenerator::PrintId()
|
||||
{
|
||||
TextInputDialog dial(0, "", "Please input function name");
|
||||
if (dial.ShowModal() == wxID_OK)
|
||||
{
|
||||
const std::string& func_name = dial.GetResult();
|
||||
|
||||
if (func_name.length() == 0)
|
||||
return;
|
||||
|
||||
const be_t<u32> result = GenerateFnId(func_name);
|
||||
m_func_name.push_back(func_name);
|
||||
m_func_id.push_back(result);
|
||||
|
||||
LOG_NOTICE(HLE, "Function: %s, Id: 0x%08x ", func_name.c_str(), result);
|
||||
UpdateInformation();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void FnIdGenerator::UpdateInformation()
|
||||
{
|
||||
m_list->DeleteAllItems();
|
||||
|
||||
for(u32 i = 0; i < m_func_name.size(); i++)
|
||||
{
|
||||
m_list->InsertItem(m_func_name.size(), wxEmptyString);
|
||||
m_list->SetItem(i, 0, m_func_name[i]);
|
||||
m_list->SetItem(i, 1, wxString::Format("0x%08x", re(m_func_id[i])));
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "TextInputDialog.h"
|
||||
#include "../Crypto/aes.h"
|
||||
#include "../Crypto/sha1.h"
|
||||
|
||||
class FnIdGenerator : public wxDialog
|
||||
{
|
||||
private:
|
||||
std::vector<std::string> m_func_name;
|
||||
std::vector<u32> m_func_id;
|
||||
wxListView* m_list;
|
||||
|
||||
public:
|
||||
FnIdGenerator(wxWindow* parent);
|
||||
~FnIdGenerator();
|
||||
|
||||
void OnInput(wxCommandEvent &event);
|
||||
void OnClear(wxCommandEvent &event);
|
||||
u32 GenerateFnId(const std::string& func_name);
|
||||
void UpdateInformation();
|
||||
void PrintId();
|
||||
};
|
|
@ -3,8 +3,8 @@
|
|||
#include "Emu/Memory/Memory.h"
|
||||
#include "Emu/System.h"
|
||||
#include "rpcs3.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/SC_Event_flag.h"
|
||||
#include "Emu/SysCalls/lv2/sys_lwmutex.h"
|
||||
#include "Emu/SysCalls/lv2/sys_event.h"
|
||||
#include "InterpreterDisAsm.h"
|
||||
#include "Emu/Cell/PPUDecoder.h"
|
||||
#include "Emu/Cell/PPUDisAsm.h"
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "MemoryViewer.h"
|
||||
#include "RSXDebugger.h"
|
||||
#include "PADManager.h"
|
||||
#include "FnIdGenerator.h"
|
||||
|
||||
#include "git-version.h"
|
||||
#include "Ini.h"
|
||||
|
@ -96,9 +95,8 @@ MainFrame::MainFrame()
|
|||
wxMenu* menu_tools = new wxMenu();
|
||||
menubar->Append(menu_tools, "Tools");
|
||||
menu_tools->Append(id_tools_compiler, "ELF Compiler");
|
||||
menu_tools->Append(id_tools_memory_viewer, "Memory Viewer");
|
||||
menu_tools->Append(id_tools_rsx_debugger, "RSX Debugger");
|
||||
menu_tools->Append(id_tools_fnid_generator, "FunctionID Generator");
|
||||
menu_tools->Append(id_tools_memory_viewer, "Memory Viewer")->Enable(false);
|
||||
menu_tools->Append(id_tools_rsx_debugger, "RSX Debugger")->Enable(false);
|
||||
|
||||
wxMenu* menu_help = new wxMenu();
|
||||
menubar->Append(menu_help, "Help");
|
||||
|
@ -134,7 +132,6 @@ MainFrame::MainFrame()
|
|||
Bind(wxEVT_MENU, &MainFrame::OpenELFCompiler, this, id_tools_compiler);
|
||||
Bind(wxEVT_MENU, &MainFrame::OpenMemoryViewer, this, id_tools_memory_viewer);
|
||||
Bind(wxEVT_MENU, &MainFrame::OpenRSXDebugger, this, id_tools_rsx_debugger);
|
||||
Bind(wxEVT_MENU, &MainFrame::OpenFnIdGenerator, this, id_tools_fnid_generator);
|
||||
|
||||
Bind(wxEVT_MENU, &MainFrame::AboutDialogHandler, this, id_help_about);
|
||||
|
||||
|
@ -656,11 +653,6 @@ void MainFrame::OpenRSXDebugger(wxCommandEvent& WXUNUSED(event))
|
|||
(new RSXDebugger(this)) -> Show();
|
||||
}
|
||||
|
||||
void MainFrame::OpenFnIdGenerator(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
FnIdGenerator(this).ShowModal();
|
||||
}
|
||||
|
||||
|
||||
void MainFrame::AboutDialogHandler(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
|
@ -729,21 +721,31 @@ void MainFrame::UpdateUI(wxCommandEvent& event)
|
|||
is_ready = Emu.IsReady();
|
||||
}
|
||||
|
||||
// Update menu items based on the state of the emulator
|
||||
wxMenuBar& menubar( *GetMenuBar() );
|
||||
|
||||
// Emulation
|
||||
wxMenuItem& pause = *menubar.FindItem( id_sys_pause );
|
||||
wxMenuItem& stop = *menubar.FindItem( id_sys_stop );
|
||||
wxMenuItem& send_exit = *menubar.FindItem( id_sys_send_exit );
|
||||
wxMenuItem& send_open_menu = *menubar.FindItem( id_sys_send_open_menu );
|
||||
pause.SetItemLabel(is_running ? "Pause\tCtrl + P" : is_ready ? "Start\tCtrl + C" : "Resume\tCtrl + C");
|
||||
pause.SetItemLabel(is_running ? "Pause\tCtrl + P" : is_ready ? "Start\tCtrl + E" : "Resume\tCtrl + E");
|
||||
pause.Enable(!is_stopped);
|
||||
stop.Enable(!is_stopped);
|
||||
//send_exit.Enable(false);
|
||||
bool enable_commands = !is_stopped && Emu.GetCallbackManager().m_exit_callback.m_callbacks.size();
|
||||
|
||||
// PS3 Commands
|
||||
wxMenuItem& send_exit = *menubar.FindItem( id_sys_send_exit );
|
||||
wxMenuItem& send_open_menu = *menubar.FindItem( id_sys_send_open_menu );
|
||||
bool enable_commands = !is_stopped && Emu.GetCallbackManager().m_exit_callback.m_callbacks.size();
|
||||
send_open_menu.SetItemLabel(wxString::Format("Send %s system menu cmd", (m_sys_menu_opened ? "close" : "open")));
|
||||
send_open_menu.Enable(enable_commands);
|
||||
send_exit.Enable(enable_commands);
|
||||
|
||||
// Tools
|
||||
wxMenuItem& memory_viewer = *menubar.FindItem( id_tools_memory_viewer );
|
||||
wxMenuItem& rsx_debugger = *menubar.FindItem( id_tools_rsx_debugger);
|
||||
memory_viewer.Enable(!is_stopped);
|
||||
rsx_debugger.Enable(!is_stopped);
|
||||
|
||||
|
||||
//m_aui_mgr.Update();
|
||||
|
||||
//wxCommandEvent refit( wxEVT_COMMAND_MENU_SELECTED, id_update_dbg );
|
||||
|
|
|
@ -1,362 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#define LOAD_SYMBOL(x) if(m_dll.HasSymbol(#x)) x = (_##x)m_dll.GetSymbol(#x)
|
||||
struct Ps3EmuPlugin
|
||||
{
|
||||
enum PS3EMULIB_TYPE
|
||||
{
|
||||
LIB_PAD = (1 << 0),
|
||||
LIB_KB = (1 << 1),
|
||||
LIB_MOUSE = (1 << 2),
|
||||
LIB_FS = (1 << 3),
|
||||
};
|
||||
|
||||
typedef u32 (*_Ps3EmuLibGetType)();
|
||||
typedef u32 (*_Ps3EmuLibGetVersion)();
|
||||
typedef const char* (*_Ps3EmuLibGetName)();
|
||||
typedef const char* (*_Ps3EmuLibGetFullName)();
|
||||
typedef void (*_Ps3EmuLibSetSettingsPath)(const char* path);
|
||||
typedef void (*_Ps3EmuLibSetLogPath)(const char* path);
|
||||
typedef const char* (*_Ps3EmuLibGetSettingsName)();
|
||||
typedef const char* (*_Ps3EmuLibGetLogName)();
|
||||
typedef void (*_Ps3EmuLibConfigure)(PS3EMULIB_TYPE type);
|
||||
typedef void (*_Ps3EmuLibAbout)();
|
||||
typedef u32 (*_Ps3EmuLibTest)(PS3EMULIB_TYPE type);
|
||||
|
||||
_Ps3EmuLibGetType Ps3EmuLibGetType;
|
||||
_Ps3EmuLibGetVersion Ps3EmuLibGetVersion;
|
||||
_Ps3EmuLibGetName Ps3EmuLibGetName;
|
||||
_Ps3EmuLibGetFullName Ps3EmuLibGetFullName;
|
||||
_Ps3EmuLibSetSettingsPath Ps3EmuLibSetSettingsPath;
|
||||
_Ps3EmuLibSetLogPath Ps3EmuLibSetLogPath;
|
||||
_Ps3EmuLibGetSettingsName Ps3EmuLibGetSettingsName;
|
||||
_Ps3EmuLibGetLogName Ps3EmuLibGetLogName;
|
||||
_Ps3EmuLibConfigure Ps3EmuLibConfigure;
|
||||
_Ps3EmuLibAbout Ps3EmuLibAbout;
|
||||
_Ps3EmuLibTest Ps3EmuLibTest;
|
||||
|
||||
wxDynamicLibrary m_dll;
|
||||
|
||||
Ps3EmuPlugin()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
Ps3EmuPlugin(const wxString& path)
|
||||
{
|
||||
Load(path);
|
||||
}
|
||||
|
||||
virtual ~Ps3EmuPlugin() throw()
|
||||
{
|
||||
Unload();
|
||||
}
|
||||
|
||||
wxString FormatVersion()
|
||||
{
|
||||
if(!Ps3EmuLibGetVersion) return wxEmptyString;
|
||||
|
||||
const u32 v = Ps3EmuLibGetVersion();
|
||||
|
||||
const u8 v0 = v >> 24;
|
||||
const u8 v1 = v >> 16;
|
||||
const u8 v2 = v >> 8;
|
||||
const u8 v3 = v;
|
||||
|
||||
if(!v2 && !v3) return wxString::Format("%d.%d", v0, v1);
|
||||
if(!v3) return wxString::Format("%d.%d.%d", v0, v1, v2);
|
||||
|
||||
return wxString::Format("%d.%d.%d.%d", v0, v1, v2, v3);
|
||||
}
|
||||
|
||||
void Load(const wxString& path)
|
||||
{
|
||||
if(m_dll.Load(path))
|
||||
{
|
||||
Init();
|
||||
}
|
||||
else
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
|
||||
void Unload()
|
||||
{
|
||||
Reset();
|
||||
|
||||
if(m_dll.IsLoaded()) m_dll.Unload();
|
||||
}
|
||||
|
||||
virtual bool Test()
|
||||
{
|
||||
return
|
||||
m_dll.IsLoaded() &&
|
||||
Ps3EmuLibGetType &&
|
||||
Ps3EmuLibGetVersion &&
|
||||
Ps3EmuLibGetName &&
|
||||
Ps3EmuLibGetFullName &&
|
||||
Ps3EmuLibSetSettingsPath &&
|
||||
Ps3EmuLibSetLogPath &&
|
||||
Ps3EmuLibGetSettingsName &&
|
||||
Ps3EmuLibGetLogName &&
|
||||
Ps3EmuLibConfigure &&
|
||||
Ps3EmuLibAbout &&
|
||||
Ps3EmuLibTest;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void Init()
|
||||
{
|
||||
LOAD_SYMBOL(Ps3EmuLibGetType);
|
||||
LOAD_SYMBOL(Ps3EmuLibGetVersion);
|
||||
LOAD_SYMBOL(Ps3EmuLibGetName);
|
||||
LOAD_SYMBOL(Ps3EmuLibGetFullName);
|
||||
LOAD_SYMBOL(Ps3EmuLibSetSettingsPath);
|
||||
LOAD_SYMBOL(Ps3EmuLibSetLogPath);
|
||||
LOAD_SYMBOL(Ps3EmuLibGetSettingsName);
|
||||
LOAD_SYMBOL(Ps3EmuLibGetLogName);
|
||||
LOAD_SYMBOL(Ps3EmuLibConfigure);
|
||||
LOAD_SYMBOL(Ps3EmuLibAbout);
|
||||
LOAD_SYMBOL(Ps3EmuLibTest);
|
||||
}
|
||||
|
||||
virtual void Reset()
|
||||
{
|
||||
Ps3EmuLibGetType = nullptr;
|
||||
Ps3EmuLibGetVersion = nullptr;
|
||||
Ps3EmuLibGetName = nullptr;
|
||||
Ps3EmuLibGetFullName = nullptr;
|
||||
Ps3EmuLibSetSettingsPath = nullptr;
|
||||
Ps3EmuLibSetLogPath = nullptr;
|
||||
Ps3EmuLibGetSettingsName = nullptr;
|
||||
Ps3EmuLibGetLogName = nullptr;
|
||||
Ps3EmuLibConfigure = nullptr;
|
||||
Ps3EmuLibAbout = nullptr;
|
||||
Ps3EmuLibTest = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
struct Ps3EmuPluginPAD : public Ps3EmuPlugin
|
||||
{
|
||||
typedef int (*_PadInit)(u32 max_connect);
|
||||
typedef int (*_PadEnd)();
|
||||
typedef int (*_PadClearBuf)(u32 port_no);
|
||||
typedef int (*_PadGetData)(u32 port_no, void* data);
|
||||
typedef int (*_PadGetDataExtra)(u32 port_no, u32* device_type, void* data);
|
||||
typedef int (*_PadSetActDirect)(u32 port_no, void* param);
|
||||
typedef int (*_PadGetInfo)(void* info);
|
||||
typedef int (*_PadGetInfo2)(void* info);
|
||||
typedef int (*_PadSetPortSetting)(u32 port_no, u32 port_setting);
|
||||
typedef int (*_PadLddRegisterController)();
|
||||
typedef int (*_PadLddUnregisterController)(int handle);
|
||||
typedef int (*_PadLddDataInsert)(int handle, void* data);
|
||||
typedef int (*_PadLddGetPortNo)(int handle);
|
||||
typedef int (*_PadPeriphGetInfo)(void* info);
|
||||
typedef int (*_PadPeriphGetData)(u32 port_no, void* data);
|
||||
typedef int (*_PadInfoPressMode)(u32 port_no);
|
||||
typedef int (*_PadSetPressMode)(u32 port_no, u8 mode);
|
||||
typedef int (*_PadInfoSensorMode)(u32 port_no);
|
||||
typedef int (*_PadSetSensorMode)(u32 port_no, u8 mode);
|
||||
typedef int (*_PadGetRawData)(u32 port_no, void* data);
|
||||
typedef int (*_PadDbgLddRegisterController)(u32 device_capability);
|
||||
typedef int (*_PadDbgLddSetDataInsertMode)(int handle, u8 mode);
|
||||
typedef int (*_PadDbgPeriphRegisterDevice)(u16 vid, u16 pid, u32 pclass_type, u32 pclass_profile, void* mapping);
|
||||
typedef int (*_PadDbgGetData)(u32 port_no, void* data);
|
||||
|
||||
_PadInit PadInit;
|
||||
_PadEnd PadEnd;
|
||||
_PadClearBuf PadClearBuf;
|
||||
_PadGetData PadGetData;
|
||||
_PadGetDataExtra PadGetDataExtra;
|
||||
_PadSetActDirect PadSetActDirect;
|
||||
_PadGetInfo PadGetInfo;
|
||||
_PadGetInfo2 PadGetInfo2;
|
||||
_PadSetPortSetting PadSetPortSetting;
|
||||
_PadLddRegisterController PadLddRegisterController;
|
||||
_PadLddUnregisterController PadLddUnregisterController;
|
||||
_PadLddDataInsert PadLddDataInsert;
|
||||
_PadLddGetPortNo PadLddGetPortNo;
|
||||
_PadPeriphGetInfo PadPeriphGetInfo;
|
||||
_PadPeriphGetData PadPeriphGetData;
|
||||
_PadInfoPressMode PadInfoPressMode;
|
||||
_PadSetPressMode PadSetPressMode;
|
||||
_PadInfoSensorMode PadInfoSensorMode;
|
||||
_PadSetSensorMode PadSetSensorMode;
|
||||
_PadGetRawData PadGetRawData;
|
||||
_PadDbgLddRegisterController PadDbgLddRegisterController;
|
||||
_PadDbgLddSetDataInsertMode PadDbgLddSetDataInsertMode;
|
||||
_PadDbgPeriphRegisterDevice PadDbgPeriphRegisterDevice;
|
||||
_PadDbgGetData PadDbgGetData;
|
||||
|
||||
Ps3EmuPluginPAD()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
Ps3EmuPluginPAD(const wxString& path)
|
||||
{
|
||||
Load(path);
|
||||
}
|
||||
|
||||
virtual bool Test()
|
||||
{
|
||||
return Ps3EmuPlugin::Test() &&
|
||||
PadInit &&
|
||||
PadEnd &&
|
||||
PadClearBuf &&
|
||||
PadGetData &&
|
||||
PadGetDataExtra &&
|
||||
PadSetActDirect &&
|
||||
PadGetInfo &&
|
||||
PadGetInfo2 &&
|
||||
PadSetPortSetting &&
|
||||
PadLddRegisterController &&
|
||||
PadLddUnregisterController &&
|
||||
PadLddDataInsert &&
|
||||
PadLddGetPortNo &&
|
||||
PadPeriphGetInfo &&
|
||||
PadPeriphGetData &&
|
||||
PadInfoPressMode &&
|
||||
PadSetPressMode &&
|
||||
PadInfoSensorMode &&
|
||||
PadSetSensorMode &&
|
||||
PadGetRawData &&
|
||||
PadDbgLddRegisterController &&
|
||||
PadDbgLddSetDataInsertMode &&
|
||||
PadDbgPeriphRegisterDevice &&
|
||||
PadDbgGetData;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void Init()
|
||||
{
|
||||
LOAD_SYMBOL(PadInit);
|
||||
LOAD_SYMBOL(PadEnd);
|
||||
LOAD_SYMBOL(PadClearBuf);
|
||||
LOAD_SYMBOL(PadGetData);
|
||||
LOAD_SYMBOL(PadGetDataExtra);
|
||||
LOAD_SYMBOL(PadSetActDirect);
|
||||
LOAD_SYMBOL(PadGetInfo);
|
||||
LOAD_SYMBOL(PadGetInfo2);
|
||||
LOAD_SYMBOL(PadSetPortSetting);
|
||||
LOAD_SYMBOL(PadLddRegisterController);
|
||||
LOAD_SYMBOL(PadLddUnregisterController);
|
||||
LOAD_SYMBOL(PadLddDataInsert);
|
||||
LOAD_SYMBOL(PadLddGetPortNo);
|
||||
LOAD_SYMBOL(PadPeriphGetInfo);
|
||||
LOAD_SYMBOL(PadPeriphGetData);
|
||||
LOAD_SYMBOL(PadInfoPressMode);
|
||||
LOAD_SYMBOL(PadSetPressMode);
|
||||
LOAD_SYMBOL(PadInfoSensorMode);
|
||||
LOAD_SYMBOL(PadSetSensorMode);
|
||||
LOAD_SYMBOL(PadGetRawData);
|
||||
LOAD_SYMBOL(PadDbgLddRegisterController);
|
||||
LOAD_SYMBOL(PadDbgLddSetDataInsertMode);
|
||||
LOAD_SYMBOL(PadDbgPeriphRegisterDevice);
|
||||
LOAD_SYMBOL(PadDbgGetData);
|
||||
|
||||
Ps3EmuPlugin::Init();
|
||||
}
|
||||
|
||||
virtual void Reset()
|
||||
{
|
||||
PadInit = nullptr;
|
||||
PadEnd = nullptr;
|
||||
PadClearBuf = nullptr;
|
||||
PadGetData = nullptr;
|
||||
PadGetDataExtra = nullptr;
|
||||
PadSetActDirect = nullptr;
|
||||
PadGetInfo = nullptr;
|
||||
PadGetInfo2 = nullptr;
|
||||
PadSetPortSetting = nullptr;
|
||||
PadLddRegisterController = nullptr;
|
||||
PadLddUnregisterController = nullptr;
|
||||
PadLddDataInsert = nullptr;
|
||||
PadLddGetPortNo = nullptr;
|
||||
PadPeriphGetInfo = nullptr;
|
||||
PadPeriphGetData = nullptr;
|
||||
PadInfoPressMode = nullptr;
|
||||
PadSetPressMode = nullptr;
|
||||
PadInfoSensorMode = nullptr;
|
||||
PadSetSensorMode = nullptr;
|
||||
PadGetRawData = nullptr;
|
||||
PadDbgLddRegisterController = nullptr;
|
||||
PadDbgLddSetDataInsertMode = nullptr;
|
||||
PadDbgPeriphRegisterDevice = nullptr;
|
||||
PadDbgGetData = nullptr;
|
||||
|
||||
Ps3EmuPlugin::Reset();
|
||||
}
|
||||
};
|
||||
|
||||
struct PluginsManager
|
||||
{
|
||||
struct PluginInfo
|
||||
{
|
||||
wxString path;
|
||||
wxString name;
|
||||
u32 type;
|
||||
};
|
||||
|
||||
std::vector<PluginInfo> m_plugins;
|
||||
std::vector<PluginInfo*> m_pad_plugins;
|
||||
|
||||
void Load(const wxString& path)
|
||||
{
|
||||
if(!wxDirExists(path)) return;
|
||||
|
||||
m_plugins.clear();
|
||||
wxDir dir(path);
|
||||
|
||||
wxArrayString res;
|
||||
wxDir::GetAllFiles(path, &res, "*.dll", wxDIR_FILES);
|
||||
|
||||
for(u32 i=0; i<res.GetCount(); ++i)
|
||||
{
|
||||
LOG_NOTICE(HLE, "loading " + res[i] + "...");
|
||||
Ps3EmuPlugin l(res[i]);
|
||||
if(!l.Test()) continue;
|
||||
|
||||
m_plugins.emplace_back();
|
||||
PluginInfo& info = m_plugins.back();
|
||||
info.path = res[i];
|
||||
info.name.Printf("%s v%s", l.Ps3EmuLibGetFullName(), l.FormatVersion());
|
||||
info.type = l.Ps3EmuLibGetType();
|
||||
}
|
||||
}
|
||||
|
||||
wxSizer* GetNewComboBox(wxWindow* parent, const wxString& name, wxComboBox*& cb)
|
||||
{
|
||||
wxBoxSizer* s_panel(new wxBoxSizer(wxHORIZONTAL));
|
||||
|
||||
s_panel->Add(new wxStaticText(parent, wxID_ANY, name), wxSizerFlags().Border(wxRIGHT, 5).Center().Left());
|
||||
s_panel->Add(cb = new wxComboBox(parent, wxID_ANY), wxSizerFlags().Center().Right());
|
||||
|
||||
return s_panel;
|
||||
}
|
||||
|
||||
void Dialog()
|
||||
{
|
||||
wxDialog dial(nullptr, wxID_ANY, "Select plugins...", wxDefaultPosition);
|
||||
|
||||
wxBoxSizer& s_panel(*new wxBoxSizer(wxVERTICAL));
|
||||
|
||||
wxComboBox* cbox_pad_plugins;
|
||||
s_panel.Add(GetNewComboBox(&dial, "Pad", cbox_pad_plugins), wxSizerFlags().Border(wxALL, 5).Expand());
|
||||
|
||||
for(u32 i=0; i<m_plugins.size(); ++i)
|
||||
{
|
||||
if(m_plugins[i].type & Ps3EmuPlugin::LIB_PAD)
|
||||
{
|
||||
m_pad_plugins.push_back(&m_plugins[i]);
|
||||
cbox_pad_plugins->Append(m_plugins[i].name + " (" + wxFileName(m_plugins[i].path).GetName() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
if(cbox_pad_plugins->GetCount()) cbox_pad_plugins->Select(0);
|
||||
|
||||
dial.SetSizerAndFit(&s_panel);
|
||||
dial.ShowModal();
|
||||
}
|
||||
};
|
|
@ -210,31 +210,27 @@ bool ELF64Loader::LoadEhdrData(u64 offset)
|
|||
|
||||
bool ELF64Loader::LoadPhdrData(u64 offset)
|
||||
{
|
||||
for(u32 i=0; i<phdr_arr.size(); ++i)
|
||||
for(auto& phdr: phdr_arr)
|
||||
{
|
||||
phdr_arr[i].Show();
|
||||
phdr.Show();
|
||||
|
||||
if(phdr_arr[i].p_vaddr < min_addr)
|
||||
if (phdr.p_vaddr < min_addr)
|
||||
{
|
||||
min_addr = phdr_arr[i].p_vaddr;
|
||||
min_addr = phdr.p_vaddr;
|
||||
}
|
||||
|
||||
if(phdr_arr[i].p_vaddr + phdr_arr[i].p_memsz > max_addr)
|
||||
if (phdr.p_vaddr + phdr.p_memsz > max_addr)
|
||||
{
|
||||
max_addr = phdr_arr[i].p_vaddr + phdr_arr[i].p_memsz;
|
||||
max_addr = phdr.p_vaddr + phdr.p_memsz;
|
||||
}
|
||||
|
||||
if(phdr_arr[i].p_vaddr != phdr_arr[i].p_paddr)
|
||||
if (phdr.p_vaddr != phdr.p_paddr)
|
||||
{
|
||||
LOG_WARNING
|
||||
(
|
||||
LOADER,
|
||||
"ElfProgram different load addrs: paddr=0x%8.8x, vaddr=0x%8.8x",
|
||||
phdr_arr[i].p_paddr, phdr_arr[i].p_vaddr
|
||||
);
|
||||
LOG_WARNING(LOADER, "ElfProgram different load addrs: paddr=0x%8.8x, vaddr=0x%8.8x",
|
||||
phdr.p_paddr, phdr.p_vaddr);
|
||||
}
|
||||
|
||||
if(!Memory.MainMem.IsInMyRange(offset + phdr_arr[i].p_vaddr, phdr_arr[i].p_memsz))
|
||||
if(!Memory.MainMem.IsInMyRange(offset + phdr.p_vaddr, phdr.p_memsz))
|
||||
{
|
||||
#ifdef LOADER_DEBUG
|
||||
LOG_WARNING(LOADER, "Skipping...");
|
||||
|
@ -243,57 +239,48 @@ bool ELF64Loader::LoadPhdrData(u64 offset)
|
|||
continue;
|
||||
}
|
||||
|
||||
switch(phdr_arr[i].p_type)
|
||||
switch(phdr.p_type)
|
||||
{
|
||||
case 0x00000001: //LOAD
|
||||
if(phdr_arr[i].p_memsz)
|
||||
if(phdr.p_memsz)
|
||||
{
|
||||
Memory.MainMem.AllocFixed(offset + phdr_arr[i].p_vaddr, phdr_arr[i].p_memsz);
|
||||
Memory.MainMem.AllocFixed(offset + phdr.p_vaddr, phdr.p_memsz);
|
||||
|
||||
if(phdr_arr[i].p_filesz)
|
||||
if(phdr.p_filesz)
|
||||
{
|
||||
elf64_f.Seek(phdr_arr[i].p_offset);
|
||||
elf64_f.Read(&Memory[offset + phdr_arr[i].p_vaddr], phdr_arr[i].p_filesz);
|
||||
Emu.GetSFuncManager().StaticAnalyse(&Memory[offset + phdr_arr[i].p_vaddr], phdr_arr[i].p_filesz, phdr_arr[i].p_vaddr);
|
||||
elf64_f.Seek(phdr.p_offset);
|
||||
elf64_f.Read(&Memory[offset + phdr.p_vaddr], phdr.p_filesz);
|
||||
Emu.GetSFuncManager().StaticAnalyse(&Memory[offset + phdr.p_vaddr], phdr.p_filesz, phdr.p_vaddr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x00000007: //TLS
|
||||
Emu.SetTLSData(offset + phdr_arr[i].p_vaddr, phdr_arr[i].p_filesz, phdr_arr[i].p_memsz);
|
||||
Emu.SetTLSData(offset + phdr.p_vaddr, phdr.p_filesz, phdr.p_memsz);
|
||||
break;
|
||||
|
||||
case 0x60000001: //LOOS+1
|
||||
{
|
||||
if(!phdr_arr[i].p_filesz) break;
|
||||
if(!phdr.p_filesz)
|
||||
break;
|
||||
|
||||
const sys_process_param& proc_param = *(sys_process_param*)&Memory[offset + phdr_arr[i].p_vaddr];
|
||||
const sys_process_param& proc_param = *(sys_process_param*)&Memory[offset + phdr.p_vaddr];
|
||||
|
||||
if(re(proc_param.size) < sizeof(sys_process_param))
|
||||
{
|
||||
LOG_WARNING(LOADER, "Bad proc param size! [0x%x : 0x%x]", re(proc_param.size), sizeof(sys_process_param));
|
||||
if (proc_param.size < sizeof(sys_process_param)) {
|
||||
LOG_WARNING(LOADER, "Bad proc param size! [0x%x : 0x%x]", proc_param.size, sizeof(sys_process_param));
|
||||
}
|
||||
|
||||
if(re(proc_param.magic) != 0x13bcc5f6)
|
||||
{
|
||||
LOG_ERROR(LOADER, "Bad magic! [0x%x]", Memory.Reverse32(proc_param.magic));
|
||||
if (proc_param.magic != 0x13bcc5f6) {
|
||||
LOG_ERROR(LOADER, "Bad magic! [0x%x]", proc_param.magic);
|
||||
}
|
||||
else
|
||||
{
|
||||
sys_process_param_info& info = Emu.GetInfo().GetProcParam();
|
||||
info.sdk_version = re(proc_param.info.sdk_version);
|
||||
info.primary_prio = re(proc_param.info.primary_prio);
|
||||
info.primary_stacksize = re(proc_param.info.primary_stacksize);
|
||||
info.malloc_pagesize = re(proc_param.info.malloc_pagesize);
|
||||
info.ppc_seg = re(proc_param.info.ppc_seg);
|
||||
//info.crash_dump_param_addr = re(proc_param.info.crash_dump_param_addr);
|
||||
else {
|
||||
#ifdef LOADER_DEBUG
|
||||
LOG_NOTICE(LOADER, "*** sdk version: 0x%x", info.sdk_version);
|
||||
LOG_NOTICE(LOADER, "*** primary prio: %d", info.primary_prio);
|
||||
LOG_NOTICE(LOADER, "*** primary stacksize: 0x%x", info.primary_stacksize);
|
||||
LOG_NOTICE(LOADER, "*** malloc pagesize: 0x%x", info.malloc_pagesize);
|
||||
LOG_NOTICE(LOADER, "*** ppc seg: 0x%x", info.ppc_seg);
|
||||
//LOG_NOTICE(LOADER, "*** crash dump param addr: 0x%x", info.crash_dump_param_addr);
|
||||
sys_process_param_info& info = Emu.GetInfo().GetProcParam();
|
||||
LOG_NOTICE(LOADER, "*** sdk version: 0x%x", info.sdk_version.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** primary prio: %d", info.primary_prio.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** primary stacksize: 0x%x", info.primary_stacksize.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** malloc pagesize: 0x%x", info.malloc_pagesize.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** ppc seg: 0x%x", info.ppc_seg.ToLE());
|
||||
//LOG_NOTICE(LOADER, "*** crash dump param addr: 0x%x", info.crash_dump_param_addr.ToLE());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -301,113 +288,89 @@ bool ELF64Loader::LoadPhdrData(u64 offset)
|
|||
|
||||
case 0x60000002: //LOOS+2
|
||||
{
|
||||
if(!phdr_arr[i].p_filesz) break;
|
||||
if(!phdr.p_filesz)
|
||||
break;
|
||||
|
||||
sys_proc_prx_param proc_prx_param = *(sys_proc_prx_param*)&Memory[offset + phdr_arr[i].p_vaddr];
|
||||
sys_proc_prx_param proc_prx_param = *(sys_proc_prx_param*)&Memory[offset + phdr.p_vaddr];
|
||||
|
||||
proc_prx_param.size = re(proc_prx_param.size);
|
||||
proc_prx_param.magic = re(proc_prx_param.magic);
|
||||
proc_prx_param.version = re(proc_prx_param.version);
|
||||
proc_prx_param.libentstart = re(proc_prx_param.libentstart);
|
||||
proc_prx_param.libentend = re(proc_prx_param.libentend);
|
||||
proc_prx_param.libstubstart = re(proc_prx_param.libstubstart);
|
||||
proc_prx_param.libstubend = re(proc_prx_param.libstubend);
|
||||
proc_prx_param.ver = re(proc_prx_param.ver);
|
||||
|
||||
#ifdef LOADER_DEBUG
|
||||
LOG_NOTICE(LOADER, "*** size: 0x%x", proc_prx_param.size);
|
||||
LOG_NOTICE(LOADER, "*** magic: 0x%x", proc_prx_param.magic);
|
||||
LOG_NOTICE(LOADER, "*** version: 0x%x", proc_prx_param.version);
|
||||
LOG_NOTICE(LOADER, "*** libentstart: 0x%x", proc_prx_param.libentstart);
|
||||
LOG_NOTICE(LOADER, "*** libentend: 0x%x", proc_prx_param.libentend);
|
||||
LOG_NOTICE(LOADER, "*** libstubstart: 0x%x", proc_prx_param.libstubstart);
|
||||
LOG_NOTICE(LOADER, "*** libstubend: 0x%x", proc_prx_param.libstubend);
|
||||
LOG_NOTICE(LOADER, "*** ver: 0x%x", proc_prx_param.ver);
|
||||
LOG_NOTICE(LOADER, "*** size: 0x%x", proc_prx_param.size.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** magic: 0x%x", proc_prx_param.magic.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** version: 0x%x", proc_prx_param.version.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** libentstart: 0x%x", proc_prx_param.libentstart.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** libentend: 0x%x", proc_prx_param.libentend.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** libstubstart: 0x%x", proc_prx_param.libstubstart.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** libstubend: 0x%x", proc_prx_param.libstubend.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** ver: 0x%x", proc_prx_param.ver.ToLE());
|
||||
#endif
|
||||
|
||||
if(proc_prx_param.magic != 0x1b434cec)
|
||||
{
|
||||
LOG_ERROR(LOADER, "Bad magic! (0x%x)", proc_prx_param.magic);
|
||||
if (proc_prx_param.magic != 0x1b434cec) {
|
||||
LOG_ERROR(LOADER, "Bad magic! (0x%x)", proc_prx_param.magic.ToLE());
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
||||
for(u32 s=proc_prx_param.libstubstart; s<proc_prx_param.libstubend; s+=sizeof(Elf64_StubHeader))
|
||||
{
|
||||
for(u32 s=proc_prx_param.libstubstart; s<proc_prx_param.libstubend; s+=sizeof(Elf64_StubHeader))
|
||||
{
|
||||
Elf64_StubHeader stub = *(Elf64_StubHeader*)Memory.GetMemFromAddr(offset + s);
|
||||
Elf64_StubHeader stub = *(Elf64_StubHeader*)Memory.GetMemFromAddr(offset + s);
|
||||
|
||||
stub.s_size = re(stub.s_size);
|
||||
stub.s_version = re(stub.s_version);
|
||||
stub.s_unk0 = re(stub.s_unk0);
|
||||
stub.s_unk1 = re(stub.s_unk1);
|
||||
stub.s_imports = re(stub.s_imports);
|
||||
stub.s_modulename = re(stub.s_modulename);
|
||||
stub.s_nid = re(stub.s_nid);
|
||||
stub.s_text = re(stub.s_text);
|
||||
|
||||
const std::string& module_name = Memory.ReadString(stub.s_modulename);
|
||||
Module* module = Emu.GetModuleManager().GetModuleByName(module_name);
|
||||
if(module)
|
||||
{
|
||||
//module->SetLoaded();
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_WARNING(LOADER, "Unknown module '%s'", module_name.c_str());
|
||||
}
|
||||
|
||||
#ifdef LOADER_DEBUG
|
||||
LOG_NOTICE(LOADER, "");
|
||||
LOG_NOTICE(LOADER, "*** size: 0x%x", stub.s_size);
|
||||
LOG_NOTICE(LOADER, "*** version: 0x%x", stub.s_version);
|
||||
LOG_NOTICE(LOADER, "*** unk0: 0x%x", stub.s_unk0);
|
||||
LOG_NOTICE(LOADER, "*** unk1: 0x%x", stub.s_unk1);
|
||||
LOG_NOTICE(LOADER, "*** imports: %d", stub.s_imports);
|
||||
LOG_NOTICE(LOADER, "*** module name: %s [0x%x]", module_name.c_str(), stub.s_modulename);
|
||||
LOG_NOTICE(LOADER, "*** nid: 0x%x", stub.s_nid);
|
||||
LOG_NOTICE(LOADER, "*** text: 0x%x", stub.s_text);
|
||||
#endif
|
||||
static const u32 section = 4 * 3;
|
||||
u64 tbl = Memory.MainMem.AllocAlign(stub.s_imports * 4 * 2);
|
||||
u64 dst = Memory.MainMem.AllocAlign(stub.s_imports * section);
|
||||
|
||||
for(u32 i=0; i<stub.s_imports; ++i)
|
||||
{
|
||||
const u32 nid = Memory.Read32(stub.s_nid + i*4);
|
||||
const u32 text = Memory.Read32(stub.s_text + i*4);
|
||||
|
||||
if(module)
|
||||
{
|
||||
if(!module->Load(nid))
|
||||
{
|
||||
LOG_WARNING(LOADER, "Unimplemented function '%s' in '%s' module", SysCalls::GetHLEFuncName(nid).c_str(), module_name.c_str());
|
||||
}
|
||||
}
|
||||
#ifdef LOADER_DEBUG
|
||||
LOG_NOTICE(LOADER, "import %d:", i+1);
|
||||
LOG_NOTICE(LOADER, "*** nid: 0x%x (0x%x)", nid, stub.s_nid + i*4);
|
||||
LOG_NOTICE(LOADER, "*** text: 0x%x (0x%x)", text, stub.s_text + i*4);
|
||||
#endif
|
||||
Memory.Write32(stub.s_text + i*4, tbl + i*8);
|
||||
|
||||
mem32_ptr_t out_tbl(tbl + i*8);
|
||||
out_tbl += dst + i*section;
|
||||
out_tbl += Emu.GetModuleManager().GetFuncNumById(nid);
|
||||
|
||||
mem32_ptr_t out_dst(dst + i*section);
|
||||
out_dst += OR(11, 2, 2, 0);
|
||||
out_dst += SC(2);
|
||||
out_dst += BCLR(0x10 | 0x04, 0, 0, 0);
|
||||
}
|
||||
const std::string& module_name = Memory.ReadString(stub.s_modulename);
|
||||
Module* module = Emu.GetModuleManager().GetModuleByName(module_name);
|
||||
if (module) {
|
||||
//module->SetLoaded();
|
||||
}
|
||||
else {
|
||||
LOG_WARNING(LOADER, "Unknown module '%s'", module_name.c_str());
|
||||
}
|
||||
|
||||
#ifdef LOADER_DEBUG
|
||||
LOG_NOTICE(LOADER, " ");
|
||||
LOG_NOTICE(LOADER, "");
|
||||
LOG_NOTICE(LOADER, "*** size: 0x%x", stub.s_size);
|
||||
LOG_NOTICE(LOADER, "*** version: 0x%x", stub.s_version.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** unk0: 0x%x", stub.s_unk0);
|
||||
LOG_NOTICE(LOADER, "*** unk1: 0x%x", stub.s_unk1.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** imports: %d", stub.s_imports.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** module name: %s [0x%x]", module_name.c_str(), stub.s_modulename.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** nid: 0x%016llx [0x%x]", Memory.Read64(stub.s_nid), stub.s_nid.ToLE());
|
||||
LOG_NOTICE(LOADER, "*** text: 0x%x", stub.s_text.ToLE());
|
||||
#endif
|
||||
static const u32 section = 4 * 3;
|
||||
u64 tbl = Memory.MainMem.AllocAlign(stub.s_imports * 4 * 2);
|
||||
u64 dst = Memory.MainMem.AllocAlign(stub.s_imports * section);
|
||||
|
||||
for(u32 i=0; i<stub.s_imports; ++i)
|
||||
{
|
||||
const u32 nid = Memory.Read32(stub.s_nid + i*4);
|
||||
const u32 text = Memory.Read32(stub.s_text + i*4);
|
||||
|
||||
if (module && !module->Load(nid)) {
|
||||
LOG_WARNING(LOADER, "Unimplemented function '%s' in '%s' module", SysCalls::GetHLEFuncName(nid).c_str(), module_name.c_str());
|
||||
}
|
||||
#ifdef LOADER_DEBUG
|
||||
LOG_NOTICE(LOADER, "import %d:", i+1);
|
||||
LOG_NOTICE(LOADER, "*** nid: 0x%x (0x%x)", nid, stub.s_nid + i*4);
|
||||
LOG_NOTICE(LOADER, "*** text: 0x%x (0x%x)", text, stub.s_text + i*4);
|
||||
#endif
|
||||
Memory.Write32(stub.s_text + i*4, tbl + i*8);
|
||||
|
||||
mem32_ptr_t out_tbl(tbl + i*8);
|
||||
out_tbl += dst + i*section;
|
||||
out_tbl += Emu.GetModuleManager().GetFuncNumById(nid);
|
||||
|
||||
mem32_ptr_t out_dst(dst + i*section);
|
||||
out_dst += OR(11, 2, 2, 0);
|
||||
out_dst += SC(2);
|
||||
out_dst += BCLR(0x10 | 0x04, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
#ifdef LOADER_DEBUG
|
||||
LOG_NOTICE(LOADER, "");
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifdef LOADER_DEBUG
|
||||
LOG_NOTICE(LOADER, " ");
|
||||
LOG_NOTICE(LOADER, "");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -461,7 +424,7 @@ bool ELF64Loader::LoadShdrData(u64 offset)
|
|||
switch(shdr.sh_type)
|
||||
{
|
||||
case SHT_NOBITS:
|
||||
//ConLog.Warning("SHT_NOBITS: addr=0x%llx, size=0x%llx", offset + addr, size);
|
||||
//LOG_WARNING(LOADER, "SHT_NOBITS: addr=0x%llx, size=0x%llx", offset + addr, size);
|
||||
//memset(&Memory[offset + addr], 0, size);
|
||||
break;
|
||||
|
||||
|
|
|
@ -125,53 +125,53 @@ const std::string Phdr_TypeToString(const u32 type);
|
|||
|
||||
struct sys_process_param_info
|
||||
{
|
||||
u32 sdk_version;
|
||||
s32 primary_prio;
|
||||
u32 primary_stacksize;
|
||||
u32 malloc_pagesize;
|
||||
u32 ppc_seg;
|
||||
//u32 crash_dump_param_addr;
|
||||
be_t<u32> sdk_version;
|
||||
be_t<s32> primary_prio;
|
||||
be_t<u32> primary_stacksize;
|
||||
be_t<u32> malloc_pagesize;
|
||||
be_t<u32> ppc_seg;
|
||||
//be_t<u32> crash_dump_param_addr;
|
||||
};
|
||||
|
||||
struct sys_process_param
|
||||
{
|
||||
u32 size;
|
||||
u32 magic;
|
||||
u32 version;
|
||||
be_t<u32> size;
|
||||
be_t<u32> magic;
|
||||
be_t<u32> version;
|
||||
sys_process_param_info info;
|
||||
};
|
||||
|
||||
struct sys_proc_prx_param
|
||||
{
|
||||
u32 size;
|
||||
u32 magic;
|
||||
u32 version;
|
||||
u32 pad0;
|
||||
u32 libentstart;
|
||||
u32 libentend;
|
||||
u32 libstubstart;
|
||||
u32 libstubend;
|
||||
u16 ver;
|
||||
u16 pad1;
|
||||
u32 pad2;
|
||||
be_t<u32> size;
|
||||
be_t<u32> magic;
|
||||
be_t<u32> version;
|
||||
be_t<u32> pad0;
|
||||
be_t<u32> libentstart;
|
||||
be_t<u32> libentend;
|
||||
be_t<u32> libstubstart;
|
||||
be_t<u32> libstubend;
|
||||
be_t<u16> ver;
|
||||
be_t<u16> pad1;
|
||||
be_t<u32> pad2;
|
||||
};
|
||||
|
||||
struct Elf64_StubHeader
|
||||
{
|
||||
u8 s_size; // = 0x2c
|
||||
u8 s_unk0;
|
||||
u16 s_version; // = 0x1
|
||||
u16 s_unk1; // = 0x9 // flags?
|
||||
u16 s_imports;
|
||||
u32 s_unk2; // = 0x0
|
||||
u32 s_unk3; // = 0x0
|
||||
u32 s_modulename;
|
||||
u32 s_nid;
|
||||
u32 s_text;
|
||||
u32 s_unk4; // = 0x0
|
||||
u32 s_unk5; // = 0x0
|
||||
u32 s_unk6; // = 0x0
|
||||
u32 s_unk7; // = 0x0
|
||||
be_t<u16> s_version; // = 0x1
|
||||
be_t<u16> s_unk1; // = 0x9 // flags?
|
||||
be_t<u16> s_imports;
|
||||
be_t<u32> s_unk2; // = 0x0
|
||||
be_t<u32> s_unk3; // = 0x0
|
||||
be_t<u32> s_modulename;
|
||||
be_t<u32> s_nid;
|
||||
be_t<u32> s_text;
|
||||
be_t<u32> s_unk4; // = 0x0
|
||||
be_t<u32> s_unk5; // = 0x0
|
||||
be_t<u32> s_unk6; // = 0x0
|
||||
be_t<u32> s_unk7; // = 0x0
|
||||
};
|
||||
|
||||
class LoaderBase
|
||||
|
|
|
@ -92,33 +92,28 @@
|
|||
<ClCompile Include="Emu\Memory\Memory.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Callback.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\FuncList.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Condition.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Event.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Event_flag.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_FileSystem.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_GCM.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Heap.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Interrupt.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Keyboard.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Lwcond.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Lwmutex.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Memory.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Mouse.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Mutex.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Pad.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_PPU_Thread.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Process.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_PRX.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_RSX.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Rwlock.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Semaphore.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Spinlock.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_SPU_Thread.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Time.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Timer.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Trace.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_TTY.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_VM.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\lv2Fs.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_cond.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_event.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_interrupt.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_lwcond.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_lwmutex.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_memory.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_mmapper.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_mutex.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_ppu_thread.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_process.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_prx.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_rsx.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_rwlock.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_semaphore.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_spinlock.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_spu.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_time.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_timer.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_trace.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_tty.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_vm.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\ModuleManager.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellAdec.cpp" />
|
||||
|
@ -184,6 +179,9 @@
|
|||
<ClCompile Include="Emu\SysCalls\Modules\libsynth2.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sceNp.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sceNpTrophy.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\SC_Keyboard.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\SC_Mouse.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\SC_Pad.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sysPrxForUser.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sys_fs.cpp" />
|
||||
<ClCompile Include="Emu\SysCalls\Modules\sys_http.cpp" />
|
||||
|
@ -318,22 +316,28 @@
|
|||
<ClInclude Include="Emu\Memory\MemoryBlock.h" />
|
||||
<ClInclude Include="Emu\SysCalls\Callback.h" />
|
||||
<ClInclude Include="Emu\SysCalls\ErrorCodes.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Condition.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Event_flag.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_FileSystem.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Interrupt.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Lwcond.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Lwmutex.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Memory.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Mutex.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Process.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_PRX.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Rwlock.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Semaphore.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Spinlock.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_SPU_Thread.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Time.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Timer.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\lv2Fs.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_cond.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_event.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_interrupt.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_lwcond.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_lwmutex.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_memory.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_mmapper.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_mutex.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_ppu_thread.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_process.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_prx.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_rsx.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_rwlock.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_semaphore.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_spinlock.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_spu.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_time.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_timer.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_trace.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_tty.h" />
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_vm.h" />
|
||||
<ClInclude Include="Emu\SysCalls\ModuleManager.h" />
|
||||
<ClInclude Include="Emu\SysCalls\Modules.h" />
|
||||
<ClInclude Include="Emu\SysCalls\Modules\cellAdec.h" />
|
||||
|
|
|
@ -128,81 +128,6 @@
|
|||
<ClCompile Include="Emu\SysCalls\SysCalls.cpp">
|
||||
<Filter>Emu\SysCalls</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Condition.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Event.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Event_flag.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_FileSystem.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_GCM.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Heap.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Keyboard.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Lwcond.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Lwmutex.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Memory.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Mouse.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Mutex.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Pad.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_PPU_Thread.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Process.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_RSX.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Rwlock.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Semaphore.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Spinlock.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_SPU_Thread.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Time.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Timer.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Trace.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_TTY.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_VM.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\Modules\cellAdec.cpp">
|
||||
<Filter>Emu\SysCalls\Modules</Filter>
|
||||
</ClCompile>
|
||||
|
@ -578,10 +503,79 @@
|
|||
<ClCompile Include="..\Utilities\SSemaphore.cpp">
|
||||
<Filter>Utilities</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_Interrupt.cpp">
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_process.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\SC_PRX.cpp">
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_prx.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_memory.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_timer.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_lwcond.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_rwlock.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_lwmutex.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_cond.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_mutex.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_semaphore.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_rsx.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_spinlock.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_ppu_thread.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_tty.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_vm.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_trace.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_event.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_spu.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_time.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_interrupt.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\sys_mmapper.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\Modules\SC_Mouse.cpp">
|
||||
<Filter>Emu\SysCalls\Modules</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\Modules\SC_Pad.cpp">
|
||||
<Filter>Emu\SysCalls\Modules</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\Modules\SC_Keyboard.cpp">
|
||||
<Filter>Emu\SysCalls\Modules</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Emu\SysCalls\lv2\lv2Fs.cpp">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Utilities\Log.cpp">
|
||||
|
@ -637,42 +631,6 @@
|
|||
<ClInclude Include="Emu\SysCalls\SysCalls.h">
|
||||
<Filter>Emu\SysCalls</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Condition.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Event_flag.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_FileSystem.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Lwcond.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Lwmutex.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Memory.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Mutex.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Rwlock.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Spinlock.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_SPU_Thread.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Time.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Timer.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\Modules\cellAdec.h">
|
||||
<Filter>Emu\SysCalls\Modules</Filter>
|
||||
</ClInclude>
|
||||
|
@ -1057,16 +1015,70 @@
|
|||
<ClInclude Include="..\Utilities\SSemaphore.h">
|
||||
<Filter>Utilities</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Semaphore.h">
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_process.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Interrupt.h">
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_prx.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_PRX.h">
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_memory.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Process.h">
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_timer.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_lwcond.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_rwlock.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_lwmutex.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_cond.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_mutex.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_semaphore.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_rsx.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_spinlock.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_ppu_thread.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_tty.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_vm.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_trace.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_event.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_spu.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_time.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_interrupt.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\sys_mmapper.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Emu\SysCalls\lv2\lv2Fs.h">
|
||||
<Filter>Emu\SysCalls\lv2</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Utilities\MTRingbuffer.h">
|
||||
|
|
|
@ -175,7 +175,6 @@
|
|||
<ClCompile Include="Gui\MemoryViewer.cpp" />
|
||||
<ClCompile Include="Gui\PADManager.cpp" />
|
||||
<ClCompile Include="Gui\RSXDebugger.cpp" />
|
||||
<ClCompile Include="Gui\FnIdGenerator.cpp" />
|
||||
<ClCompile Include="Gui\TextInputDialog.cpp" />
|
||||
<ClCompile Include="Gui\VFSManager.cpp" />
|
||||
<ClCompile Include="Gui\VHDDManager.cpp" />
|
||||
|
@ -224,7 +223,6 @@
|
|||
<ClInclude Include="Gui\TextInputDialog.h" />
|
||||
<ClInclude Include="Gui\VFSManager.h" />
|
||||
<ClInclude Include="Gui\VHDDManager.h" />
|
||||
<ClInclude Include="Gui\FnIdGenerator.h" />
|
||||
<ClInclude Include="Ini.h" />
|
||||
<ClInclude Include="rpcs3.h" />
|
||||
<ClInclude Include="stdafx.h" />
|
||||
|
|
|
@ -60,9 +60,6 @@
|
|||
<ClCompile Include="Gui\RSXDebugger.cpp">
|
||||
<Filter>Gui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Gui\FnIdGenerator.cpp">
|
||||
<Filter>Gui</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Gui\PADManager.cpp">
|
||||
<Filter>Gui</Filter>
|
||||
</ClCompile>
|
||||
|
@ -158,9 +155,6 @@
|
|||
<ClInclude Include="Gui\RSXDebugger.h">
|
||||
<Filter>Gui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Gui\FnIdGenerator.h">
|
||||
<Filter>Gui</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Gui\TextInputDialog.h">
|
||||
<Filter>Gui</Filter>
|
||||
</ClInclude>
|
||||
|
|
Loading…
Add table
Reference in a new issue