Skip to content

ppu: guest callbacks receive r3 through r10 - #86

Open
canersaka wants to merge 1 commit into
sp00nznet:ps3recompfrom
canersaka:fix/guest-call-r10
Open

ppu: guest callbacks receive r3 through r10#86
canersaka wants to merge 1 commit into
sp00nznet:ps3recompfrom
canersaka:fix/guest-call-r10

Conversation

@canersaka

Copy link
Copy Markdown
Contributor

The guest-call bridge only accepted seven integer arguments, r3 through r9, even though the 64-bit PowerPC ABI has eight volatile argument registers through r10. Every wrapper and callback adapter inherited that truncation. A callback with an eighth register argument silently received zero or stale state, and the trophy callback path made the loss visible by explicitly discarding its fifth callback argument before entering the guest.

This extends the shared dispatcher and its wrappers to carry r3 through r10, then updates the existing call sites mechanically. Shorter callbacks still pass zero in unused positions. The trophy adapter now forwards the argument it previously discarded; there is no per-title special case.

Verified: ps3recomp_runtime builds clean with all twelve call sites updated, and the PPU dispatcher translation unit compiles independently with the new signature. The diff is signature propagation plus the one trophy forwarding correction; no callback selection or return-value behavior changes.

Expand the shared guest-caller hook and both OPD dispatch helpers from r3-r6 to the full r3-r10 register argument window. Update every in-tree caller and runner, and preserve sceNpTrophy's fifth callback argument instead of forcing r7 to zero.
@canersaka
canersaka marked this pull request as ready for review July 25, 2026 05:57
sp00nznet added a commit that referenced this pull request Aug 15, 2026
#86 widened ppu_guest_call / the g_ps3_guest_caller hook from r3-r6 to r3-r10
and updated every call site that existed on its base. Two sites added later by
the integration chain were not on that base and were left at five arguments:

  runtime/ppu/ppu_hle.cpp:407   ppu_guest_call(iopd, desc, 1, 8, 0x398)
  lbp/main.cpp:174              harness_guest_caller + its local typedef/extern

The lbp one is the worse of the two: it re-declared ps3_guest_caller_fn locally
with five parameters and installed a five-parameter function as the hook, so a
nine-argument call through g_ps3_guest_caller was an ABI mismatch rather than a
compile error.

Neither showed up in the #91 verification because ppu_hle.cpp and lbp/main.cpp
are per-title files, not part of the ps3recomp_runtime library or the
sync_stress target. Found by building the Rubber Ducky port against master.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant