mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-18 21:05:19 +00:00
sys_ppu_thread: reduce global memory stats after thread creation
This commit is contained in:
parent
72d1efa383
commit
dc5cdb3bb4
3 changed files with 18 additions and 1 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include "sys_event.h"
|
||||
#include "sys_process.h"
|
||||
#include "sys_mmapper.h"
|
||||
#include "sys_memory.h"
|
||||
|
||||
LOG_CHANNEL(sys_ppu_thread);
|
||||
|
||||
|
|
@ -367,10 +368,19 @@ error_code _sys_ppu_thread_create(vm::ptr<u64> thread_id, vm::ptr<ppu_thread_par
|
|||
// Compute actual stack size and allocate
|
||||
const u32 stack_size = ::align<u32>(std::max<u32>(_stacksz, 4096), 4096);
|
||||
|
||||
const auto dct = g_fxo->get<lv2_memory_container>();
|
||||
|
||||
// Try to obtain "physical memory" from the default container
|
||||
if (!dct->take(stack_size))
|
||||
{
|
||||
return CELL_ENOMEM;
|
||||
}
|
||||
|
||||
const vm::addr_t stack_base{vm::alloc(stack_size, vm::stack, 4096)};
|
||||
|
||||
if (!stack_base)
|
||||
{
|
||||
dct->used -= stack_size;
|
||||
return CELL_ENOMEM;
|
||||
}
|
||||
|
||||
|
|
@ -408,6 +418,7 @@ error_code _sys_ppu_thread_create(vm::ptr<u64> thread_id, vm::ptr<ppu_thread_par
|
|||
if (!tid)
|
||||
{
|
||||
vm::dealloc(stack_base);
|
||||
dct->used -= stack_size;
|
||||
return CELL_EAGAIN;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue