Repository navigation
Kernel swap (KSSF): fix context, return code, allocation-failure and redirection handling - #190
Open
nakatamaho wants to merge 9 commits into
Open
nakatamaho wants to merge 9 commits into
nakatamaho wants to merge 9 commits into
Conversation
The swap terminates the shell process: DOS closes the redirected or piped handles and the batch/FOR context is lost, so the program wrote to the console and the target file stayed empty under /SWAP. docs/k-swap.txt lists these cases as unsupported; fall back to an ordinary EXEC for them. (cherry picked from commit b646c55)
This branch has not been deployed
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.
Fixes #189.
Kernel-swap (KSSF /
CALL /S) fixes on top of currentmaster. None of the touched files changed since com086, so the commits apply cleanly; each commit is self-contained.shell/kswap.c): register the segment and size of the environment backup at swap time. The previous code registered an offset (a narrowed far pointer), and a shellwhose environment was resized with
/E:could overrun the early allocation.shell/kswap.c,include/context.h,tools/kssf.asm): keep the dynamic context (aliases, history,/LOWpolicy and its counters) allocated across the shell's exit andreturn its ownership to the reloaded shell.
tools/kssf.asm): preserve the swapped program's DOS return code across the shell reload, soERRORLEVELis correct afterwards.shell/kswap.c): if the backup allocation fails, execute the command without swapping instead of loading STRINGS while memory is exhausted (which could prompt for aresource file); the warning is written through the resident DOS writer.
lib/exec1.c,shell/kswap.c,tools/kssf.asm,criter/context.x,include/misc.h): keep the child's exit status separate from DOS EXEC errors, so a normal exit code(for example 7) is no longer reported as an MCB-corruption error.
tools/kssf.asm): restrict the expanded reload branch of KSSF to 8086 instructions (CPU 8086), so it runs on 8086/V30-class machines.shell/command.c): the swap ends the shell process, so DOS closes redirected and piped handles and the batch/FOR context is lost (with/SWAP,prog > fileleft an empty file). These cases, whichdocs/k-swap.txtlists as unsupported, now run with an ordinary EXEC.A documentation commit removes a reference to a test directory that is not part of this tree.
Built with Open Watcom 1.9 (
build.sh wc english) and NASM 2.15 (kssf.asm) on current master. Behavior was exercised on an emulated PC-88VA (shell started through KSSF with/SWAPandCALL /S, return tothe reloaded shell,
ERRORLEVELafter a swapped program, redirected output). It has not been run on a standard PC with this branch.