Files
psxrecomp/runtime/tests/test_syscall_closed_thread_context.py
Matthew Stanley 541a9b067f Save SYS03 outgoing context for a closed current thread
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>
2026-10-24 12:31:29 -07:00

22 lines
836 B
Python

"""CloseTh(current); ChangeTh(other) must still save the outgoing registers.
Links the production traps.c into test_syscall_closed_thread_context.c at -O0
and -O2; every other runtime seam is an abort() stub (fixture_link.py).
"""
import argparse
import tempfile
from pathlib import Path
from fixture_link import build_and_run
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--cc', default='gcc')
args = parser.parse_args()
here = Path(__file__).resolve().parent
with tempfile.TemporaryDirectory() as root:
for opt in ('-O0', '-O2'):
build_and_run(args.cc, here, here.parent, opt, Path(root),
['traps.c'], 'test_syscall_closed_thread_context.c')
print('PASS: closed outgoing thread keeps its context without reopening (O0/O2)')