Merge pull request #756 from CnRJay/feat/amm-prt

feat(libs): implement the AMM PRT commands
This commit is contained in:
Dean
2026-10-06 13:17:24 +13:00
committed by GitHub
5 changed files with 227 additions and 3 deletions
+49
View File
@@ -169,6 +169,15 @@ static int RecordAmmProtect(Apr::CommandBufferObject* buffer, Apr::Opcode opcode
return AppendAmm(buffer, &command, sizeof(command));
}
static constexpr std::int32_t PrtAllocationMask = 1019;
static int RecordPrt(Apr::CommandBufferObject* buffer, const void* command, std::uint32_t bytes) {
if (!buffer) return SCE_KERNEL_ERROR_EINVAL;
if (bytes > buffer->size - buffer->offset) return SCE_KERNEL_ERROR_EBUSY;
if (!buffer->base) return SCE_KERNEL_ERROR_EPERM;
return Append(buffer, command, bytes);
}
static int RecordMapBegin(Apr::CommandBufferObject* buffer, Apr::Opcode opcode, std::uint64_t address, std::uint64_t directOffset, std::uint64_t size, std::int32_t type, std::int32_t protection) {
if (!ValidMap(address, directOffset, size, protection)) return SCE_KERNEL_ERROR_EINVAL;
if (InMap(buffer)) return SCE_KERNEL_ERROR_EPERM;
@@ -714,6 +723,46 @@ std::int64_t APS5_VABI sceAmprAmmMeasureAmmCommandSizeModifyMtypeProtectWithGpuM
return sceAmprAmmMeasureAmmCommandSizeModifyMtypeProtect(address, size, type, protection, mask);
}
int APS5_VABI sceAmprAmmCommandBufferMapAsPrt(Apr::CommandBufferObject* buffer, std::uint64_t address, std::uint64_t size) {
if (!buffer) return SCE_KERNEL_ERROR_EINVAL;
if (!ValidMapRange(address, size)) return SCE_KERNEL_ERROR_EINVAL;
const Apr::AmmUnmapCommand command{{Apr::Opcode::AmmMapAsPrt, sizeof(command)}, address, size};
return RecordPrt(buffer, &command, sizeof(command));
}
int APS5_VABI sceAmprAmmCommandBufferAllocatePaForPrt(Apr::CommandBufferObject* buffer, std::uint64_t address, std::uint64_t size, std::int32_t type, std::int32_t protection) {
if (!ValidAmmProtection(protection)) return SCE_KERNEL_ERROR_EINVAL;
if (!buffer) return SCE_KERNEL_ERROR_EINVAL;
if (!ValidMapRange(address, size)) return SCE_KERNEL_ERROR_EINVAL;
const Apr::AmmProtectCommand command{{Apr::Opcode::AmmAllocatePaForPrt, sizeof(command)}, address, size, type, protection, PrtAllocationMask, 0};
return RecordPrt(buffer, &command, sizeof(command));
}
int APS5_VABI sceAmprAmmCommandBufferRemapIntoPrt(Apr::CommandBufferObject* buffer, std::uint64_t address, std::uint64_t source, std::uint64_t size, std::int32_t protection, std::uint32_t opcode) {
if (!buffer) return SCE_KERNEL_ERROR_EINVAL;
if (!buffer->base) return SCE_KERNEL_ERROR_EPERM;
if (!ValidRemap(address, source, size, protection)) return SCE_KERNEL_ERROR_EINVAL;
const Apr::AmmRemapCommand command{{Apr::Opcode::AmmRemapIntoPrt, sizeof(command)}, address, source, size, protection, static_cast<std::int32_t>(opcode ? opcode : 1011u)};
return AppendAmm(buffer, &command, sizeof(command));
}
int APS5_VABI sceAmprAmmCommandBufferUnmapToPrt(Apr::CommandBufferObject* buffer, std::uint64_t address, std::uint64_t size) {
if (!buffer) return SCE_KERNEL_ERROR_EINVAL;
if (!buffer->base) return SCE_KERNEL_ERROR_EPERM;
if (!ValidMapRange(address, size)) return SCE_KERNEL_ERROR_EINVAL;
const Apr::AmmUnmapCommand command{{Apr::Opcode::AmmUnmapToPrt, sizeof(command)}, address, size};
return AppendAmm(buffer, &command, sizeof(command));
}
std::int64_t APS5_VABI sceAmprAmmMeasureAmmCommandSizeMapAsPrt(std::uint64_t address, std::uint64_t size) {
return ValidMapRange(address, size) ? std::int64_t{sizeof(Apr::AmmUnmapCommand)} : AmmMeasureInvalid;
}
std::int64_t APS5_VABI sceAmprAmmMeasureAmmCommandSizeAllocatePaForPrt(std::uint64_t address, std::uint64_t size, std::int32_t type, std::int32_t protection) {
(void)type;
return ValidMapRange(address, size) && ValidAmmProtection(protection) ? std::int64_t{sizeof(Apr::AmmProtectCommand)} : AmmMeasureInvalid;
}
int APS5_VABI sceAmprAmmGiveDirectMemory(std::int64_t searchStart, std::int64_t searchEnd, std::size_t size, std::size_t alignment, int usage, std::int64_t* offset) {
return AmmGiveDirectMemory_nid_no_patch(searchStart, searchEnd, size, alignment, usage, offset);
}
@@ -52,6 +52,10 @@ enum class Opcode : std::uint32_t {
AmmMultiMap = 22,
AmmModifyProtect = 23,
AmmModifyMtypeProtect = 24,
AmmMapAsPrt = 25,
AmmAllocatePaForPrt = 26,
AmmRemapIntoPrt = 27,
AmmUnmapToPrt = 28,
};
struct CommandHeader {
+88 -3
View File
@@ -19,6 +19,7 @@
#include <fstream>
#include <map>
#include <mutex>
#include <set>
#include <stdexcept>
#include <string>
#include <thread>
@@ -257,6 +258,7 @@ struct AmmState {
std::map<std::uint64_t, std::uint64_t> pool;
std::map<std::uintptr_t, AmmPage> pages;
std::map<std::uint64_t, std::uint32_t> pooledUses;
std::set<std::uintptr_t> prt;
std::atomic<std::uint32_t> lastSubmit{0};
};
@@ -363,19 +365,87 @@ void _mapPages(AmmState& state, std::uint64_t address, const std::vector<AmmPage
for (std::size_t index = 0; index < pages.size(); ++index) _addPage(state, address + index * PS5_PAGE_SIZE, pages[index]);
}
void _clearPrt(AmmState& state, std::uint64_t address, std::uint64_t size) {
state.prt.erase(state.prt.lower_bound(address), state.prt.lower_bound(address + size));
}
void _requirePrt(AmmState& state, std::uint64_t address, std::uint64_t size) {
for (std::uint64_t offset = 0; offset < size; offset += PS5_PAGE_SIZE) {
if (!state.prt.contains(address + offset)) throw std::runtime_error("AMM: range is not a PRT range");
}
}
void _zeroPrt(std::uint64_t address, std::uint64_t size) {
constexpr int GpuRead = 0x10;
void* target = reinterpret_cast<void*>(address);
if (DoMapAnon(&target, size, GpuRead, GuestMapFixed) != 0) throw std::runtime_error("AMM: cannot map the unbacked PRT pages");
}
void _ammUnmap(const Apr::AmmUnmapCommand& command) {
auto& state = _amm();
const std::lock_guard lock(state.lock);
_ammCheckRange(state, command.address, command.size);
_forgetPages(state, command.address, command.size, true);
_clearPrt(state, command.address, command.size);
_reserve(command.address, command.size);
}
void _ammMapAsPrt(const Apr::AmmUnmapCommand& command) {
auto& state = _amm();
const std::lock_guard lock(state.lock);
_ammCheckRange(state, command.address, command.size);
_forgetPages(state, command.address, command.size, true);
_zeroPrt(command.address, command.size);
for (std::uint64_t offset = 0; offset < command.size; offset += PS5_PAGE_SIZE) state.prt.insert(command.address + offset);
}
void _ammUnmapToPrt(const Apr::AmmUnmapCommand& command) {
auto& state = _amm();
const std::lock_guard lock(state.lock);
_ammCheckRange(state, command.address, command.size);
_requirePrt(state, command.address, command.size);
_forgetPages(state, command.address, command.size, true);
_zeroPrt(command.address, command.size);
}
void _ammAllocatePrt(const Apr::AmmProtectCommand& command) {
auto& state = _amm();
const std::lock_guard lock(state.lock);
_ammCheckRange(state, command.address, command.size);
_requirePrt(state, command.address, command.size);
for (std::uint64_t offset = 0; offset < command.size;) {
const auto address = command.address + offset;
const bool backed = state.pages.contains(address);
std::uint64_t end = offset + PS5_PAGE_SIZE;
while (end < command.size && state.pages.contains(command.address + end) == backed) end += PS5_PAGE_SIZE;
const auto bytes = end - offset;
if (backed) {
for (std::uint64_t page = 0; page < bytes; page += PS5_PAGE_SIZE) {
auto& entry = state.pages[address + page];
entry.type = command.type;
entry.protection = command.protection;
}
if (DoMprotect(reinterpret_cast<void*>(address), bytes, _ammHostProtection(command.protection)) != 0) throw std::runtime_error("AMM: protection change failed");
} else {
std::vector<AmmPage> pages;
try {
for (std::uint64_t page = 0; page < bytes; page += PS5_PAGE_SIZE) pages.push_back({_takePoolPages(state, PS5_PAGE_SIZE), command.type, command.protection, true});
} catch (...) {
for (const auto& page : pages) _returnPoolPages(state, page.physical, PS5_PAGE_SIZE);
throw;
}
_mapPages(state, address, pages);
}
offset = end;
}
}
void _ammMap(const Apr::AmmMapCommand& command, bool direct) {
auto& state = _amm();
const std::lock_guard lock(state.lock);
_ammCheckRange(state, command.address, command.size);
_forgetPages(state, command.address, command.size, true);
_clearPrt(state, command.address, command.size);
const auto physical = direct ? command.directOffset : _takePoolPages(state, command.size);
try {
_mapRun(command.address, physical, command.size, command.protection);
@@ -386,19 +456,22 @@ void _ammMap(const Apr::AmmMapCommand& command, bool direct) {
for (std::uint64_t offset = 0; offset < command.size; offset += PS5_PAGE_SIZE) _addPage(state, command.address + offset, {physical + offset, command.type, command.protection, !direct});
}
void _ammRemap(const Apr::AmmRemapCommand& command, bool alias) {
void _ammRemap(const Apr::AmmRemapCommand& command, bool alias, bool intoPrt) {
auto& state = _amm();
const std::lock_guard lock(state.lock);
_ammCheckRange(state, command.address, command.size);
_ammCheckRange(state, command.source, command.size);
if (alias && command.address < command.source + command.size && command.source < command.address + command.size) throw std::runtime_error("AMM: multimap onto its own source range");
if ((alias || intoPrt) && command.address < command.source + command.size && command.source < command.address + command.size) throw std::runtime_error("AMM: remap onto its own source range");
if (intoPrt) _requirePrt(state, command.address, command.size);
auto pages = _mappedPages(state, command.source, command.size);
for (auto& page : pages) page.protection = command.protection;
if (!alias) {
_forgetPages(state, command.source, command.size, false);
_clearPrt(state, command.source, command.size);
_reserve(command.source, command.size);
}
_forgetPages(state, command.address, command.size, true);
if (!intoPrt) _clearPrt(state, command.address, command.size);
_mapPages(state, command.address, pages);
}
@@ -472,7 +545,19 @@ void _execute(const Apr::CommandBufferObject& buffer) {
break;
case Apr::Opcode::AmmRemap:
case Apr::Opcode::AmmMultiMap:
_ammRemap(_read<Apr::AmmRemapCommand>(buffer, cursor), header.opcode == Apr::Opcode::AmmMultiMap);
_ammRemap(_read<Apr::AmmRemapCommand>(buffer, cursor), header.opcode == Apr::Opcode::AmmMultiMap, false);
break;
case Apr::Opcode::AmmRemapIntoPrt:
_ammRemap(_read<Apr::AmmRemapCommand>(buffer, cursor), false, true);
break;
case Apr::Opcode::AmmMapAsPrt:
_ammMapAsPrt(_read<Apr::AmmUnmapCommand>(buffer, cursor));
break;
case Apr::Opcode::AmmUnmapToPrt:
_ammUnmapToPrt(_read<Apr::AmmUnmapCommand>(buffer, cursor));
break;
case Apr::Opcode::AmmAllocatePaForPrt:
_ammAllocatePrt(_read<Apr::AmmProtectCommand>(buffer, cursor));
break;
case Apr::Opcode::AmmModifyProtect:
case Apr::Opcode::AmmModifyMtypeProtect:
+85
View File
@@ -90,6 +90,12 @@ std::uint64_t APS5_VABI sceAmprMeasureCommandSizeMapBegin(std::uint64_t, std::ui
std::uint64_t APS5_VABI sceAmprMeasureCommandSizeMapDirectBegin(std::uint64_t, std::uint64_t, std::uint64_t, std::uint32_t, std::uint32_t);
std::uint64_t APS5_VABI sceAmprMeasureCommandSizeMapEnd();
int APS5_VABI sceKernelQueryMemoryProtection(void*, void**, void**, int*);
int APS5_VABI sceAmprAmmCommandBufferMapAsPrt(Apr::CommandBufferObject*, std::uint64_t, std::uint64_t);
int APS5_VABI sceAmprAmmCommandBufferAllocatePaForPrt(Apr::CommandBufferObject*, std::uint64_t, std::uint64_t, std::int32_t, std::int32_t);
int APS5_VABI sceAmprAmmCommandBufferRemapIntoPrt(Apr::CommandBufferObject*, std::uint64_t, std::uint64_t, std::uint64_t, std::int32_t, std::uint32_t);
int APS5_VABI sceAmprAmmCommandBufferUnmapToPrt(Apr::CommandBufferObject*, std::uint64_t, std::uint64_t);
std::int64_t APS5_VABI sceAmprAmmMeasureAmmCommandSizeMapAsPrt(std::uint64_t, std::uint64_t);
std::int64_t APS5_VABI sceAmprAmmMeasureAmmCommandSizeAllocatePaForPrt(std::uint64_t, std::uint64_t, std::int32_t, std::int32_t);
int APS5_VABI sceAmprAmmCommandBufferRemap(Apr::CommandBufferObject*, std::uint64_t, std::uint64_t, std::uint64_t, std::int32_t);
int APS5_VABI sceAmprAmmCommandBufferRemapWithGpuMaskId(Apr::CommandBufferObject*, std::uint64_t, std::uint64_t, std::uint64_t, std::int32_t, std::uint8_t);
int APS5_VABI sceAmprAmmCommandBufferMultiMap(Apr::CommandBufferObject*, std::uint64_t, std::uint64_t, std::uint64_t, std::int32_t);
@@ -807,6 +813,84 @@ void TestAmmRemapAndProtect() {
Require(sceAmprAmmMeasureAmmCommandSizeModifyMtypeProtect(returned, page, 0, 0x08, 0x03) == ammRejected);
}
void TestAmmPrt() {
std::uint64_t start = 0;
std::uint64_t end = 0;
std::uint64_t multimapStart = 0;
std::uint64_t multimapEnd = 0;
Require(sceAmprAmmGetVirtualAddressRanges(&start, &end, &multimapStart, &multimapEnd) == 0);
std::int64_t pool = -1;
Require(sceAmprAmmGiveDirectMemory(0, static_cast<std::int64_t>(sceKernelGetDirectMemorySize()), 4 * page, page, 1, &pool) == 0);
const std::uint64_t prt = start + 0x300000;
const std::uint64_t source = start + 0x380000;
Recorder reserve;
auto offset = reserve.Offset();
auto commands = reserve.Commands();
Require(sceAmprAmmCommandBufferMapAsPrt(&reserve.buffer, prt, 4 * page) == 0);
RequireAppended(reserve, offset, commands, Apr::Opcode::AmmMapAsPrt, sceAmprAmmMeasureAmmCommandSizeMapAsPrt(prt, 4 * page));
Require(sceAmprAmmCommandBufferMap(&reserve.buffer, source, page, 0, cpuReadWrite) == 0);
SubmitAmm(reserve);
Require(Protection(prt) == 0x10 && Protection(prt + 3 * page) == 0x10);
Require(At(prt) == 0 && At(prt + 4 * page - 8) == 0);
At(source) = 0x88;
Recorder back;
offset = back.Offset();
commands = back.Commands();
Require(sceAmprAmmCommandBufferAllocatePaForPrt(&back.buffer, prt + page, 2 * page, 0, cpuReadWrite) == 0);
RequireAppended(back, offset, commands, Apr::Opcode::AmmAllocatePaForPrt, sceAmprAmmMeasureAmmCommandSizeAllocatePaForPrt(prt + page, 2 * page, 0, cpuReadWrite));
Require(sceAmprAmmCommandBufferAllocatePaForPrt(&back.buffer, prt + 2 * page, page, 2, cpuGpuReadWrite) == 0);
Require(sceAmprAmmCommandBufferRemapIntoPrt(&back.buffer, prt + 3 * page, source, page, cpuReadWrite, 0) == 0);
SubmitAmm(back);
Require(Protection(prt) == 0x10 && Protection(prt + page) == 0x03 && Protection(prt + 2 * page) == 0x33 && Protection(prt + 3 * page) == 0x03);
At(prt + page) = 0x71;
At(prt + 2 * page) = 0x72;
Require(At(prt + page) == 0x71 && At(prt + 2 * page) == 0x72 && At(prt + 3 * page) == 0x88 && At(prt) == 0);
Recorder release;
offset = release.Offset();
commands = release.Commands();
Require(sceAmprAmmCommandBufferUnmapToPrt(&release.buffer, prt + page, 2 * page) == 0);
RequireAppended(release, offset, commands, Apr::Opcode::AmmUnmapToPrt, sceAmprAmmMeasureAmmCommandSizeUnmap(prt + page, 2 * page));
SubmitAmm(release);
Require(Protection(prt + page) == 0x10 && At(prt + page) == 0 && At(prt + 2 * page) == 0 && At(prt + 3 * page) == 0x88);
Recorder rebuild;
Require(sceAmprAmmCommandBufferAllocatePaForPrt(&rebuild.buffer, prt, 3 * page, 0, cpuReadWrite) == 0);
SubmitAmm(rebuild);
for (std::uint64_t index = 0; index < 3; ++index) {
Require(Protection(prt + index * page) == 0x03);
At(prt + index * page) = 0x90 + index;
}
Require(At(prt) == 0x90 && At(prt + page) == 0x91 && At(prt + 2 * page) == 0x92 && At(prt + 3 * page) == 0x88);
const std::int64_t ammRejected = invalidArgument;
Recorder empty;
Require(sceAmprAmmCommandBufferMapAsPrt(&empty.buffer, prt + 8, page) == invalidArgument);
Require(sceAmprAmmCommandBufferMapAsPrt(nullptr, prt, page) == invalidArgument);
Require(sceAmprAmmCommandBufferAllocatePaForPrt(&empty.buffer, prt, page, 0, 0x04) == invalidArgument);
Require(sceAmprAmmCommandBufferAllocatePaForPrt(nullptr, prt, page, 0, 0x404) == invalidArgument);
Require(sceAmprAmmCommandBufferAllocatePaForPrt(&empty.buffer, prt, 0, 0, cpuReadWrite) == invalidArgument);
Require(sceAmprAmmCommandBufferRemapIntoPrt(&empty.buffer, prt, source + 8, page, cpuReadWrite, 0) == invalidArgument);
Require(sceAmprAmmCommandBufferRemapIntoPrt(&empty.buffer, prt, source, page, 0x04, 0) == invalidArgument);
Require(sceAmprAmmCommandBufferUnmapToPrt(&empty.buffer, prt, page + 8) == invalidArgument);
Require(empty.Offset() == 0 && empty.Commands() == 0);
Apr::CommandBufferObject unbound{};
Require(sceAmprCommandBufferConstructor(&unbound) == 0);
Require(sceAmprAmmCommandBufferMapAsPrt(&unbound, prt, page) == busy);
Require(sceAmprAmmCommandBufferAllocatePaForPrt(&unbound, prt, page, 0, cpuReadWrite) == busy);
Require(sceAmprAmmCommandBufferRemapIntoPrt(&unbound, prt, source, page, cpuReadWrite, 0) == permissionDenied);
Require(sceAmprAmmCommandBufferUnmapToPrt(&unbound, prt, page) == permissionDenied);
std::array<std::uint8_t, 64> loose{};
Apr::CommandBufferObject sized{nullptr, static_cast<std::uint32_t>(loose.size()), 0, 0, Apr::BufferType::Generic, 0};
Require(sceAmprAmmCommandBufferMapAsPrt(&sized, prt, page) == permissionDenied);
Require(sceAmprAmmMeasureAmmCommandSizeMapAsPrt(prt, 0) == ammRejected);
Require(sceAmprAmmMeasureAmmCommandSizeAllocatePaForPrt(prt, page, 0, 0x08) == ammRejected);
Require(sceAmprAmmMeasureAmmCommandSizeAllocatePaForPrt(prt + 8, page, 0, cpuReadWrite) == ammRejected);
}
}
int main() {
@@ -828,5 +912,6 @@ int main() {
TestGatherScatter();
TestAmm();
TestAmmRemapAndProtect();
TestAmmPrt();
return 0;
}
+1
View File
@@ -41,6 +41,7 @@ Throughout the project, every function at every stage either **does exactly what
- [APR gather and scatter reads](../../core/libs/prx/libkernel/Apr/src/Apr.cpp) (libSceAmpr) - signatures, argument checks and the read cursor taken from the [ampr_emu](https://github.com/drakmor/ampr_emu) reimplementation, not confirmed on a title: each read leaves the file, the next file offset and the next destination; a gather reads that file at a new offset into the next destination, a scatter continues in the file into a new destination, a gather-scatter takes both. Recording one needs a read file since the last `ResetGatherScatterState`; like ampr_emu, `sceAmprCommandBufferReset` keeps that state, and a gather or scatter with no read before it in the submitted buffer throws instead of returning `SCE_AMPR_ERROR_APR_INVALIDGATHERSCATTERSTATE`
- [AMM map, map direct and unmap](../../core/libs/prx/libkernel/Apr/src/Apr.cpp) (libSceAmpr) - signatures and the protection mask (CPU, GPU, AMPR and ACP read and write) taken from the [ampr_emu](https://github.com/drakmor/ampr_emu) reimplementation, which hands the remaining checks and the mapping to the console kernel; the mapper model taken from [PS5PCEM](https://github.com/iStark/PS5PCEM): `sceAmprAmmGiveDirectMemory` usage 1 gives the allocated direct memory to the pool plain maps take pages from, usage 0 only allocates it. Not confirmed on a title. The AMM virtual address ranges are a 32 GiB range and a 32 GiB multimap range reserved in the guest arena on first use, not the console's; maps outside them throw. Addresses, sizes and direct offsets must be 16 KiB aligned. The memory type and the GPU mask are ignored, AMPR and ACP access maps as CPU access, unmapped pages go back to the pool and stay reserved. Submission runs the buffer before returning, the submit result is always 0 and a failing command throws; the AMM measures return errors sign-extended, as ampr_emu does. `sceAmprAmmGetVirtualAddressRanges` throws for a null output
- [AMM remap, multimap and protection changes](../../core/libs/prx/libkernel/Apr/src/Apr.cpp) (libSceAmpr) - signatures and the protection and mask checks taken from ampr_emu; the effects are inferred from the names, not confirmed on a title. A remap moves every page of a fully mapped range to the new address with the given protection and leaves the old range reserved; a multimap maps the same pages at a second address, anywhere in the AMM ranges, and a pool page goes back to the pool once its last mapping is unmapped; a multimap onto its own source range throws. A protection change sets the masked bits on every page of a fully mapped range; the memory type is recorded and ignored. A command on a range that is not fully mapped throws
- [AMM PRT ranges](../../core/libs/prx/libkernel/Apr/src/Apr.cpp) (libSceAmpr) - signatures, checks and their order taken from ampr_emu, where `MapAsPrt` is a map with the PRT flag and protection 0 and `AllocatePaForPrt` a memory type and protection change with mask 1019, both checking the buffer memory after its size; the effects are inferred from the names, not confirmed on a title. Unbacked PRT pages are zero-filled pages with GPU read access, so CPU reads see zeros instead of faulting and GPU writes fault instead of being dropped. `AllocatePaForPrt` backs each unbacked page with a pool page and sets the type and protection of backed ones; `RemapIntoPrt` moves a fully mapped range into a PRT range, its opcode argument (1011 when 0, as in ampr_emu) is recorded and ignored; `UnmapToPrt` returns the pages to the pool and zero-fills them again. A plain map, unmap or remap over a PRT range ends it; `AllocatePaForPrt`, `RemapIntoPrt` or `UnmapToPrt` outside a PRT range throws
- [APR map begin and end](../../core/libs/prx/libSceAmpr/Export.cpp) (libSceAmpr) - as in ampr_emu, `MapBegin`/`MapDirectBegin` map when they run and `MapEnd` only closes the region; while a region is open a second begin and every completion write return `EPERM`, the at-start `_04_00` writes are accepted
- [AMPR markers](../../core/libs/prx/libSceAmpr/Export.cpp) (libSceAmpr) - signatures taken from the [ampr_emu](https://github.com/drakmor/ampr_emu) reimplementation, not confirmed on a title: `sceAmprCommandBufferSetMarkerWithColor` takes the color by pointer, the push and measure variants by value. Colors are not recorded
- [sceFontGetRenderScaledKerning](../../core/libs/prx/libSceFont/src/Render.cpp) (libSceFont) - arguments, the cleared output and the bound renderer check taken from `cellFontGetRenderScaledKerning` in [RPCS3](https://github.com/RPCS3/rpcs3/blob/master/rpcs3/Emu/Cell/Modules/cellFont.cpp) (PS3 predecessor of the library), not confirmed on a title. The kerning is the `sceFontGetKerning` one at the render scale