mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-08-15 23:09:09 +00:00
Improvements in SC_Process and other lv2 syscalls
* Splitted the file in SC_Process.h and SC_Process.cpp. * Some argument data types modified on sys_process_* functions. * Implemented sys_process_get_number_of_object and sys_process_get_id. * Added dummy versions of other sys_process_* functions based on the old SysCalls::lv2Process* code (which I deleted). * Improved BE <-> LE comparisons on SC_Mutex, SC_Lwmutex and SC_Lwcond. * Updated some SC_Memory functions to use mem_ptr_t<T>. NOTE: There are probably better ways to get the active objects that don't imply creating a new data type filled with std::set<u32>'s. TODO: For some types, the corresponding std::set<u32> isn't being updated when an object is created/destroyed. I'll take care of this soon.
This commit is contained in:
parent
5e00dfb5c3
commit
2534216971
11 changed files with 223 additions and 279 deletions
|
@ -22,10 +22,10 @@ static func_caller* sc_table[kSyscallTableLength] =
|
||||||
{
|
{
|
||||||
null_func,
|
null_func,
|
||||||
bind_func(sys_process_getpid), //1 (0x001)
|
bind_func(sys_process_getpid), //1 (0x001)
|
||||||
null_func,//bind_func(sys_process_wait_for_child), //2 (0x002) ROOT
|
bind_func(sys_process_wait_for_child), //2 (0x002) ROOT
|
||||||
bind_func(sys_process_exit), //3 (0x003)
|
bind_func(sys_process_exit), //3 (0x003)
|
||||||
null_func,//bind_func(sys_process_get_status), //4 (0x004) DBG
|
bind_func(sys_process_get_status), //4 (0x004) DBG
|
||||||
null_func,//bind_func(sys_process_detach_child), //5 (0x005) DBG
|
bind_func(sys_process_detach_child), //5 (0x005) DBG
|
||||||
|
|
||||||
// Unused: 6-11
|
// Unused: 6-11
|
||||||
null_func, null_func, null_func, null_func, null_func, null_func,
|
null_func, null_func, null_func, null_func, null_func, null_func,
|
||||||
|
@ -38,17 +38,17 @@ static func_caller* sc_table[kSyscallTableLength] =
|
||||||
null_func, null_func, null_func,
|
null_func, null_func, null_func,
|
||||||
|
|
||||||
bind_func(sys_process_getppid), //18 (0x012)
|
bind_func(sys_process_getppid), //18 (0x012)
|
||||||
null_func,//bind_func(sys_process_kill), //19 (0x013)
|
bind_func(sys_process_kill), //19 (0x013)
|
||||||
null_func, //
|
null_func, //
|
||||||
null_func,//bind_func(_sys_process_spawn), //21 (0x015) DBG
|
null_func,//bind_func(_sys_process_spawn), //21 (0x015) DBG
|
||||||
bind_func(sys_process_exit), //22 (0x016)
|
bind_func(sys_process_exit), //22 (0x016)
|
||||||
null_func,//bind_func(sys_process_wait_for_child2), //23 (0x017) DBG
|
bind_func(sys_process_wait_for_child2), //23 (0x017) DBG
|
||||||
null_func,//bind_func(), //24 (0x018) DBG
|
null_func,//bind_func(), //24 (0x018) DBG
|
||||||
null_func,//bind_func(sys_process_get_sdk_version), //25 (0x019)
|
bind_func(sys_process_get_sdk_version), //25 (0x019)
|
||||||
null_func,//bind_func(_sys_process_exit), //26 (0x01A)
|
null_func,//bind_func(_sys_process_exit), //26 (0x01A)
|
||||||
null_func,//bind_func(), //27 (0x01B) DBG
|
null_func,//bind_func(), //27 (0x01B) DBG
|
||||||
null_func,//bind_func(_sys_process_get_number_of_object)//28 (0x01C) ROOT
|
null_func,//bind_func(_sys_process_get_number_of_object)//28 (0x01C) ROOT
|
||||||
null_func,//bind_func(sys_process_get_id), //29 (0x01D) ROOT
|
bind_func(sys_process_get_id), //29 (0x01D) ROOT
|
||||||
bind_func(sys_process_get_paramsfo), //30 (0x01E)
|
bind_func(sys_process_get_paramsfo), //30 (0x01E)
|
||||||
null_func,//bind_func(sys_process_get_ppu_guid), //31 (0x01F)
|
null_func,//bind_func(sys_process_get_ppu_guid), //31 (0x01F)
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "ErrorCodes.h"
|
#include "ErrorCodes.h"
|
||||||
|
#include "lv2/SC_Process.h"
|
||||||
#include "lv2/SC_FileSystem.h"
|
#include "lv2/SC_FileSystem.h"
|
||||||
#include "lv2/SC_Memory.h"
|
#include "lv2/SC_Memory.h"
|
||||||
#include "lv2/SC_Timer.h"
|
#include "lv2/SC_Timer.h"
|
||||||
|
@ -119,18 +120,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//process
|
|
||||||
extern int sys_process_getpid();
|
|
||||||
extern int sys_process_getppid();
|
|
||||||
extern int sys_process_get_number_of_object(u32 object, mem32_t nump);
|
|
||||||
extern int sys_process_get_id(u32 object, mem8_ptr_t buffer, u32 size, mem32_t set_size);
|
|
||||||
extern int sys_process_get_paramsfo(mem8_ptr_t buffer);
|
|
||||||
extern int sys_process_exit(int errorcode);
|
|
||||||
extern void sys_game_process_exitspawn(u32 path_addr, u32 argv_addr, u32 envp_addr,
|
|
||||||
u32 data_addr, u32 data_size, u32 prio, u64 flags );
|
|
||||||
extern void sys_game_process_exitspawn2(u32 path_addr, u32 argv_addr, u32 envp_addr,
|
|
||||||
u32 data_addr, u32 data_size, u32 prio, u64 flags);
|
|
||||||
|
|
||||||
//sys_event
|
//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_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_destroy(u32 equeue_id, int mode);
|
||||||
|
@ -227,10 +216,10 @@ 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_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_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_page_attribute(u32 addr, mem_ptr_t<sys_page_attr_t> attr);
|
||||||
extern int sys_memory_get_user_memory_size(u32 mem_info_addr);
|
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_create(mem32_t cid, u32 yield_size);
|
||||||
extern int sys_memory_container_destroy(u32 cid);
|
extern int sys_memory_container_destroy(u32 cid);
|
||||||
extern int sys_memory_container_get_size(u32 mem_info_addr, 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_address(u32 size, u64 flags, u32 alignment, u32 alloc_addr);
|
||||||
extern int sys_mmapper_allocate_fixed_address();
|
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(u32 size, u64 flags, mem32_t mem_id);
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "Emu/System.h"
|
#include "Emu/System.h"
|
||||||
#include "Emu/Cell/PPUThread.h"
|
#include "Emu/Cell/PPUThread.h"
|
||||||
#include "Emu/SysCalls/SysCalls.h"
|
#include "Emu/SysCalls/SysCalls.h"
|
||||||
|
#include "SC_Process.h"
|
||||||
#include "SC_Lwmutex.h"
|
#include "SC_Lwmutex.h"
|
||||||
#include "SC_Lwcond.h"
|
#include "SC_Lwcond.h"
|
||||||
|
|
||||||
|
@ -19,16 +20,18 @@ int sys_lwcond_create(mem_ptr_t<sys_lwcond_t> lwcond, mem_ptr_t<sys_lwmutex_t> l
|
||||||
return CELL_EFAULT;
|
return CELL_EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 id = sys_lwcond.GetNewId(new Lwcond(attr->name_u64));
|
||||||
lwcond->lwmutex = lwmutex.GetAddr();
|
lwcond->lwmutex = lwmutex.GetAddr();
|
||||||
lwcond->lwcond_queue = sys_lwcond.GetNewId(new Lwcond(attr->name_u64));
|
lwcond->lwcond_queue = id;
|
||||||
|
procObjects.lwcond_objects.insert(id);
|
||||||
|
|
||||||
if (lwmutex.IsGood())
|
if (lwmutex.IsGood())
|
||||||
{
|
{
|
||||||
if (lwmutex->attribute.ToBE() & se32(SYS_SYNC_RETRY))
|
if (lwmutex->attribute & SYS_SYNC_RETRY)
|
||||||
{
|
{
|
||||||
sys_lwcond.Warning("Unsupported SYS_SYNC_RETRY lwmutex protocol");
|
sys_lwcond.Warning("Unsupported SYS_SYNC_RETRY lwmutex protocol");
|
||||||
}
|
}
|
||||||
if (lwmutex->attribute.ToBE() & se32(SYS_SYNC_RECURSIVE))
|
if (lwmutex->attribute & SYS_SYNC_RECURSIVE)
|
||||||
{
|
{
|
||||||
sys_lwcond.Warning("Recursive lwmutex(sq=%d)", (u32)lwmutex->sleep_queue);
|
sys_lwcond.Warning("Recursive lwmutex(sq=%d)", (u32)lwmutex->sleep_queue);
|
||||||
}
|
}
|
||||||
|
@ -87,7 +90,7 @@ int sys_lwcond_signal(mem_ptr_t<sys_lwcond_t> lwcond)
|
||||||
|
|
||||||
mem_ptr_t<sys_lwmutex_t> mutex(lwcond->lwmutex);
|
mem_ptr_t<sys_lwmutex_t> mutex(lwcond->lwmutex);
|
||||||
|
|
||||||
if (u32 target = (mutex->attribute.ToBE() == se32(SYS_SYNC_PRIORITY) ? lw->m_queue.pop_prio() : lw->m_queue.pop()))
|
if (u32 target = (mutex->attribute == SYS_SYNC_PRIORITY ? lw->m_queue.pop_prio() : lw->m_queue.pop()))
|
||||||
{
|
{
|
||||||
lw->signal.lock(target);
|
lw->signal.lock(target);
|
||||||
|
|
||||||
|
@ -118,7 +121,7 @@ int sys_lwcond_signal_all(mem_ptr_t<sys_lwcond_t> lwcond)
|
||||||
|
|
||||||
mem_ptr_t<sys_lwmutex_t> mutex(lwcond->lwmutex);
|
mem_ptr_t<sys_lwmutex_t> mutex(lwcond->lwmutex);
|
||||||
|
|
||||||
while (u32 target = (mutex->attribute.ToBE() == se32(SYS_SYNC_PRIORITY) ? lw->m_queue.pop_prio() : lw->m_queue.pop()))
|
while (u32 target = (mutex->attribute == SYS_SYNC_PRIORITY ? lw->m_queue.pop_prio() : lw->m_queue.pop()))
|
||||||
{
|
{
|
||||||
lw->signal.lock(target);
|
lw->signal.lock(target);
|
||||||
|
|
||||||
|
@ -201,7 +204,7 @@ int sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout)
|
||||||
|
|
||||||
lw->m_queue.push(tid_le);
|
lw->m_queue.push(tid_le);
|
||||||
|
|
||||||
if (mutex->recursive_count.ToBE() != se32(1))
|
if (mutex->recursive_count != 1)
|
||||||
{
|
{
|
||||||
sys_lwcond.Warning("sys_lwcond_wait(id=%d): associated mutex had wrong recursive value (%d)",
|
sys_lwcond.Warning("sys_lwcond_wait(id=%d): associated mutex had wrong recursive value (%d)",
|
||||||
(u32)lwcond->lwcond_queue, (u32)mutex->recursive_count);
|
(u32)lwcond->lwcond_queue, (u32)mutex->recursive_count);
|
||||||
|
@ -210,9 +213,9 @@ int sys_lwcond_wait(mem_ptr_t<sys_lwcond_t> lwcond, u64 timeout)
|
||||||
|
|
||||||
if (sq)
|
if (sq)
|
||||||
{
|
{
|
||||||
mutex->mutex.unlock(tid, mutex->attribute.ToBE() == se32(SYS_SYNC_PRIORITY) ? sq->pop_prio() : sq->pop());
|
mutex->mutex.unlock(tid, mutex->attribute == SYS_SYNC_PRIORITY ? sq->pop_prio() : sq->pop());
|
||||||
}
|
}
|
||||||
else if (mutex->attribute.ToBE() == se32(SYS_SYNC_RETRY))
|
else if (mutex->attribute == SYS_SYNC_RETRY)
|
||||||
{
|
{
|
||||||
mutex->mutex.unlock(tid); // SYS_SYNC_RETRY
|
mutex->mutex.unlock(tid); // SYS_SYNC_RETRY
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,19 +15,19 @@ int sys_lwmutex_create(mem_ptr_t<sys_lwmutex_t> lwmutex, mem_ptr_t<sys_lwmutex_a
|
||||||
|
|
||||||
if (!lwmutex.IsGood() || !attr.IsGood()) return CELL_EFAULT;
|
if (!lwmutex.IsGood() || !attr.IsGood()) return CELL_EFAULT;
|
||||||
|
|
||||||
switch (attr->attr_recursive.ToBE())
|
switch (attr->attr_recursive)
|
||||||
{
|
{
|
||||||
case se32(SYS_SYNC_RECURSIVE): break;
|
case SYS_SYNC_RECURSIVE: break;
|
||||||
case se32(SYS_SYNC_NOT_RECURSIVE): break;
|
case SYS_SYNC_NOT_RECURSIVE: break;
|
||||||
default: sc_lwmutex.Error("Unknown recursive attribute(0x%x)", (u32)attr->attr_recursive); return CELL_EINVAL;
|
default: sc_lwmutex.Error("Unknown recursive attribute(0x%x)", (u32)attr->attr_recursive); return CELL_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (attr->attr_protocol.ToBE())
|
switch (attr->attr_protocol)
|
||||||
{
|
{
|
||||||
case se32(SYS_SYNC_PRIORITY): break;
|
case SYS_SYNC_PRIORITY: break;
|
||||||
case se32(SYS_SYNC_RETRY): break;
|
case SYS_SYNC_RETRY: break;
|
||||||
case se32(SYS_SYNC_PRIORITY_INHERIT): sc_lwmutex.Error("Invalid SYS_SYNC_PRIORITY_INHERIT protocol attr"); return CELL_EINVAL;
|
case SYS_SYNC_PRIORITY_INHERIT: sc_lwmutex.Error("Invalid SYS_SYNC_PRIORITY_INHERIT protocol attr"); return CELL_EINVAL;
|
||||||
case se32(SYS_SYNC_FIFO): break;
|
case SYS_SYNC_FIFO: break;
|
||||||
default: sc_lwmutex.Error("Unknown protocol attribute(0x%x)", (u32)attr->attr_protocol); return CELL_EINVAL;
|
default: sc_lwmutex.Error("Unknown protocol attribute(0x%x)", (u32)attr->attr_protocol); return CELL_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ 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));
|
u32 sq_id = sc_lwmutex.GetNewId(new SleepQueue(attr->name_u64));
|
||||||
lwmutex->sleep_queue = sq_id;
|
lwmutex->sleep_queue = sq_id;
|
||||||
|
procObjects.lwmutex_objects.insert(sq_id);
|
||||||
|
|
||||||
sc_lwmutex.Warning("*** lwmutex created [%s] (attribute=0x%x): sq_id = %d",
|
sc_lwmutex.Warning("*** lwmutex created [%s] (attribute=0x%x): sq_id = %d",
|
||||||
std::string(attr->name, 8).c_str(), (u32) lwmutex->attribute, sq_id);
|
std::string(attr->name, 8).c_str(), (u32) lwmutex->attribute, sq_id);
|
||||||
|
@ -283,14 +284,14 @@ int sys_lwmutex_t::unlock(be_t<u32> tid)
|
||||||
if (!recursive_count.ToBE())
|
if (!recursive_count.ToBE())
|
||||||
{
|
{
|
||||||
be_t<u32> target = 0;
|
be_t<u32> target = 0;
|
||||||
switch (attribute.ToBE() & se32(SYS_SYNC_ATTR_PROTOCOL_MASK))
|
switch (attribute & SYS_SYNC_ATTR_PROTOCOL_MASK)
|
||||||
{
|
{
|
||||||
case se32(SYS_SYNC_FIFO):
|
case SYS_SYNC_FIFO:
|
||||||
case se32(SYS_SYNC_PRIORITY):
|
case SYS_SYNC_PRIORITY:
|
||||||
SleepQueue* sq;
|
SleepQueue* sq;
|
||||||
if (!Emu.GetIdManager().GetIDData(sleep_queue, sq)) return CELL_ESRCH;
|
if (!Emu.GetIdManager().GetIDData(sleep_queue, sq)) return CELL_ESRCH;
|
||||||
target = attribute.ToBE() & se32(SYS_SYNC_FIFO) ? sq->pop() : sq->pop_prio();
|
target = attribute & SYS_SYNC_FIFO ? sq->pop() : sq->pop_prio();
|
||||||
case se32(SYS_SYNC_RETRY): break;
|
case SYS_SYNC_RETRY: break;
|
||||||
}
|
}
|
||||||
if (target) mutex.unlock(tid, target);
|
if (target) mutex.unlock(tid, target);
|
||||||
else mutex.unlock(tid);
|
else mutex.unlock(tid);
|
||||||
|
@ -310,10 +311,10 @@ int sys_lwmutex_t::lock(be_t<u32> tid, u64 timeout)
|
||||||
SleepQueue* sq;
|
SleepQueue* sq;
|
||||||
if (!Emu.GetIdManager().GetIDData(sleep_queue, sq)) return CELL_ESRCH;
|
if (!Emu.GetIdManager().GetIDData(sleep_queue, sq)) return CELL_ESRCH;
|
||||||
|
|
||||||
switch (attribute.ToBE() & se32(SYS_SYNC_ATTR_PROTOCOL_MASK))
|
switch (attribute & SYS_SYNC_ATTR_PROTOCOL_MASK)
|
||||||
{
|
{
|
||||||
case se32(SYS_SYNC_PRIORITY):
|
case SYS_SYNC_PRIORITY:
|
||||||
case se32(SYS_SYNC_FIFO):
|
case SYS_SYNC_FIFO:
|
||||||
sq->push(tid);
|
sq->push(tid);
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,17 +104,13 @@ int sys_memory_get_page_attribute(u32 addr, mem_ptr_t<sys_page_attr_t> attr)
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sys_memory_get_user_memory_size(u32 mem_info_addr)
|
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_addr);
|
sc_mem.Warning("sys_memory_get_user_memory_size(mem_info_addr=0x%x)", mem_info.GetAddr());
|
||||||
|
|
||||||
// Fetch the user memory available.
|
// Fetch the user memory available.
|
||||||
sys_memory_info info;
|
mem_info->total_user_memory = Memory.GetUserMemTotalSize();
|
||||||
info.total_user_memory = re(Memory.GetUserMemTotalSize());
|
mem_info->available_user_memory = Memory.GetUserMemAvailSize();
|
||||||
info.available_user_memory = re(Memory.GetUserMemAvailSize());
|
|
||||||
|
|
||||||
Memory.WriteData(mem_info_addr, info);
|
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,6 +130,7 @@ int sys_memory_container_create(mem32_t cid, u32 yield_size)
|
||||||
// Wrap the allocated memory in a memory container.
|
// Wrap the allocated memory in a memory container.
|
||||||
MemoryContainerInfo *ct = new MemoryContainerInfo(addr, yield_size);
|
MemoryContainerInfo *ct = new MemoryContainerInfo(addr, yield_size);
|
||||||
cid = sc_mem.GetNewId(ct);
|
cid = sc_mem.GetNewId(ct);
|
||||||
|
procObjects.mem_objects.insert(cid);
|
||||||
|
|
||||||
sc_mem.Warning("*** memory_container created(addr=0x%llx): id = %d", addr, cid.GetValue());
|
sc_mem.Warning("*** memory_container created(addr=0x%llx): id = %d", addr, cid.GetValue());
|
||||||
|
|
||||||
|
@ -156,9 +153,9 @@ int sys_memory_container_destroy(u32 cid)
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sys_memory_container_get_size(u32 mem_info_addr, u32 cid)
|
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_addr, 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.
|
// Check if this container ID is valid.
|
||||||
MemoryContainerInfo* ct;
|
MemoryContainerInfo* ct;
|
||||||
|
@ -166,12 +163,9 @@ int sys_memory_container_get_size(u32 mem_info_addr, u32 cid)
|
||||||
return CELL_ESRCH;
|
return CELL_ESRCH;
|
||||||
|
|
||||||
// HACK: Return all memory.
|
// HACK: Return all memory.
|
||||||
sys_memory_info info;
|
sys_memory_info_t info;
|
||||||
info.total_user_memory = re(ct->size);
|
mem_info->total_user_memory = ct->size;
|
||||||
info.available_user_memory = re(ct->size);
|
mem_info->available_user_memory = ct->size;
|
||||||
|
|
||||||
Memory.WriteData(mem_info_addr, info);
|
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,10 @@ enum
|
||||||
SYS_MEMORY_PAGE_SIZE_64K = 0x200,
|
SYS_MEMORY_PAGE_SIZE_64K = 0x200,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sys_memory_info
|
struct sys_memory_info_t
|
||||||
{
|
{
|
||||||
u32 total_user_memory;
|
be_t<u32> total_user_memory;
|
||||||
u32 available_user_memory;
|
be_t<u32> available_user_memory;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,20 +18,20 @@ int sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr)
|
||||||
return CELL_EFAULT;
|
return CELL_EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (attr->protocol.ToBE())
|
switch (attr->protocol)
|
||||||
{
|
{
|
||||||
case se32(SYS_SYNC_FIFO): break;
|
case SYS_SYNC_FIFO: break;
|
||||||
case se32(SYS_SYNC_PRIORITY): break;
|
case SYS_SYNC_PRIORITY: break;
|
||||||
case se32(SYS_SYNC_PRIORITY_INHERIT): sys_mtx.Warning("TODO: SYS_SYNC_PRIORITY_INHERIT protocol"); break;
|
case SYS_SYNC_PRIORITY_INHERIT: sys_mtx.Warning("TODO: SYS_SYNC_PRIORITY_INHERIT protocol"); break;
|
||||||
case se32(SYS_SYNC_RETRY): sys_mtx.Error("Invalid SYS_SYNC_RETRY protocol"); return CELL_EINVAL;
|
case SYS_SYNC_RETRY: sys_mtx.Error("Invalid SYS_SYNC_RETRY protocol"); return CELL_EINVAL;
|
||||||
default: sys_mtx.Error("Unknown protocol attribute(0x%x)", (u32)attr->protocol); return CELL_EINVAL;
|
default: sys_mtx.Error("Unknown protocol attribute(0x%x)", (u32)attr->protocol); return CELL_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_recursive;
|
bool is_recursive;
|
||||||
switch (attr->recursive.ToBE())
|
switch (attr->recursive)
|
||||||
{
|
{
|
||||||
case se32(SYS_SYNC_RECURSIVE): is_recursive = true; break;
|
case SYS_SYNC_RECURSIVE: is_recursive = true; break;
|
||||||
case se32(SYS_SYNC_NOT_RECURSIVE): is_recursive = false; break;
|
case SYS_SYNC_NOT_RECURSIVE: is_recursive = false; break;
|
||||||
default: sys_mtx.Error("Unknown recursive attribute(0x%x)", (u32)attr->recursive); return CELL_EINVAL;
|
default: sys_mtx.Error("Unknown recursive attribute(0x%x)", (u32)attr->recursive); return CELL_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ int sys_mutex_create(mem32_t mutex_id, mem_ptr_t<sys_mutex_attribute> attr)
|
||||||
u32 tid = GetCurrentPPUThread().GetId();
|
u32 tid = GetCurrentPPUThread().GetId();
|
||||||
Mutex* mutex = new Mutex((u32)attr->protocol, is_recursive, attr->name_u64);
|
Mutex* mutex = new Mutex((u32)attr->protocol, is_recursive, attr->name_u64);
|
||||||
u32 id = sys_mtx.GetNewId(mutex);
|
u32 id = sys_mtx.GetNewId(mutex);
|
||||||
|
procObjects.mutex_objects.insert(id);
|
||||||
mutex->m_mutex.lock(tid);
|
mutex->m_mutex.lock(tid);
|
||||||
mutex->id = id;
|
mutex->id = id;
|
||||||
mutex_id = id;
|
mutex_id = id;
|
||||||
|
|
|
@ -3,31 +3,11 @@
|
||||||
#include "Emu/Memory/Memory.h"
|
#include "Emu/Memory/Memory.h"
|
||||||
#include "Emu/System.h"
|
#include "Emu/System.h"
|
||||||
#include "Emu/SysCalls/SysCalls.h"
|
#include "Emu/SysCalls/SysCalls.h"
|
||||||
|
#include "SC_Process.h"
|
||||||
|
|
||||||
SysCallBase sc_p("Process");
|
SysCallBase sc_p("Process");
|
||||||
|
|
||||||
//Process Local Object
|
sysProcessObjects_t procObjects;
|
||||||
enum
|
|
||||||
{
|
|
||||||
SYS_MEM_OBJECT = (0x08UL),
|
|
||||||
SYS_MUTEX_OBJECT = (0x85UL),
|
|
||||||
SYS_COND_OBJECT = (0x86UL),
|
|
||||||
SYS_RWLOCK_OBJECT = (0x88UL),
|
|
||||||
SYS_INTR_TAG_OBJECT = (0x0AUL),
|
|
||||||
SYS_INTR_SERVICE_HANDLE_OBJECT = (0x0BUL),
|
|
||||||
SYS_EVENT_QUEUE_OBJECT = (0x8DUL),
|
|
||||||
SYS_EVENT_PORT_OBJECT = (0x0EUL),
|
|
||||||
SYS_TRACE_OBJECT = (0x21UL),
|
|
||||||
SYS_SPUIMAGE_OBJECT = (0x22UL),
|
|
||||||
SYS_PRX_OBJECT = (0x23UL),
|
|
||||||
SYS_SPUPORT_OBJECT = (0x24UL),
|
|
||||||
SYS_LWMUTEX_OBJECT = (0x95UL),
|
|
||||||
SYS_TIMER_OBJECT = (0x11UL),
|
|
||||||
SYS_SEMAPHORE_OBJECT = (0x96UL),
|
|
||||||
SYS_FS_FD_OBJECT = (0x73UL),
|
|
||||||
SYS_LWCOND_OBJECT = (0x97UL),
|
|
||||||
SYS_EVENT_FLAG_OBJECT = (0x98UL),
|
|
||||||
};
|
|
||||||
|
|
||||||
int sys_process_getpid()
|
int sys_process_getpid()
|
||||||
{
|
{
|
||||||
|
@ -40,7 +20,7 @@ int sys_process_getppid()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sys_process_exit(int errorcode)
|
int sys_process_exit(s32 errorcode)
|
||||||
{
|
{
|
||||||
sc_p.Warning("sys_process_exit(%d)", errorcode);
|
sc_p.Warning("sys_process_exit(%d)", errorcode);
|
||||||
Emu.Pause(); // Emu.Stop() does crash
|
Emu.Pause(); // Emu.Stop() does crash
|
||||||
|
@ -150,169 +130,82 @@ void sys_game_process_exitspawn2(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int sys_process_get_number_of_object(u32 object, mem32_t nump)
|
int sys_process_get_number_of_object(u32 object, mem32_t nump)
|
||||||
{
|
{
|
||||||
sc_p.Warning("TODO: sys_process_get_number_of_object(object=%d, nump_addr=0x%x)",
|
sc_p.Warning("sys_process_get_number_of_object(object=%d, nump_addr=0x%x)",
|
||||||
object, nump.GetAddr());
|
object, nump.GetAddr());
|
||||||
|
|
||||||
|
if (!nump.IsGood())
|
||||||
|
return CELL_EFAULT;
|
||||||
|
|
||||||
switch(object)
|
switch(object)
|
||||||
{
|
{
|
||||||
case SYS_MEM_OBJECT:
|
case SYS_MEM_OBJECT: nump = procObjects.mem_objects.size(); break;
|
||||||
nump = 0;
|
case SYS_MUTEX_OBJECT: nump = procObjects.mutex_objects.size(); break;
|
||||||
return CELL_OK;
|
case SYS_COND_OBJECT: nump = procObjects.cond_objects.size(); break;
|
||||||
|
case SYS_RWLOCK_OBJECT: nump = procObjects.rwlock_objects.size(); break;
|
||||||
case SYS_MUTEX_OBJECT:
|
case SYS_INTR_TAG_OBJECT: nump = procObjects.intr_tag_objects.size(); break;
|
||||||
nump = 0;
|
case SYS_INTR_SERVICE_HANDLE_OBJECT: nump = procObjects.intr_service_handle_objects.size(); break;
|
||||||
return CELL_OK;
|
case SYS_EVENT_QUEUE_OBJECT: nump = procObjects.event_queue_objects.size(); break;
|
||||||
|
case SYS_EVENT_PORT_OBJECT: nump = procObjects.event_port_objects.size(); break;
|
||||||
case SYS_COND_OBJECT:
|
case SYS_TRACE_OBJECT: nump = procObjects.trace_objects.size(); break;
|
||||||
nump = 0;
|
case SYS_SPUIMAGE_OBJECT: nump = procObjects.spuimage_objects.size(); break;
|
||||||
return CELL_OK;
|
case SYS_PRX_OBJECT: nump = procObjects.prx_objects.size(); break;
|
||||||
|
case SYS_SPUPORT_OBJECT: nump = procObjects.spuport_objects.size(); break;
|
||||||
case SYS_RWLOCK_OBJECT:
|
case SYS_LWMUTEX_OBJECT: nump = procObjects.lwmutex_objects.size(); break;
|
||||||
nump = 0;
|
case SYS_TIMER_OBJECT: nump = procObjects.timer_objects.size(); break;
|
||||||
return CELL_OK;
|
case SYS_SEMAPHORE_OBJECT: nump = procObjects.semaphore_objects.size(); break;
|
||||||
|
case SYS_FS_FD_OBJECT: nump = procObjects.fs_fd_objects.size(); break;
|
||||||
case SYS_INTR_TAG_OBJECT:
|
case SYS_LWCOND_OBJECT: nump = procObjects.lwcond_objects.size(); break;
|
||||||
nump = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_INTR_SERVICE_HANDLE_OBJECT:
|
|
||||||
nump = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_EVENT_QUEUE_OBJECT:
|
|
||||||
nump = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_EVENT_PORT_OBJECT:
|
|
||||||
nump = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_TRACE_OBJECT:
|
|
||||||
nump = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_SPUIMAGE_OBJECT:
|
|
||||||
nump = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_PRX_OBJECT:
|
|
||||||
nump = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_SPUPORT_OBJECT:
|
|
||||||
nump = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_LWMUTEX_OBJECT:
|
|
||||||
nump = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_TIMER_OBJECT:
|
|
||||||
nump = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_SEMAPHORE_OBJECT:
|
|
||||||
nump = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_FS_FD_OBJECT:
|
|
||||||
nump = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_LWCOND_OBJECT:
|
|
||||||
nump = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return CELL_EINVAL;
|
return CELL_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sys_process_get_id(u32 object, mem8_ptr_t buffer, u32 size, mem32_t set_size)
|
int 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)",
|
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());
|
object, buffer.GetAddr(), size, set_size.GetAddr());
|
||||||
|
|
||||||
switch(object)
|
switch(object)
|
||||||
{
|
{
|
||||||
case SYS_MEM_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_MUTEX_OBJECT:
|
#define ADD_OBJECTS(objects) { \
|
||||||
set_size = 0;
|
u32 i=0; \
|
||||||
return CELL_OK;
|
for(auto& id=objects.begin(); i<size && id!=objects.end(); id++, i++) \
|
||||||
|
buffer[i] = *id; \
|
||||||
|
set_size = i; \
|
||||||
|
}
|
||||||
|
|
||||||
case SYS_COND_OBJECT:
|
case SYS_MEM_OBJECT: ADD_OBJECTS(procObjects.mem_objects); break;
|
||||||
set_size = 0;
|
case SYS_MUTEX_OBJECT: ADD_OBJECTS(procObjects.mutex_objects); break;
|
||||||
return CELL_OK;
|
case SYS_COND_OBJECT: ADD_OBJECTS(procObjects.cond_objects); break;
|
||||||
|
case SYS_RWLOCK_OBJECT: ADD_OBJECTS(procObjects.rwlock_objects); break;
|
||||||
|
case SYS_INTR_TAG_OBJECT: ADD_OBJECTS(procObjects.intr_tag_objects); break;
|
||||||
|
case SYS_INTR_SERVICE_HANDLE_OBJECT: ADD_OBJECTS(procObjects.intr_service_handle_objects); break;
|
||||||
|
case SYS_EVENT_QUEUE_OBJECT: ADD_OBJECTS(procObjects.event_queue_objects); break;
|
||||||
|
case SYS_EVENT_PORT_OBJECT: ADD_OBJECTS(procObjects.event_port_objects); break;
|
||||||
|
case SYS_TRACE_OBJECT: ADD_OBJECTS(procObjects.trace_objects); break;
|
||||||
|
case SYS_SPUIMAGE_OBJECT: ADD_OBJECTS(procObjects.spuimage_objects); break;
|
||||||
|
case SYS_PRX_OBJECT: ADD_OBJECTS(procObjects.prx_objects); break;
|
||||||
|
case SYS_SPUPORT_OBJECT: ADD_OBJECTS(procObjects.spuport_objects); break;
|
||||||
|
case SYS_LWMUTEX_OBJECT: ADD_OBJECTS(procObjects.lwmutex_objects); break;
|
||||||
|
case SYS_TIMER_OBJECT: ADD_OBJECTS(procObjects.timer_objects); break;
|
||||||
|
case SYS_SEMAPHORE_OBJECT: ADD_OBJECTS(procObjects.semaphore_objects); break;
|
||||||
|
case SYS_FS_FD_OBJECT: ADD_OBJECTS(procObjects.fs_fd_objects); break;
|
||||||
|
case SYS_LWCOND_OBJECT: ADD_OBJECTS(procObjects.lwcond_objects); break;
|
||||||
|
case SYS_EVENT_FLAG_OBJECT: ADD_OBJECTS(procObjects.event_flag_objects); break;
|
||||||
|
|
||||||
case SYS_RWLOCK_OBJECT:
|
#undef ADD_OBJECTS
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_INTR_TAG_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_INTR_SERVICE_HANDLE_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_EVENT_QUEUE_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_EVENT_PORT_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_TRACE_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_SPUIMAGE_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_PRX_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_SPUPORT_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_LWMUTEX_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_TIMER_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_SEMAPHORE_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_FS_FD_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_LWCOND_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
case SYS_EVENT_FLAG_OBJECT:
|
|
||||||
set_size = 0;
|
|
||||||
return CELL_OK;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return CELL_EINVAL;
|
return CELL_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sys_process_get_paramsfo(mem8_ptr_t buffer)
|
int sys_process_get_paramsfo(mem8_ptr_t buffer)
|
||||||
|
@ -334,57 +227,46 @@ int sys_process_get_paramsfo(mem8_ptr_t buffer)
|
||||||
return CELL_OK;*/
|
return CELL_OK;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
int sys_process_get_sdk_version(u32 pid, mem32_t version)
|
||||||
int SysCalls::lv2ProcessWaitForChild(PPUThread& CPU)
|
|
||||||
{
|
{
|
||||||
ConLog.Warning("lv2ProcessWaitForChild");
|
sc_p.Warning("sys_process_get_sdk_version(pid=%d, version_addr=0x%x)", pid, version.GetAddr());
|
||||||
|
|
||||||
|
if (!version.IsGood())
|
||||||
|
return CELL_EFAULT;
|
||||||
|
|
||||||
|
version = 0x360001; // TODO
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
int SysCalls::lv2ProcessGetStatus(PPUThread& CPU)
|
|
||||||
|
int sys_process_kill(u32 pid)
|
||||||
{
|
{
|
||||||
ConLog.Warning("lv2ProcessGetStatus");
|
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)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
sc_p.Error("TODO: sys_process_get_status(unk=0x%llx)", unk);
|
||||||
//Memory.Write32(CPU.GPR[4], GetPPUThreadStatus(CPU));
|
//Memory.Write32(CPU.GPR[4], GetPPUThreadStatus(CPU));
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
int SysCalls::lv2ProcessDetachChild(PPUThread& CPU)
|
|
||||||
|
int sys_process_detach_child(u64 unk)
|
||||||
{
|
{
|
||||||
ConLog.Warning("lv2ProcessDetachChild");
|
sc_p.Error("TODO: sys_process_detach_child(unk=0x%llx)", unk);
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
int SysCalls::lv2ProcessGetNumberOfObject(PPUThread& CPU)
|
|
||||||
{
|
|
||||||
ConLog.Warning("lv2ProcessGetNumberOfObject");
|
|
||||||
Memory.Write32(CPU.GPR[4], 1);
|
|
||||||
return CELL_OK;
|
|
||||||
}
|
|
||||||
int SysCalls::lv2ProcessGetId(PPUThread& CPU)
|
|
||||||
{
|
|
||||||
ConLog.Warning("lv2ProcessGetId");
|
|
||||||
Memory.Write32(CPU.GPR[4], CPU.GetId());
|
|
||||||
return CELL_OK;
|
|
||||||
}
|
|
||||||
int SysCalls::lv2ProcessGetPpid(PPUThread& CPU)
|
|
||||||
{
|
|
||||||
ConLog.Warning("lv2ProcessGetPpid");
|
|
||||||
Memory.Write32(CPU.GPR[4], CPU.GetId());
|
|
||||||
return CELL_OK;
|
|
||||||
}
|
|
||||||
int SysCalls::lv2ProcessKill(PPUThread& CPU)
|
|
||||||
{
|
|
||||||
ConLog.Warning("lv2ProcessKill[pid: 0x%llx]", CPU.GPR[3]);
|
|
||||||
CPU.Close();
|
|
||||||
return CELL_OK;
|
|
||||||
}
|
|
||||||
int SysCalls::lv2ProcessWaitForChild2(PPUThread& CPU)
|
|
||||||
{
|
|
||||||
ConLog.Warning("lv2ProcessWaitForChild2[r3: 0x%llx, r4: 0x%llx, r5: 0x%llx, r6: 0x%llx, r7: 0x%llx, r8: 0x%llx]",
|
|
||||||
CPU.GPR[3], CPU.GPR[4], CPU.GPR[5], CPU.GPR[6], CPU.GPR[7], CPU.GPR[8]);
|
|
||||||
return CELL_OK;
|
|
||||||
}
|
|
||||||
int SysCalls::lv2ProcessGetSdkVersion(PPUThread& CPU)
|
|
||||||
{
|
|
||||||
ConLog.Warning("lv2ProcessGetSdkVersion[r3: 0x%llx, r4: 0x%llx]", CPU.GPR[3], CPU.GPR[4]);
|
|
||||||
CPU.GPR[4] = 0x360001; //TODO
|
|
||||||
return CELL_OK;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
70
rpcs3/Emu/SysCalls/lv2/SC_Process.h
Normal file
70
rpcs3/Emu/SysCalls/lv2/SC_Process.h
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
//Process Local Object
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
SYS_MEM_OBJECT = (0x08UL),
|
||||||
|
SYS_MUTEX_OBJECT = (0x85UL),
|
||||||
|
SYS_COND_OBJECT = (0x86UL),
|
||||||
|
SYS_RWLOCK_OBJECT = (0x88UL),
|
||||||
|
SYS_INTR_TAG_OBJECT = (0x0AUL),
|
||||||
|
SYS_INTR_SERVICE_HANDLE_OBJECT = (0x0BUL),
|
||||||
|
SYS_EVENT_QUEUE_OBJECT = (0x8DUL),
|
||||||
|
SYS_EVENT_PORT_OBJECT = (0x0EUL),
|
||||||
|
SYS_TRACE_OBJECT = (0x21UL),
|
||||||
|
SYS_SPUIMAGE_OBJECT = (0x22UL),
|
||||||
|
SYS_PRX_OBJECT = (0x23UL),
|
||||||
|
SYS_SPUPORT_OBJECT = (0x24UL),
|
||||||
|
SYS_LWMUTEX_OBJECT = (0x95UL),
|
||||||
|
SYS_TIMER_OBJECT = (0x11UL),
|
||||||
|
SYS_SEMAPHORE_OBJECT = (0x96UL),
|
||||||
|
SYS_FS_FD_OBJECT = (0x73UL),
|
||||||
|
SYS_LWCOND_OBJECT = (0x97UL),
|
||||||
|
SYS_EVENT_FLAG_OBJECT = (0x98UL),
|
||||||
|
};
|
||||||
|
|
||||||
|
// Datatypes
|
||||||
|
// TODO: Would it be better if improved the existing IDManager, instead of creating this datatype?
|
||||||
|
// Another option would be improving SysCallBase::GetNewId
|
||||||
|
struct sysProcessObjects_t
|
||||||
|
{
|
||||||
|
std::set<u32> mem_objects;
|
||||||
|
std::set<u32> mutex_objects;
|
||||||
|
std::set<u32> cond_objects;
|
||||||
|
std::set<u32> rwlock_objects;
|
||||||
|
std::set<u32> intr_tag_objects;
|
||||||
|
std::set<u32> intr_service_handle_objects;
|
||||||
|
std::set<u32> event_queue_objects;
|
||||||
|
std::set<u32> event_port_objects;
|
||||||
|
std::set<u32> trace_objects;
|
||||||
|
std::set<u32> spuimage_objects;
|
||||||
|
std::set<u32> prx_objects;
|
||||||
|
std::set<u32> spuport_objects;
|
||||||
|
std::set<u32> lwmutex_objects;
|
||||||
|
std::set<u32> timer_objects;
|
||||||
|
std::set<u32> semaphore_objects;
|
||||||
|
std::set<u32> fs_fd_objects;
|
||||||
|
std::set<u32> lwcond_objects;
|
||||||
|
std::set<u32> event_flag_objects;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Extern
|
||||||
|
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);
|
||||||
|
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,
|
||||||
|
u32 data_addr, u32 data_size, u32 prio, u64 flags);
|
|
@ -593,6 +593,7 @@
|
||||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Lwmutex.h" />
|
<ClInclude Include="Emu\SysCalls\lv2\SC_Lwmutex.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Memory.h" />
|
<ClInclude Include="Emu\SysCalls\lv2\SC_Memory.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Mutex.h" />
|
<ClInclude Include="Emu\SysCalls\lv2\SC_Mutex.h" />
|
||||||
|
<ClInclude Include="Emu\SysCalls\lv2\SC_Process.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Rwlock.h" />
|
<ClInclude Include="Emu\SysCalls\lv2\SC_Rwlock.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\lv2\SC_Spinlock.h" />
|
<ClInclude Include="Emu\SysCalls\lv2\SC_Spinlock.h" />
|
||||||
<ClInclude Include="Emu\SysCalls\lv2\SC_SPU_Thread.h" />
|
<ClInclude Include="Emu\SysCalls\lv2\SC_SPU_Thread.h" />
|
||||||
|
|
|
@ -1113,5 +1113,8 @@
|
||||||
<ClInclude Include="Emu\SysCalls\Modules\libsynth2.h">
|
<ClInclude Include="Emu\SysCalls\Modules\libsynth2.h">
|
||||||
<Filter>Emu\SysCalls\Modules\currently_unused</Filter>
|
<Filter>Emu\SysCalls\Modules\currently_unused</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Emu\SysCalls\lv2\SC_Process.h">
|
||||||
|
<Filter>Emu\SysCalls\lv2</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
Loading…
Add table
Add a link
Reference in a new issue