Add debug info to ENOMEMs

This commit is contained in:
Eladash 2024-02-15 22:29:45 +02:00 committed by Elad.Ash
parent 989b353fbd
commit 27ea25a999
3 changed files with 4 additions and 3 deletions

View file

@ -126,7 +126,7 @@ error_code sys_memory_allocate(cpu_thread& cpu, u32 size, u64 flags, vm::ptr<u32
// Try to get "physical memory"
if (!dct.take(size))
{
return CELL_ENOMEM;
return {CELL_ENOMEM, dct.size - dct.used};
}
if (const auto area = reserve_map(size, align))
@ -200,7 +200,7 @@ error_code sys_memory_allocate_from_container(cpu_thread& cpu, u32 size, u32 cid
if (ct.ret)
{
return ct.ret;
return {ct.ret, ct->size - ct->used};
}
if (const auto area = reserve_map(size, align))

View file

@ -74,6 +74,7 @@ CellError lv2_memory::on_id_create()
{
if (!exists && !ct->take(size))
{
sys_mmapper.error("lv2_memory::on_id_create(): Cannot allocate 0x%x bytes (0x%x available)", size, ct->size - ct->used);
return CELL_ENOMEM;
}

View file

@ -507,7 +507,7 @@ error_code _sys_ppu_thread_create(ppu_thread& ppu, vm::ptr<u64> thread_id, vm::p
// Try to obtain "physical memory" from the default container
if (!dct.take(stack_size))
{
return CELL_ENOMEM;
return {CELL_ENOMEM, dct.size - dct.used};
}
const vm::addr_t stack_base{vm::alloc(stack_size, vm::stack, 4096)};