Fibers and user-level threads
On Windows, each libSceFiber fiber is a real Windows fiber, so a switch keeps the guest registers and the guest stack. User-level threads start through the same pthread path.
Repository notes through October 10, 2026
Why a fiber cannot be a no-op
Guest code runs as native machine code. A fiber switch has to resume the exact registers and the exact stack, with host frames and guest frames mixed on that stack. Returning success from sceFiberSwitch without switching would let the title continue on the wrong stack and corrupt both sides.
PS5PCEM backs each initialized guest fiber with one Windows fiber. sceFiberRun, sceFiberSwitch and sceFiberReturnToThread use that mechanism. The thread that called sceFiberRun is the root fiber. The public 128-byte SceFiber record keeps the ABI signatures, the state, the entry argument, the name and the caller-provided context range.
Whose stack it is
The title supplies a context buffer, and that buffer is recorded in the ABI object. Windows owns the actual stack. Using the title's buffer as a native Windows stack would skip the guard page and the unwind bookkeeping the operating system requires. The minimum context the firmware record expects is still checked, along with alignment and the start and end signatures.
sceFiberGetSelf, finalization, cross-thread ownership checks and runtime reset are implemented. The backend exists on the Windows x86-64 native-execution target. Other hosts can build the rest of the emulator, and this switch path is not available there.
User-level threads
libSceUlt initialize and finalize succeed so a title's job system can start. Runtimes, waiting queues, queue-data pools, mutexes, semaphores and queues keep host-side state keyed by the objects the title allocated. The work items themselves start through the existing pthread path. Work-area size queries return the aligned sizes those creates expect.
Kernel user-edge event queues share the same sequence-aware wait as pthread synchronization. VideoOut filter -13 and graphics filter -14 ride that queue and keep each registration's identifier and user data. ULT is scheduling glue. It does not add a second CPU emulator.
What is implemented
- Windows fibers for sceFiberRun, sceFiberSwitch and sceFiberReturnToThread.
- ABI signatures, ownership checks and a host-owned stack with a guard page.
- ULT initialize, queues, mutexes, semaphores and pthread-backed work items.
- User-edge event queues shared with VideoOut and graphics completion.
What is still missing
- The fiber switch exists on Windows x86-64. Other host operating systems do not run guest code natively.
- A fiber is not a preemptively scheduled hardware thread.
- ULT does not implement a separate interpreter for worker bodies.
Related mechanisms
What these pages are