mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 11:36:13 +00:00
Few functions added
* sceNpManagerGetStatus * sys_mmapper_free_memory * Minor changes in sys_mmapper_allocate_memory * Changed the layout of the sys_vm functions in SysCalls.cpp
This commit is contained in:
parent
cd10dca71f
commit
7f7ad1b661
6 changed files with 80 additions and 10 deletions
|
@ -1,4 +1,3 @@
|
|||
#if 0
|
||||
#include "stdafx.h"
|
||||
#include "Emu/SysCalls/SysCalls.h"
|
||||
#include "Emu/SysCalls/SC_FUNC.h"
|
||||
|
@ -8,7 +7,20 @@
|
|||
void sceNp_init();
|
||||
Module sceNp(0x0016, sceNp_init);
|
||||
|
||||
int sceNpManagerGetStatus(mem32_t status)
|
||||
{
|
||||
sceNp.Log("sceNpManagerGetStatus(status_addr=0x%x)", status.GetAddr());
|
||||
|
||||
// TODO: Check if sceNpInit() was called, if not return SCE_NP_ERROR_NOT_INITIALIZED
|
||||
if (!status.IsGood())
|
||||
return SCE_NP_ERROR_INVALID_ARGUMENT;
|
||||
|
||||
// TODO: Support different statuses
|
||||
status = SCE_NP_MANAGER_STATUS_OFFLINE;
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
void sceNp_init()
|
||||
{
|
||||
sceNp.AddFunc(0xa7bff757, sceNpManagerGetStatus);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,8 +1,42 @@
|
|||
#pragma once
|
||||
|
||||
// Return Codes
|
||||
// Error Codes
|
||||
enum
|
||||
{
|
||||
// NP Manager Utility
|
||||
SCE_NP_ERROR_NOT_INITIALIZED = 0x8002aa01,
|
||||
SCE_NP_ERROR_ALREADY_INITIALIZED = 0x8002aa02,
|
||||
SCE_NP_ERROR_INVALID_ARGUMENT = 0x8002aa03,
|
||||
SCE_NP_ERROR_OUT_OF_MEMORY = 0x8002aa04,
|
||||
SCE_NP_ERROR_ID_NO_SPACE = 0x8002aa05,
|
||||
SCE_NP_ERROR_ID_NOT_FOUND = 0x8002aa06,
|
||||
SCE_NP_ERROR_SESSION_RUNNING = 0x8002aa07,
|
||||
SCE_NP_ERROR_LOGINID_ALREADY_EXISTS = 0x8002aa08,
|
||||
SCE_NP_ERROR_INVALID_TICKET_SIZE = 0x8002aa09,
|
||||
SCE_NP_ERROR_INVALID_STATE = 0x8002aa0a,
|
||||
SCE_NP_ERROR_ABORTED = 0x8002aa0b,
|
||||
SCE_NP_ERROR_OFFLINE = 0x8002aa0c,
|
||||
SCE_NP_ERROR_VARIANT_ACCOUNT_ID = 0x8002aa0d,
|
||||
SCE_NP_ERROR_GET_CLOCK = 0x8002aa0e,
|
||||
SCE_NP_ERROR_INSUFFICIENT_BUFFER = 0x8002aa0f,
|
||||
SCE_NP_ERROR_EXPIRED_TICKET = 0x8002aa10,
|
||||
SCE_NP_ERROR_TICKET_PARAM_NOT_FOUND = 0x8002aa11,
|
||||
SCE_NP_ERROR_UNSUPPORTED_TICKET_VERSION = 0x8002aa12,
|
||||
SCE_NP_ERROR_TICKET_STATUS_CODE_INVALID = 0x8002aa13,
|
||||
SCE_NP_ERROR_INVALID_TICKET_VERSION = 0x8002aa14,
|
||||
SCE_NP_ERROR_ALREADY_USED = 0x8002aa15,
|
||||
SCE_NP_ERROR_DIFFERENT_USER = 0x8002aa16,
|
||||
SCE_NP_ERROR_ALREADY_DONE = 0x8002aa17,
|
||||
};
|
||||
|
||||
// NP Manager Utility: Status
|
||||
enum
|
||||
{
|
||||
SCE_NP_MANAGER_STATUS_OFFLINE = -1,
|
||||
SCE_NP_MANAGER_STATUS_GETTING_TICKET = 0,
|
||||
SCE_NP_MANAGER_STATUS_GETTING_PROFILE = 1,
|
||||
SCE_NP_MANAGER_STATUS_LOGGING_IN = 2,
|
||||
SCE_NP_MANAGER_STATUS_ONLINE = 3,
|
||||
};
|
||||
|
||||
enum
|
||||
|
|
|
@ -168,6 +168,7 @@ void sysPrxForUser_init()
|
|||
|
||||
sysPrxForUser.AddFunc(0xb257540b, sys_mmapper_allocate_memory);
|
||||
sysPrxForUser.AddFunc(0xdc578057, sys_mmapper_map_memory);
|
||||
sysPrxForUser.AddFunc(0x409ad939, sys_mmapper_free_memory);
|
||||
|
||||
sysPrxForUser.AddFunc(0x1ed454ce, sys_spu_elf_get_information);
|
||||
sysPrxForUser.AddFunc(0xdb6b3250, sys_spu_elf_get_segments);
|
||||
|
|
|
@ -133,9 +133,20 @@ static func_caller* sc_table[1024] =
|
|||
null_func, null_func, null_func, null_func, null_func, //289
|
||||
null_func, null_func, null_func, null_func, null_func, //294
|
||||
null_func, null_func, null_func, null_func, null_func, //299
|
||||
bind_func(sys_vm_memory_map), bind_func(sys_vm_unmap), bind_func(sys_vm_append_memory), bind_func(sys_vm_return_memory), bind_func(sys_vm_lock), //304
|
||||
bind_func(sys_vm_unlock), bind_func(sys_vm_touch), bind_func(sys_vm_flush), bind_func(sys_vm_invalidate), bind_func(sys_vm_store), //309
|
||||
bind_func(sys_vm_sync), bind_func(sys_vm_test), bind_func(sys_vm_get_statistics), null_func, null_func, //314
|
||||
bind_func(sys_vm_memory_map), //300 (0x12C)
|
||||
bind_func(sys_vm_unmap), //301 (0x12D)
|
||||
bind_func(sys_vm_append_memory), //302 (0x12E)
|
||||
bind_func(sys_vm_return_memory), //303 (0x12F)
|
||||
bind_func(sys_vm_lock), //304 (0x130)
|
||||
bind_func(sys_vm_unlock), //305 (0x131)
|
||||
bind_func(sys_vm_touch), //306 (0x132)
|
||||
bind_func(sys_vm_flush), //307 (0x133)
|
||||
bind_func(sys_vm_invalidate), //308 (0x134)
|
||||
bind_func(sys_vm_store), //309 (0x135)
|
||||
bind_func(sys_vm_sync), //310 (0x136)
|
||||
bind_func(sys_vm_test), //311 (0x137)
|
||||
bind_func(sys_vm_get_statistics), //312 (0x138)
|
||||
null_func, null_func, //314
|
||||
null_func, null_func, null_func, null_func, null_func, //319
|
||||
null_func, null_func, null_func, null_func, bind_func(sys_memory_container_create), //324
|
||||
bind_func(sys_memory_container_destroy), null_func, null_func, null_func, null_func, //329
|
||||
|
|
|
@ -225,6 +225,7 @@ extern int sys_memory_get_page_attribute(u32 addr, mem_ptr_t<sys_page_attr_t> a)
|
|||
extern int sys_mmapper_allocate_address(u32 size, u64 flags, u32 alignment, u32 alloc_addr);
|
||||
extern int sys_mmapper_allocate_memory(u32 size, u64 flags, u32 mem_id_addr);
|
||||
extern int sys_mmapper_map_memory(u32 start_addr, u32 mem_id, u64 flags);
|
||||
extern int sys_mmapper_free_memory(u32 mem_id);
|
||||
|
||||
//vm
|
||||
extern int sys_vm_memory_map(u32 vsize, u32 psize, u32 cid, u64 flag, u64 policy, u32 addr);
|
||||
|
|
|
@ -109,11 +109,11 @@ int sys_mmapper_allocate_address(u32 size, u64 flags, u32 alignment, u32 alloc_a
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mmapper_allocate_memory(u32 size, u64 flags, u32 mem_id_addr)
|
||||
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_addr);
|
||||
sc_mem.Warning("sys_mmapper_allocate_memory(size=0x%x, flags=0x%llx, mem_id_addr=0x%x)", size, flags, mem_id.GetAddr());
|
||||
|
||||
if(!Memory.IsGoodAddr(mem_id_addr)) return CELL_EFAULT;
|
||||
if(!mem_id.IsGood()) return CELL_EFAULT;
|
||||
|
||||
u32 addr;
|
||||
switch(flags & (SYS_MEMORY_PAGE_SIZE_1M | SYS_MEMORY_PAGE_SIZE_64K))
|
||||
|
@ -135,7 +135,7 @@ int sys_mmapper_allocate_memory(u32 size, u64 flags, u32 mem_id_addr)
|
|||
if(!addr)
|
||||
return CELL_ENOMEM;
|
||||
|
||||
Memory.Write32(mem_id_addr, sc_mem.GetNewId(new mmapper_info(addr, size, flags)));
|
||||
mem_id = sc_mem.GetNewId(new mmapper_info(addr, size, flags));
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
@ -155,6 +155,17 @@ int sys_mmapper_map_memory(u32 start_addr, u32 mem_id, u64 flags)
|
|||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_mmapper_free_memory(u32 mem_id)
|
||||
{
|
||||
sc_mem.Warning("sys_mmapper_free_memory(mem_id=0x%x)", mem_id);
|
||||
|
||||
mmapper_info* info;
|
||||
if(!sc_mem.CheckId(mem_id, info)) return CELL_ESRCH;
|
||||
|
||||
Memory.Free(info->addr);
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
int sys_memory_get_user_memory_size(u32 mem_info_addr)
|
||||
{
|
||||
sc_mem.Warning("sys_memory_get_user_memory_size(mem_info_addr=0x%x)", mem_info_addr);
|
||||
|
|
Loading…
Add table
Reference in a new issue