Skip to content

Save SYS03 outgoing context for a closed current thread - #758

Merged
mstan merged 1 commit into
masterfrom
fix/hle-sys03-closed-thread-context-20261024
Oct 24, 2026
Merged

mstan merged 1 commit into
masterfrom
fix/hle-sys03-closed-thread-context-20261024

Conversation

@mstan

@mstan mstan commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

CloseTh(current); ChangeTh(other): the BIOS exception handler stores the outgoing registers even though CloseTh marked the TCB free (0x1000). OpenTh later reuses the TCB and only initializes PC/SP/FP/GP, so dropping the save left stale registers (seen as a stale s6 in Tombi EU's CD-loader thread on New Game). Reported by michaelm-afk.

541a9b0: saves for 0x4000 and 0x1000 in both the HLE scheduler and the LLE fiber bridge (the handoff fixed only HLE). Never reopens the closed TCB. Independent of the EU stack; based on master.

Test: syscall_closed_thread_context (production traps.c, O0/O2) fails before, passes after; syscall_change_thread_self still passes.

🤖 Generated with Claude Code

CloseTh(current); ChangeTh(other) still stores the outgoing registers, as the BIOS exception handler does. Fixes both the HLE scheduler and the LLE fiber bridge. Reported by michaelm-afk.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@mstan
mstan force-pushed the fix/hle-sys03-closed-thread-context-20261024 branch from 89bfffe to 541a9b0 Compare October 24, 2026 19:31
@mstan
mstan changed the base branch from integrate/tombi-eu-to-master-20261024 to master October 24, 2026 19:32
@mstan
mstan marked this pull request as ready for review October 24, 2026 19:32
@mstan
mstan merged commit 8c649cd into master Oct 24, 2026
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