mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-21 12:04:45 +00:00
Handle errors in sceKernelAllocateDirectMemory
This commit is contained in:
parent
345d55669e
commit
0d1394ac2b
2 changed files with 8 additions and 1 deletions
|
@ -46,6 +46,10 @@ int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u
|
|||
|
||||
auto* memory = Core::Memory::Instance();
|
||||
PAddr phys_addr = memory->Allocate(searchStart, searchEnd, len, alignment, memoryType);
|
||||
if (phys_addr == -1) {
|
||||
return ORBIS_KERNEL_ERROR_EAGAIN;
|
||||
}
|
||||
|
||||
*physAddrOut = static_cast<s64>(phys_addr);
|
||||
|
||||
LOG_INFO(Kernel_Vmm,
|
||||
|
|
|
@ -116,7 +116,10 @@ PAddr MemoryManager::Allocate(PAddr search_start, PAddr search_end, size_t size,
|
|||
dmem_area->second.GetEnd() <= search_end) {
|
||||
++dmem_area;
|
||||
}
|
||||
ASSERT_MSG(is_suitable(), "Unable to find free direct memory area: size = {:#x}", size);
|
||||
if (!is_suitable()) {
|
||||
LOG_ERROR(Kernel_Vmm, "Unable to find free direct memory area: size = {:#x}", size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Align free position
|
||||
PAddr free_addr = dmem_area->second.base;
|
||||
|
|
Loading…
Add table
Reference in a new issue