Repository navigation
exec.library: Supervisor enters its routine through a real exception frame - #199
Merged
Merged
Conversation
…frame The 6-byte 68000 frame broke every Supervisor routine on a 68010 or later, whose RTE reads a format word; switch to the supervisor stack as exception entry does, and return straight to the caller, so a routine may RTE elsewhere (ixemul's longjmp). Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 23, 2026
sidick
added a commit
that referenced
this pull request
Oct 23, 2026
Fills in the 0.13 changelog: ixemul.library's full path-based file I/O (GetDeviceProc's dvp_Port, the path packet actions, and Info()) from #197/#198, Supervisor()'s real exception frame unblocking nested library calls from #199, the dl_TimeReq clock() fix from #194, the remaining AllocDosObject types (DOS_STDPKT/DOS_CLI) from #187, and #200's new_lock leak fix. Also documents these in Supported-Libraries.md (expanded packet-action list, Supervisor's RTE-anywhere support, dl_TimeReq). Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.
Supervisor()pushed a 6-byte 68000 exception frame (SR, PC) whatever the emulated CPU. On a 68010 and later,RTEreads a format word after the PC (m68k-rsdecode.rs, 0x4E73), so everySupervisor()routine crashed on--cpu 68020/68040; evenmoveq #42,d0 ; rte:ixemul.library's
longjmp()showed it, and two more gaps. It callssigreturn(), aSupervisor()routine that sets USP, rewrites the frame's PC and SR to thesetjmp()point, andRTEs there in user mode (library/trap.S_do_sigreturn). So the routine'sRTEnever came back to the continuation the trampoline queued, which then confused later calls (on--cpu 68000: "continuation stub trapped ... with no pending continuation"); and laterSupervisor()calls came from user mode, where the frame belongs on the supervisor stack, not the caller's.Supervisor()now enters its routine the way the CPU enters an exception: a newCpu::push_exception_frameswitches to supervisor mode and the supervisor stack (trace bits cleared) and pushes the frame the model'sRTEpops (SR, PC, and on a 68010+ a format 0 vector word$20), returning straight to the caller in its own SR. No continuation is queued, so the routine may make library calls (#192 still holds) and mayRTEanywhere.ContinuationStack::trampoline_rtehad no other user and is removed. The new SP is published to the--sanitizeshadow before the frame is written, as the per-instruction hook does for guest pushes.With this, gcc's
pr56982.cand20210505-1.c(setjmp/longjmp) pass at every-Olevel linked against ixemul 47.3 and 80.1, with--sanitize, on--cpu 68000and68020; together with #197 and #198, gcc's C execute testsuite against ixemul fails only one test (an unrelated toolchain issue).Test plan
RTEpops; a routine thatRTEs elsewhere, then a secondSupervisor()call;Supervisor()from user mode runs the routine with S set and returns to user mode on the user stack. All three fail with the old handler.Supervisortests, including the nested library call of exec.library Supervisor() can't support a routine that makes another library call (blocks ixemul exit cleanup) #192cargo test --workspace: all pass exceptexectask::tests::pending_host_break_folds_into_check_signal/_wait, which fail the same way on main in a full parallel run (see dos.library: GetDeviceProc returns the filesystem packet port in dvp_Port #197)cargo clippy --workspace --all-targets,cargo fmt --check: clean🤖 Generated with Claude Code