mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 12:42:41 +01:00
sys_memory: add cpu_flag::wait
This commit is contained in:
parent
95aeebe4b5
commit
13c564f2af
@ -505,7 +505,7 @@ error_code cellGemEnableMagnetometer2()
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellGemEnd()
|
||||
error_code cellGemEnd(ppu_thread& ppu)
|
||||
{
|
||||
cellGem.warning("cellGemEnd()");
|
||||
|
||||
@ -517,7 +517,7 @@ error_code cellGemEnd()
|
||||
{
|
||||
if (u32 addr = gem->memory_ptr)
|
||||
{
|
||||
sys_memory_free(addr);
|
||||
sys_memory_free(ppu, addr);
|
||||
}
|
||||
|
||||
return CELL_OK;
|
||||
@ -950,7 +950,7 @@ error_code cellGemHSVtoRGB(f32 h, f32 s, f32 v, vm::ptr<f32> r, vm::ptr<f32> g,
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code cellGemInit(vm::cptr<CellGemAttribute> attribute)
|
||||
error_code cellGemInit(ppu_thread& ppu, vm::cptr<CellGemAttribute> attribute)
|
||||
{
|
||||
cellGem.warning("cellGemInit(attribute=*0x%x)", attribute);
|
||||
|
||||
@ -973,7 +973,7 @@ error_code cellGemInit(vm::cptr<CellGemAttribute> attribute)
|
||||
vm::var<u32> addr(0);
|
||||
|
||||
// Decrease memory stats
|
||||
if (sys_memory_allocate(GemGetMemorySize(attribute->max_connect), SYS_MEMORY_PAGE_SIZE_64K, +addr) != CELL_OK)
|
||||
if (sys_memory_allocate(ppu, GemGetMemorySize(attribute->max_connect), SYS_MEMORY_PAGE_SIZE_64K, +addr) != CELL_OK)
|
||||
{
|
||||
return CELL_GEM_ERROR_RESOURCE_ALLOCATION_FAILED;
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ struct sys_memory_address_table
|
||||
|
||||
// Todo: fix order of error checks
|
||||
|
||||
error_code sys_memory_allocate(u32 size, u64 flags, vm::ptr<u32> alloc_addr)
|
||||
error_code sys_memory_allocate(cpu_thread& cpu, u32 size, u64 flags, vm::ptr<u32> alloc_addr)
|
||||
{
|
||||
vm::temporary_unlock();
|
||||
cpu.state += cpu_flag::wait;
|
||||
|
||||
sys_memory.warning("sys_memory_allocate(size=0x%x, flags=0x%llx, alloc_addr=*0x%x)", size, flags, alloc_addr);
|
||||
|
||||
@ -68,7 +68,7 @@ error_code sys_memory_allocate(u32 size, u64 flags, vm::ptr<u32> alloc_addr)
|
||||
}
|
||||
|
||||
// Dealloc using the syscall
|
||||
sys_memory_free(addr);
|
||||
sys_memory_free(cpu, addr);
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
}
|
||||
@ -77,9 +77,9 @@ error_code sys_memory_allocate(u32 size, u64 flags, vm::ptr<u32> alloc_addr)
|
||||
return CELL_ENOMEM;
|
||||
}
|
||||
|
||||
error_code sys_memory_allocate_from_container(u32 size, u32 cid, u64 flags, vm::ptr<u32> alloc_addr)
|
||||
error_code sys_memory_allocate_from_container(cpu_thread& cpu, u32 size, u32 cid, u64 flags, vm::ptr<u32> alloc_addr)
|
||||
{
|
||||
vm::temporary_unlock();
|
||||
cpu.state += cpu_flag::wait;
|
||||
|
||||
sys_memory.warning("sys_memory_allocate_from_container(size=0x%x, cid=0x%x, flags=0x%llx, alloc_addr=*0x%x)", size, cid, flags, alloc_addr);
|
||||
|
||||
@ -138,7 +138,7 @@ error_code sys_memory_allocate_from_container(u32 size, u32 cid, u64 flags, vm::
|
||||
}
|
||||
|
||||
// Dealloc using the syscall
|
||||
sys_memory_free(addr);
|
||||
sys_memory_free(cpu, addr);
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
}
|
||||
@ -147,9 +147,9 @@ error_code sys_memory_allocate_from_container(u32 size, u32 cid, u64 flags, vm::
|
||||
return CELL_ENOMEM;
|
||||
}
|
||||
|
||||
error_code sys_memory_free(u32 addr)
|
||||
error_code sys_memory_free(cpu_thread& cpu, u32 addr)
|
||||
{
|
||||
vm::temporary_unlock();
|
||||
cpu.state += cpu_flag::wait;
|
||||
|
||||
sys_memory.warning("sys_memory_free(addr=0x%x)", addr);
|
||||
|
||||
@ -165,9 +165,9 @@ error_code sys_memory_free(u32 addr)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code sys_memory_get_page_attribute(u32 addr, vm::ptr<sys_page_attr_t> attr)
|
||||
error_code sys_memory_get_page_attribute(cpu_thread& cpu, u32 addr, vm::ptr<sys_page_attr_t> attr)
|
||||
{
|
||||
vm::temporary_unlock();
|
||||
cpu.state += cpu_flag::wait;
|
||||
|
||||
sys_memory.trace("sys_memory_get_page_attribute(addr=0x%x, attr=*0x%x)", addr, attr);
|
||||
|
||||
@ -203,9 +203,9 @@ error_code sys_memory_get_page_attribute(u32 addr, vm::ptr<sys_page_attr_t> attr
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code sys_memory_get_user_memory_size(vm::ptr<sys_memory_info_t> mem_info)
|
||||
error_code sys_memory_get_user_memory_size(cpu_thread& cpu, vm::ptr<sys_memory_info_t> mem_info)
|
||||
{
|
||||
vm::temporary_unlock();
|
||||
cpu.state += cpu_flag::wait;
|
||||
|
||||
sys_memory.warning("sys_memory_get_user_memory_size(mem_info=*0x%x)", mem_info);
|
||||
|
||||
@ -226,18 +226,18 @@ error_code sys_memory_get_user_memory_size(vm::ptr<sys_memory_info_t> mem_info)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code sys_memory_get_user_memory_stat(vm::ptr<sys_memory_user_memory_stat_t> mem_stat)
|
||||
error_code sys_memory_get_user_memory_stat(cpu_thread& cpu, vm::ptr<sys_memory_user_memory_stat_t> mem_stat)
|
||||
{
|
||||
vm::temporary_unlock();
|
||||
cpu.state += cpu_flag::wait;
|
||||
|
||||
sys_memory.todo("sys_memory_get_user_memory_stat(mem_stat=*0x%x)", mem_stat);
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code sys_memory_container_create(vm::ptr<u32> cid, u32 size)
|
||||
error_code sys_memory_container_create(cpu_thread& cpu, vm::ptr<u32> cid, u32 size)
|
||||
{
|
||||
vm::temporary_unlock();
|
||||
cpu.state += cpu_flag::wait;
|
||||
|
||||
sys_memory.warning("sys_memory_container_create(cid=*0x%x, size=0x%x)", cid, size);
|
||||
|
||||
@ -270,9 +270,9 @@ error_code sys_memory_container_create(vm::ptr<u32> cid, u32 size)
|
||||
return CELL_EAGAIN;
|
||||
}
|
||||
|
||||
error_code sys_memory_container_destroy(u32 cid)
|
||||
error_code sys_memory_container_destroy(cpu_thread& cpu, u32 cid)
|
||||
{
|
||||
vm::temporary_unlock();
|
||||
cpu.state += cpu_flag::wait;
|
||||
|
||||
sys_memory.warning("sys_memory_container_destroy(cid=0x%x)", cid);
|
||||
|
||||
@ -305,9 +305,9 @@ error_code sys_memory_container_destroy(u32 cid)
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
error_code sys_memory_container_get_size(vm::ptr<sys_memory_info_t> mem_info, u32 cid)
|
||||
error_code sys_memory_container_get_size(cpu_thread& cpu, vm::ptr<sys_memory_info_t> mem_info, u32 cid)
|
||||
{
|
||||
vm::temporary_unlock();
|
||||
cpu.state += cpu_flag::wait;
|
||||
|
||||
sys_memory.warning("sys_memory_container_get_size(mem_info=*0x%x, cid=0x%x)", mem_info, cid);
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include "Emu/Memory/vm_ptr.h"
|
||||
#include "Emu/IdManager.h"
|
||||
|
||||
class cpu_thread;
|
||||
|
||||
enum : u32
|
||||
{
|
||||
SYS_MEMORY_CONTAINER_ID_INVALID = 0xFFFFFFFF,
|
||||
@ -89,12 +91,12 @@ struct sys_memory_user_memory_stat_t
|
||||
};
|
||||
|
||||
// SysCalls
|
||||
error_code sys_memory_allocate(u32 size, u64 flags, vm::ptr<u32> alloc_addr);
|
||||
error_code sys_memory_allocate_from_container(u32 size, u32 cid, u64 flags, vm::ptr<u32> alloc_addr);
|
||||
error_code sys_memory_free(u32 start_addr);
|
||||
error_code sys_memory_get_page_attribute(u32 addr, vm::ptr<sys_page_attr_t> attr);
|
||||
error_code sys_memory_get_user_memory_size(vm::ptr<sys_memory_info_t> mem_info);
|
||||
error_code sys_memory_get_user_memory_stat(vm::ptr<sys_memory_user_memory_stat_t> mem_stat);
|
||||
error_code sys_memory_container_create(vm::ptr<u32> cid, u32 size);
|
||||
error_code sys_memory_container_destroy(u32 cid);
|
||||
error_code sys_memory_container_get_size(vm::ptr<sys_memory_info_t> mem_info, u32 cid);
|
||||
error_code sys_memory_allocate(cpu_thread& cpu, u32 size, u64 flags, vm::ptr<u32> alloc_addr);
|
||||
error_code sys_memory_allocate_from_container(cpu_thread& cpu, u32 size, u32 cid, u64 flags, vm::ptr<u32> alloc_addr);
|
||||
error_code sys_memory_free(cpu_thread& cpu, u32 start_addr);
|
||||
error_code sys_memory_get_page_attribute(cpu_thread& cpu, u32 addr, vm::ptr<sys_page_attr_t> attr);
|
||||
error_code sys_memory_get_user_memory_size(cpu_thread& cpu, vm::ptr<sys_memory_info_t> mem_info);
|
||||
error_code sys_memory_get_user_memory_stat(cpu_thread& cpu, vm::ptr<sys_memory_user_memory_stat_t> mem_stat);
|
||||
error_code sys_memory_container_create(cpu_thread& cpu, vm::ptr<u32> cid, u32 size);
|
||||
error_code sys_memory_container_destroy(cpu_thread& cpu, u32 cid);
|
||||
error_code sys_memory_container_get_size(cpu_thread& cpu, vm::ptr<sys_memory_info_t> mem_info, u32 cid);
|
||||
|
@ -33,7 +33,7 @@ namespace rsx
|
||||
const auto contextInfo = vm::ptr<rsx_context>::make(contextAddr);
|
||||
|
||||
// 'fake' initialize usermemory
|
||||
sys_memory_allocate(buffer_size, SYS_MEMORY_PAGE_SIZE_1M, contextInfo.ptr(&rsx_context::user_addr));
|
||||
sys_memory_allocate(*this, buffer_size, SYS_MEMORY_PAGE_SIZE_1M, contextInfo.ptr(&rsx_context::user_addr));
|
||||
verify(HERE), (user_mem_addr = contextInfo->user_addr) != 0;
|
||||
|
||||
if (sys_rsx_device_map(*this, contextInfo.ptr(&rsx_context::dev_addr), vm::null, 0x8) != CELL_OK)
|
||||
|
Loading…
Reference in New Issue
Block a user