mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-25 19:44:57 +00:00
Handle errors in sceKernelAllocateDirectMemory
This commit is contained in:
parent
345d55669e
commit
0d1394ac2b
@ -46,6 +46,10 @@ int PS4_SYSV_ABI sceKernelAllocateDirectMemory(s64 searchStart, s64 searchEnd, u
|
|||||||
|
|
||||||
auto* memory = Core::Memory::Instance();
|
auto* memory = Core::Memory::Instance();
|
||||||
PAddr phys_addr = memory->Allocate(searchStart, searchEnd, len, alignment, memoryType);
|
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);
|
*physAddrOut = static_cast<s64>(phys_addr);
|
||||||
|
|
||||||
LOG_INFO(Kernel_Vmm,
|
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->second.GetEnd() <= search_end) {
|
||||||
++dmem_area;
|
++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
|
// Align free position
|
||||||
PAddr free_addr = dmem_area->second.base;
|
PAddr free_addr = dmem_area->second.base;
|
||||||
|
Loading…
Reference in New Issue
Block a user