mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-10-27 00:28:14 +00:00
4.4 KiB
4.4 KiB
libSceFiber technical debt
Functional
- sceFiberGetInfo reports the requested-size window at the top of the host stack used for execution, rather than the original caller buffer, which is retained and pinned. The additional 1 MiB host-call margin below that window is not included in
size_context. Planet Coaster (PPSA01736 v01.017) uses this range for ChakraCore garbage-collector stack scans; reporting the unused caller buffer makes the scan cross unmapped memory. The range is covered by a regression test while running, switching and migrating a fiber between threads. Console behavior for substituted host stacks has no direct equivalent and is not measured.
Unknown function info
- _sceFiberInitializeWithInternalOptionImpl (libSceFiber) - its signature and the flag values
0x1(no ulobjmgr registration),0x10(context size check) and0x100(start with MXCSR0x9fc0and x87 control word0x037f) follow shadPS4's initialize implementation and flags. Not measured on a console.0x1has no effect because no ulobjmgr exists; other flag bits throw. shadPS4 also sets0x100forbuild_version3.50 and later in every initialize;opt_paramandbuild_versionare ignored. - _sceFiberAttachContextAndRun, _sceFiberAttachContextAndSwitch (libSceFiber) - signatures and behaviour follow shadPS4's run, switch and attach implementations, not measured on a console. A context is attached only to an idle fiber initialized without one; a fiber that already has a context, or is not idle, returns
SCE_FIBER_ERROR_INVALID. A size that is not a multiple of 16 returnsSCE_FIBER_ERROR_ALIGNMENTas in initialize, where shadPS4 returnsSCE_FIBER_ERROR_INVALID. - Fibers without a context (libSceFiber) - caller-stack execution and restart after yielding follow shadPS4 at commit
f68923fe807f657348e6719ce658bcbd0a2b1c72(run, switch, return), not measurements on a PS5. The original calling thread stack is reused even when switching from an attached fiber; contextless continuations are discarded. - _sceFiberGetThreadFramePointerAddress (libSceFiber, NID
0dy4JtMUcMQ) forwards tosceFiberGetThreadFramePointerAddress; that the argument list matches is inferred from the export without the underscore, as for the underscore Ult exports, not measured - Fiber stacks (libSceFiber) - a fiber whose context is smaller than 64 KiB runs on an mmap'd host stack of its context size plus 1 MiB, so host calls made from it (21 KiB deep when PPSA01341 reaches SPIRV-Tools from a 16 KiB context) do not overwrite the contexts packed next to it; a larger context is the stack, as on the console. PPSA05684 needs the second: its job fibers have 64 KiB and 512 KiB contexts, the 512 KiB ones at 1 MiB-aligned addresses, and find their job record by masking the stack pointer (
~0xffffffor the 512 KiB ones), which a host stack breaks (the game waits forever in GameInit, or faults later in a 64 KiB fiber). The 64 KiB limit is chosen between these two titles, not measured: a title with small contexts that also derives state from the stack pointer, or one whose host calls exceed what is left of a large context, is not covered