mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-21 16:12:47 -05:00
6.4 KiB
6.4 KiB
libSceAmpr technical debt
Unknown function info
- AMPR command buffer null arguments (libSceAmpr) - the result for a null command buffer is unknown for
sceAmprCommandBufferConstructor,sceAmprAprCommandBufferConstructor,sceAmprCommandBufferResetandsceAmprCommandBufferSetBuffer; these returnSCE_KERNEL_ERROR_EINVALhere, but the behavior has not been confirmed on a PS5. - AMPR WriteAddressFromCounterPairOnCompletion (libSceAmpr) - the pair of an even counter n is assumed to give counter n in the low 32 bits and n + 1 in the high 32 bits. Wait compare values, wait flush and counter index ranges follow the ampr_emu reimplementation; the flush is accepted and has no effect, as commands run in order
- AMPR command buffer offsets (libSceAmpr) - recording with a current offset greater than the bound memory size throws before calculating remaining capacity or writing a command. This validates the emulator's own command-buffer encoding; the console's response to a corrupted opaque buffer object is unknown.
- AMPR command sizes (libSceAmpr) - commands use the emulator's own encoding with an 8-byte header, so
Nop(n)takes 8 + 4n bytes where the console record is n dwords including its header (NopWithData(n): (n + 1) dwords). The measure functions agree with the appended sizes, but a title that pads to an exact offset or the end of the buffer withNop(remaining / 4)getsSCE_KERNEL_ERROR_EBUSYor a shifted offset. The at-start flag of the_04_00writes is ignored; commands run in order, each after the previous one completes - APR map begin and end (libSceAmpr) - as in ampr_emu,
MapBegin/MapDirectBeginmap when they run andMapEndonly closes the region; while a region is open a second begin and every completion write returnEPERM, the at-start_04_00writes are accepted - AMPR markers (libSceAmpr) - signatures taken from the ampr_emu reimplementation, not confirmed on a title:
sceAmprCommandBufferSetMarkerWithColortakes the color by pointer, the push and measure variants by value. Colors are not recorded - __cxa_call_unexpected (libSceAmpr) - takes the in-flight exception's unwind header and never returns, as libcxxabi 18.1.8 does. No
std::set_unexpectedis exported and the exception header's unexpected handler is never set, so the handler is always the default one, which callsstd::terminate(cxa_default_handlers.cpp); it therefore forwards to libc's__cxa_call_terminate, which begins the catch and runs the current terminate handler. That matches libcxxabi except for which terminate handler runs: therestd::terminateafter__cxa_begin_catch(cxa_exception.cpp L470-L477) runs the handler saved in the caught exception's header (cxa_handlers.cpp L72-L93), which__cxa_throwand__cxa_init_primary_exceptionset tostd::get_terminate()when the exception is thrown (cxa_exception.cpp L209-L214, L279), while here the current global handler runs, as AnyPS5's ownstd::terminatedoes. The two differ only ifstd::set_terminatewas called between the throw and this call. A null header terminates because this emulator's libc__cxa_begin_catchterminates on null (libcxxabi does not define that case). Dynamic exception specifications that would let a replaced unexpected handler throw a permitted type are not modelled
Functional
- sceAmprAmmGetUsageStatsData (libSceAmpr) fills the caller-sized 24-byte statistics structure with 512 page-table pool entries, no allocated entries, a zero high watermark and ring idle flags 0x7, the constants of KytyPS5; they are not measured on a console, and the real call is a pass-through to
sceKernelMapperGetUsageStatsDataper drakmor/ampr_emu, which this port has no kernel-side counterpart for. - Dinkumware thread exports (libSceAmpr) follow the Dinkumware threads library shipped with Visual C++ 2013 (
cthread.c) and itsatomic.c, microsoft/STLcthread.cppand C11 Annex K, without console verification. The spin lock (byte exchange loop, no yield) matches that disassembly. The shared_ptr spin lock is one process-wide flag that yields while it spins.wcstombs_siswcsrtombs_swith a fresh conversion state, so*retvalexcludes the terminating null as in Annex K, not as in the Microsoft CRT, and_TRUNCATEhas no meaning. - _Cnd_init_with_name (libSceAmpr) - takes a pointer to the handle slot like the libc
_Cnd_*exports from #3079 and acts on the same conditions. The signature_Cnd_init_with_name(_Cnd_t*, const char* name)is inferred from fpPS4ps4_mtx_internal.pas, where the PS4_Mtx_initis_Mtx_init_with_namewith the nameSceLibcI_Mtxand the name only reaches the pthread object; here it is_Cnd_initand the name, which may be null, is ignored. This is not confirmed on a PS5libc.prx.