Skip to content

Commit 811708f

Browse files
committed
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. [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
1 parent 4d30943 commit 811708f

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

kernel/entry.asm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ segment HMA_TEXT
4242
extern _ErrorMode
4343
extern _InDOS
4444
extern _term_type
45+
extern _abort_progress
4546
%IFDEF WIN31SUPPORT
4647
extern _winInstanced
4748
%ENDIF ; WIN31SUPPORT
@@ -742,6 +743,9 @@ CritErrExit:
742743
; Abort processing.
743744
;
744745
CritErrAbort:
746+
test byte [_abort_progress], -1
747+
mov al, FAIL
748+
jnz CritErrExit
745749
%if 0
746750
mov ax,[_cu_psp]
747751
mov es,ax

kernel/globals.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ extern BYTE
308308
ASM swap_always[], /* " " */
309309
ASM swap_indos[], /* " " */
310310
ASM term_type, /* 0 normal, 1 ^C, 2 int 24h, 3 TSR */
311+
ASM abort_progress, /* set during process termination */
311312
ASM break_flg, /* true if break was detected */
312313
ASM break_ena; /* break enabled flag */
313314
extern void FAR * ASM dta; /* Disk transfer area (kludge) */

kernel/kernel.asm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,7 @@ _DayOfWeek db 2 ; 36 - day of week
796796
_console_swap db 0 ; 37 console swapped during read from dev
797797
global _dosidle_flag
798798
_dosidle_flag db 1 ; 38 - safe to call int28 if nonzero
799+
global _abort_progress
799800
_abort_progress db 0 ; 39 - abort in progress
800801
global _CharReqHdr
801802
_CharReqHdr:

kernel/task.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,8 @@ VOID return_user(void)
588588
setvec(0x23, p->ps_isv23);
589589
setvec(0x24, p->ps_isv24);
590590

591+
abort_progress = -1;
592+
591593
/* And free all process memory if not a TSR return */
592594
network_redirector(REM_PROCESS_END);
593595
/* might be a good idea to do that after closing
@@ -607,6 +609,8 @@ VOID return_user(void)
607609
cu_psp = p->ps_parent;
608610
q = MK_FP(cu_psp, 0);
609611

612+
abort_progress = 0;
613+
610614
irp = (iregs FAR *) q->ps_stack;
611615

612616
irp->CS = FP_SEG(p->ps_isv22);

0 commit comments

Comments
 (0)