fix(libs): take the AMM submit checks from ampr_emu
The AMM submit forms now return EINVAL for a priority above 2 and EPERM for a null command buffer, in that order, as ampr_emu's amm_validate_submit_args does, instead of EINVAL for a null buffer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c16e59bfd5
commit
0cb5ca7203
|
|
@ -624,15 +624,15 @@ int APS5_VABI sceAmprAmmGetVirtualAddressRanges(std::uint64_t* start, std::uint6
|
|||
}
|
||||
|
||||
int APS5_VABI sceAmprAmmSubmitCommandBuffer(void* base, std::uint32_t offset, std::uint32_t priority) {
|
||||
(void)priority;
|
||||
if (!base) return SCE_KERNEL_ERROR_EINVAL;
|
||||
if (priority > 2u) return SCE_KERNEL_ERROR_EINVAL;
|
||||
if (!base) return SCE_KERNEL_ERROR_EPERM;
|
||||
AmmSubmit_nid_no_patch(base, offset);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int APS5_VABI sceAmprAmmSubmitCommandBuffer2(void* base, std::uint32_t offset, std::uint32_t priority, AmmSubmitResult* result, std::uint32_t* id) {
|
||||
(void)priority;
|
||||
if (!base) return SCE_KERNEL_ERROR_EINVAL;
|
||||
if (priority > 2u) return SCE_KERNEL_ERROR_EINVAL;
|
||||
if (!base) return SCE_KERNEL_ERROR_EPERM;
|
||||
const auto submitted = AmmSubmit_nid_no_patch(base, offset);
|
||||
if (result) *result = {0, 0};
|
||||
if (id) *id = submitted;
|
||||
|
|
@ -640,8 +640,8 @@ int APS5_VABI sceAmprAmmSubmitCommandBuffer2(void* base, std::uint32_t offset, s
|
|||
}
|
||||
|
||||
int APS5_VABI sceAmprAmmSubmitCommandBuffer3(void* base, std::uint32_t offset, std::uint32_t priority, std::uint32_t* id) {
|
||||
(void)priority;
|
||||
if (!base) return SCE_KERNEL_ERROR_EINVAL;
|
||||
if (priority > 2u) return SCE_KERNEL_ERROR_EINVAL;
|
||||
if (!base) return SCE_KERNEL_ERROR_EPERM;
|
||||
const auto submitted = AmmSubmit_nid_no_patch(base, offset);
|
||||
if (id) *id = submitted;
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -646,7 +646,10 @@ void TestAmm() {
|
|||
Require(sceAmprAmmCommandBufferUnmap(&exact.buffer, start, page) == 0);
|
||||
Require(sceAmprAmmCommandBufferUnmap(&exact.buffer, start, page) == busy);
|
||||
Require(sceAmprAmmCommandBufferMap(&exact.buffer, start, page, 0, cpuReadWrite) == busy);
|
||||
Require(sceAmprAmmSubmitCommandBuffer(nullptr, 0, 0) == invalidArgument);
|
||||
Require(sceAmprAmmSubmitCommandBuffer(nullptr, 0, 0) == permissionDenied);
|
||||
Require(sceAmprAmmSubmitCommandBuffer(exact.memory.data(), 0, 3) == invalidArgument);
|
||||
Require(sceAmprAmmSubmitCommandBuffer3(nullptr, 0, 3, nullptr) == invalidArgument);
|
||||
Require(sceAmprAmmSubmitCommandBuffer(exact.memory.data(), 0, 2) == 0);
|
||||
|
||||
Require(sceAmprAmmMeasureAmmCommandSizeMap(start, page, 0, 0x04) == ammRejected);
|
||||
Require(sceAmprAmmMeasureAmmCommandSizeMapWithGpuMaskId(start + 8, page, 0, cpuReadWrite, 0) == ammRejected);
|
||||
|
|
|
|||
Loading…
Reference in New Issue