Repository navigation
Call the BIOS through thunks that keep t1 to the jump - #10
Conversation
The PS1 wrappers set t1 through a register variable and then called 0xa0, which leaves the compiler free to reuse t1 in between. Each call now goes through a weak COMDAT thunk, `j 0xa0` with t1 set in the delay slot, the same scheme nugget uses.
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
BIOS thunk definition src/lpsxbios.h |
Defines a macro for emitting weak BIOS-call thunks in per-thunk COMDAT sections, plus a macro for external linkage declarations. |
Error handling BIOS calls src/ldo.c |
Replaces inline PSX syscall wrappers for setjmp, longjmp, and abort with BIOS thunk declarations and calls. |
PSX output BIOS calls src/luaconf.h |
Replaces inline PSX syscall wrappers with BIOS thunk declarations and routes string and line output through the write and putchar functions. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Merge Risk: 
Minimal · up to efded
-
The BIOS thunk changes preserve the inspected error-handling and output call contracts. No actionable merge-blocking issue was identified; merging remains subject to normal PSX build checks.
Pre-merge checks: 
5
-
Full details: Title check
-
Explanation
The title "Call the BIOS through thunks that keep t1 to the jump" is specific and matches the changeset. The PR replaces the register-variable approach for setting t1 with weak COMDAT thunks that set t1 in the delay slot before jumping to the BIOS table at 0xa0. It covers setjmp, longjmp, abort, write, and putchar. The wording is slightly awkward ("keep t1 to the jump"), but a reviewer scanning history would still understand the primary change.
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 3 files.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
The five PS1 wrappers (setjmp, longjmp and abort in
ldo.c, write and putchar inluaconf.h) set t1 through a register variable and then called 0xa0, so nothing stopped the compiler reusing t1 before the jump. Each one now goes through a weak COMDAT thunk,j 0xa0with t1 set in the delay slot, the scheme pcsx-redux/nugget#296 moves nugget to.make psxbuilds clean; the thunks disassemble as the two expected instructions.Summary by CodeRabbit