Skip to content

Runtime and HLE

Jason edited this page Aug 18, 2026 · 2 revisions

Runtime and HLE

The native runtime is the host-side compatibility layer around generated guest code. The key implementation entry points are under src/rt/.

Responsibilities

Area Current public map
Guest state and dispatch src/rt/recomp.h and recomp.c define CpuState, guest-memory helpers, dispatch support, and instrumentation.
Scheduling and lifecycle src/rt/sched.c, sr_coro.c, and ThreadMan-related code model cooperative PSP threads, waits, callbacks, and lifecycle transitions.
HLE/NID services src/rt/hle.c registers and dispatches PSP operations and contains a large portion of kernel/user behavior.
Filesystem and devices src/rt/iso.c, savedata, and device mappings translate guest I/O to explicitly bounded host resources.
Input and timing SDL input and scheduler/clock services provide host-facing input and virtualized time.
Display and graphics GE, framebuffer, guest VRAM, and SDL3/Vulkan paths are separate but coordinated.
Audio and media audio, ATRAC3+, MPEG/PSMF, and decoder bridges are maintained as distinct layers.

The separate reference interpreter supports differential and local-consistency work; it is not a second runtime backend for ordinary builds.

The default paced profile now uses one rational scheduler-owned 60000/1001 VBLANK source, with separate turbo behavior and improved deadline/wait promotion. This is a source-level timing improvement, not complete PSP timing acceptance; delivery/coalescing under load remains open in issue #70. Audio decode, SAS/mixing, and output layers are likewise implemented separately from sustained smooth-title acceptance; see issue #67.

Correctness rules

  • Treat CpuState as a shared ABI. Coordinate generated-code and runtime changes.
  • Preflight complete readable or writable guest spans before bulk host access when the PSP-visible contract requires failure atomicity.
  • Keep logical stream position separate from physical ring-buffer position in streamed media.
  • Unknown or unregistered NIDs must not be converted into success merely to advance a route. Implement the operation, register the real behavior, or keep the gap observable.
  • A passing route proves only the path and evidence category it exercised. Scheduler, callback, wait, lifecycle, and renderer agreement each have their own acceptance boundaries.

For current implementation details, read the architecture guide, debugging guide, and HLE sources.

For generalized platform semantics, use the research site's ThreadMan and scheduler, callbacks, and failure-atomicity pages.

Nakagawa Recomp

Architecture

Development

Project

Research site

Clone this wiki locally