Matthew Stanley
fdbd2b515f
runtime: cross-fiber longjmp fix + decouple vblank-present from MMIO read
...
Two distinct bugs were causing OPTIONS-black hard freezes after 12K-65K
frames:
1. interrupts.c + traps.c: exception_jmpbuf is a single global. setjmp
captures the running fiber, but longjmp may be requested from a
different fiber via psx_exception_longjmp / psx_restore_state_escape
during chain-handler dispatch. Cross-fiber longjmp restores RSP to
the wrong stack while Win32 still tracks the calling fiber, corrupting
fiber state until SwitchToFiber eventually hangs.
Fix: track g_exception_owner_fiber at setjmp time. New
deferred_exception_longjmp checks the current fiber; if it's not the
owner, sets a pending flag and SwitchToFiber's back to the owner.
psx_change_thread_fiber's post-SwitchToFiber path observes the flag
and executes the longjmp on the correct stack.
2. gpu.c: gpu_read_gpustat fired gpu_vblank_tick() after 1000 polls,
which invoked sdl_vblank_present (SDL_Delay -> Sleep) from inside
an MMIO read code path. That meant recompiled MIPS spent wall time
in Sleep deep inside the fiber call tree -- confusing to reason
about and a contributor to fiber/longjmp interactions.
Fix: synthetic VBLANK from a poll-storm only updates emulation state
(LCF + I_STAT). The host-side render+sleep happens only at the proper
cycle-paced VBLANK trigger in psx_check_interrupts.
Also adds: dirty_block ring slice to the freeze auto-dump, Win32 main-
thread stack capture for wedge_kind=1 hard freezes (SuspendThread +
StackWalk64 + SymFromAddr), and dbghelp link.
Validated: TombaRecomp psx-runtime ran 30+ minutes / 105K+ frames at
OPTIONS with no hard freeze. Previous freezes consistently hit at
11900, 20493, and 64596 frames.
Diagnostic tooling under tools/_options_session/ that produced this
diagnosis is included.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com >
2026-05-15 12:49:13 -07:00
..
2026-05-15 12:49:13 -07:00
2026-04-14 08:49:45 -07:00
2026-05-07 17:57:34 -07:00
2026-05-03 16:43:07 -07:00
2026-05-05 21:06:44 -07:00
2026-05-05 21:06:44 -07:00
2026-05-05 21:06:44 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-03 16:43:07 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-03 16:43:07 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-04-11 21:26:04 -07:00
2026-05-07 17:57:34 -07:00
2026-05-05 21:06:44 -07:00
2026-05-05 21:06:44 -07:00
2026-05-05 21:06:44 -07:00
2026-05-05 21:06:44 -07:00
2026-05-05 21:06:44 -07:00
2026-05-05 21:06:44 -07:00
2026-05-07 17:57:34 -07:00
2026-05-05 21:06:44 -07:00
2026-05-07 17:57:34 -07:00
2026-04-11 21:26:04 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-05 21:06:44 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-04-11 21:26:04 -07:00
2026-04-11 21:26:04 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-05-07 17:57:34 -07:00
2026-05-05 22:13:06 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-05 23:45:33 -07:00
2026-05-03 16:43:07 -07:00
2026-05-07 17:57:34 -07:00
2026-05-09 19:09:48 -07:00
2026-05-10 15:45:57 -07:00
2026-05-03 16:43:07 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-03 16:43:07 -07:00
2026-05-07 17:57:34 -07:00
2026-05-09 19:09:48 -07:00
2026-05-09 19:09:48 -07:00
2026-05-09 19:09:48 -07:00
2026-05-07 17:57:34 -07:00
2026-05-10 15:45:57 -07:00
2026-05-11 12:34:49 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-07 17:57:34 -07:00
2026-05-05 22:13:06 -07:00
2026-05-07 17:57:34 -07:00
2026-05-03 16:43:07 -07:00
2026-04-14 01:34:27 -07:00
2026-04-14 01:34:27 -07:00
2026-04-28 21:29:19 -07:00
2026-05-03 16:43:07 -07:00
2026-04-28 21:29:19 -07:00
2026-04-28 21:29:19 -07:00
2026-04-28 21:29:19 -07:00
2026-04-28 21:29:19 -07:00
2026-04-28 21:29:19 -07:00
2026-05-13 01:31:27 -07:00
2026-05-03 16:43:07 -07:00
2026-04-11 21:26:04 -07:00
2026-04-11 21:26:04 -07:00
2026-04-25 00:15:01 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-04-26 00:36:15 -07:00
2026-04-30 14:26:19 -07:00
2026-04-28 21:29:19 -07:00
2026-04-14 02:03:14 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-04-30 14:26:19 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-04-30 14:26:19 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-05-13 01:31:27 -07:00
2026-05-13 01:31:27 -07:00
2026-04-29 14:46:26 -07:00
2026-05-03 16:43:07 -07:00
2026-04-28 21:29:19 -07:00
2026-04-28 21:29:19 -07:00
2026-04-21 14:23:09 -07:00
2026-04-21 14:23:09 -07:00
2026-04-28 21:29:19 -07:00
2026-04-24 00:29:06 -07:00
2026-04-14 01:34:27 -07:00
2026-04-14 01:34:27 -07:00
2026-04-29 14:46:26 -07:00
2026-04-24 00:29:06 -07:00
2026-04-24 00:29:06 -07:00
2026-04-24 00:29:06 -07:00
2026-04-14 01:34:27 -07:00
2026-04-14 01:34:27 -07:00
2026-04-14 01:34:27 -07:00
2026-04-14 01:34:27 -07:00
2026-04-14 01:34:27 -07:00
2026-04-14 01:34:27 -07:00
2026-04-14 01:34:27 -07:00
2026-05-03 16:43:07 -07:00
2026-04-28 21:29:19 -07:00
2026-04-26 00:36:15 -07:00
2026-04-24 00:29:06 -07:00
2026-05-03 16:43:07 -07:00
2026-04-26 00:36:15 -07:00
2026-05-03 16:43:07 -07:00
2026-04-28 21:29:19 -07:00
2026-04-14 01:34:27 -07:00
2026-04-14 01:34:27 -07:00
2026-04-23 17:50:47 -07:00
2026-04-28 21:29:19 -07:00
2026-04-24 00:29:06 -07:00
2026-04-28 21:29:19 -07:00
2026-04-24 00:29:06 -07:00
2026-05-03 16:43:07 -07:00
2026-04-28 21:29:19 -07:00
2026-04-14 01:34:27 -07:00
2026-04-14 01:34:27 -07:00
2026-04-24 00:29:06 -07:00
2026-04-12 20:29:03 -07:00
2026-04-24 00:29:06 -07:00
2026-05-13 01:31:27 -07:00
2026-04-24 00:29:06 -07:00
2026-04-28 21:29:19 -07:00
2026-05-03 16:43:07 -07:00
2026-04-30 14:26:19 -07:00
2026-04-21 14:23:09 -07:00
2026-04-28 21:29:19 -07:00
2026-04-28 21:29:19 -07:00
2026-04-28 21:29:19 -07:00
2026-04-28 21:29:19 -07:00
2026-04-29 22:20:55 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-04-13 21:19:32 -07:00
2026-04-29 22:20:55 -07:00
2026-04-29 22:20:55 -07:00
2026-04-29 22:20:55 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-04-28 21:29:19 -07:00
2026-04-24 00:29:06 -07:00
2026-04-21 18:13:51 -07:00
2026-05-03 16:43:07 -07:00
2026-05-03 16:43:07 -07:00
2026-04-29 14:46:26 -07:00
2026-04-28 21:29:19 -07:00
2026-04-24 00:29:06 -07:00
2026-04-29 14:46:26 -07:00
2026-04-13 21:19:32 -07:00
2026-04-13 21:19:32 -07:00
2026-05-13 01:31:27 -07:00
2026-04-28 21:29:19 -07:00
2026-04-13 21:19:32 -07:00
2026-04-14 01:34:27 -07:00
2026-04-14 01:34:27 -07:00
2026-04-14 01:34:27 -07:00
2026-04-14 01:34:27 -07:00
2026-04-28 21:29:19 -07:00
2026-04-28 21:29:19 -07:00
2026-05-03 16:43:07 -07:00
2026-04-28 21:29:19 -07:00
2026-05-03 16:43:07 -07:00
2026-04-28 21:29:19 -07:00
2026-04-29 21:15:09 -07:00
2026-04-29 14:46:26 -07:00
2026-04-29 14:46:26 -07:00
2026-05-03 16:43:07 -07:00
2026-04-29 14:46:26 -07:00
2026-04-29 14:46:26 -07:00
2026-04-29 14:46:26 -07:00
2026-04-29 14:46:26 -07:00
2026-04-29 14:46:26 -07:00
2026-05-13 01:31:27 -07:00
2026-04-29 14:46:26 -07:00
2026-04-30 13:10:05 -07:00
2026-04-30 13:10:05 -07:00
2026-04-28 21:29:19 -07:00
2026-04-29 14:46:26 -07:00