Dispatch syscalls 0x79/0x7A to the existing SIF register handlers - #274
Open
llesieur99 wants to merge 1 commit into
Open
llesieur99 wants to merge 1 commit into
llesieur99 wants to merge 1 commit into
Conversation
The dispatcher had no branch for 0x79/0x7A, so sceSifInitCmd fell through to
"Unimplemented PS2 syscall" and never reached the SIF path. Measured on
Ratchet & Clank (SCUS-97199): 31 254 "[Syscall TODO]" lines, all of them
v1=0x7a, 7.8 MB of error stream in a 140-second run, zero frames and zero CD
reads. After the change the same run logs 0 "[Syscall TODO]" and the SIF
register path becomes reachable (sceSifGetReg / sceSifSetReg / sceSifSetDma).
The mapping was read off the disassembly rather than guessed:
0x118B60: `li v1,0x79; syscall` called with (0x80000000, value) then
(0x80000001, address) -> two arguments -> sceSifSetReg(reg,val)
0x118B70: `li v1,0x7A; syscall` called with (0x80000000), (4), (2)
-> one argument -> sceSifGetReg(reg)
The SDK agrees: 118 SifDmaStat, 119 SifSetDma, 120 SifSetDChain, 121
SifSetReg, 122 SifGetReg. The three lower neighbours (0x76/0x77/0x78) are
already dispatched a few lines above; only these two branches were missing.
Both handlers already exist in Stubs/SIF.cpp and read a0/a1, which is the
syscall convention, so only the dispatch branch was added. Bit 31 of the
register number is the PS2 convention (0x80000000 | SIF register).
Built and run locally against c5a9d02 (MSVC Release, exit 0).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this fixes
Dispatcher.cpphas no branch for syscalls 0x79 and 0x7A, sosceSifInitCmdfell through to "Unimplemented PS2 syscall" and the game never reached the SIF path.Measured on Ratchet & Clank (SCUS-97199), 140-second run with the ISO:
[Syscall TODO]lines, allv1=0x7asceSifGetReg,sceSifSetReg,sceSifSetDmalines appearWhy 0x79 and 0x7A are SifSetReg and SifGetReg
Read off the game's own disassembly, not guessed:
Two arguments is the setter, one is the getter. The SDK numbering agrees — 118
SifDmaStat, 119SifSetDma, 120SifSetDChain, 121SifSetReg, 122SifGetReg— and the three lower neighbours are already dispatched a few lines above in the same switch. Bit 31 of the register number is the PS2 convention (0x80000000 | SIF register).What changed
Both handlers already exist in
Stubs/SIF.cppand reada0/a1, which is the syscall convention, so only the two dispatch branches were missing. The change is 19 lines in one file, no other behaviour touched.Verification
c5a9d02(MSVC Release, exit 0) and run with the game ISO, 140 s.rac1-port-1→rac1-port-2).The syscall numbers were also cross-checked against the published PS2 SDK numbering, but the measurement above is what I would look at first.