core/kernel: Fix returns on `sceKernelAvailableDirectMemorySize`
This commit is contained in:
parent
902d279c0a
commit
be1994f109
|
@ -75,28 +75,26 @@ s32 PS4_SYSV_ABI sceKernelAvailableDirectMemorySize(u64 searchStart, u64 searchE
|
||||||
LOG_WARNING(Kernel_Vmm, "called searchStart = {:#x}, searchEnd = {:#x}, alignment = {:#x}",
|
LOG_WARNING(Kernel_Vmm, "called searchStart = {:#x}, searchEnd = {:#x}, alignment = {:#x}",
|
||||||
searchStart, searchEnd, alignment);
|
searchStart, searchEnd, alignment);
|
||||||
|
|
||||||
if (searchEnd <= searchStart) {
|
if (physAddrOut == nullptr || sizeOut == nullptr) {
|
||||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
if (searchEnd > SCE_KERNEL_MAIN_DMEM_SIZE) {
|
if (searchEnd > SCE_KERNEL_MAIN_DMEM_SIZE) {
|
||||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
return ORBIS_KERNEL_ERROR_EINVAL;
|
||||||
}
|
}
|
||||||
|
if (searchEnd <= searchStart) {
|
||||||
if (physAddrOut == nullptr || sizeOut == nullptr) {
|
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||||
return ORBIS_KERNEL_ERROR_EINVAL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto* memory = Core::Memory::Instance();
|
auto* memory = Core::Memory::Instance();
|
||||||
|
|
||||||
PAddr physAddr;
|
PAddr physAddr{};
|
||||||
size_t size;
|
size_t size{};
|
||||||
s32 result =
|
s32 result = memory->DirectQueryAvailable(searchStart, searchEnd, alignment, &physAddr, &size);
|
||||||
memory->DirectQueryAvailable(searchStart, searchEnd, alignment, &physAddr, &size);
|
|
||||||
|
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
return ORBIS_KERNEL_ERROR_ENOMEM;
|
return ORBIS_KERNEL_ERROR_ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
*physAddrOut = static_cast<u64>(physAddr);
|
*physAddrOut = static_cast<u64>(physAddr);
|
||||||
*sizeOut = size;
|
*sizeOut = size;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue