-
Notifications
You must be signed in to change notification settings - Fork 157
ecm int24 fix #215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ecm int24 fix #215
Conversation
This fixes int 24h abort to set the return code to 200h. The ErrorMode misuse is apparently necessary, but was not sufficient to set the return code.
This is compatible to lMS-DOS which sets the flag before running int 2Fh function 1122h [1] and clears it after closing handles and freeing memory [2], before branching to the Parent Return Address. The flag turns any int 24h abort response into a fail instead, to avoid iterating infinitely during file handle closing. [1]: https://hg.pushbx.org/ecm/msdos4/file/c057c6a1c9ad/src/DOS/ctrlc.nas#l752 [2]: https://hg.pushbx.org/ecm/msdos4/file/c057c6a1c9ad/src/DOS/ctrlc.nas#l829
If error mode isn't set then the code branches so that it increments InDOS, which ends up with InDOS = 2 here: Line 351 in 032523a
InDOS is decremented, not reset to zero, in Lines 616 to 617 in 032523a
The Lines 475 to 478 in 032523a
That means it isn't set any longer in Lines 1105 to 1113 in 032523a
|
After a usual Error Mode int 21h call, InDOS is not decremented to match it not being incremented at the beginning: Line 367 in 032523a
In lMS-DOS we clear InDOS on process termination, overwriting it with a zero, rather than only decrementing it. Also, lMS-DOS doesn't re-enter the main int 21h handler again to do the int 24h abort, so it can't incorrectly increment InDOS again. Unlike FreeDOS, lMS-DOS resets Error Mode to zero after int 24h has been called, not setting it again for the abort afterwards. |
Interestingly, in https://hg.pushbx.org/ecm/msdos4/file/c057c6a1c9ad/src/DOS/disp.nas#l465 functions 00h, 59h, and > 0Ch are handled variously. The 00h differs from FreeDOS, and 59h is handled specifically in a different way. FreeDOS also detects function 30h. Should investigate if MS-DOS v5 also handles function 30h differently. |
Fixes #210, fixes #212, and fixes #213.
Tested both the gcc-ia16 and OpenWatcom 386 builds using my debugger, testkern (the fs/gs preserved on int 24h repeat check), testfill (just the TSR terminate return code 300h), and testabrt (abort a self-parented process and get return code 200h).
Copies of the more verbose commit messages:
rename byte [SDA + 25Ch] from _tsr to _term_type, fix int 24h rc
This fixes int 24h abort to set the return code to 200h. The ErrorMode misuse is apparently necessary, but was not sufficient to set the return code.
set byte [SDA + 39h] during process termination, turn abort to fail
This is compatible to lMS-DOS which sets the flag before running int 2Fh function 1122h 1 and clears it after closing handles and freeing memory 2, before branching to the Parent Return Address.
The flag turns any int 24h abort response into a fail instead, to avoid iterating infinitely during file handle closing.