1 ; SCCSID = @(#)proc.asm 1.1 85/04/10
2 TITLE IBMPROC
- process maintenance
6 ; Process related system calls and low level routines for DOS 2.X.
7 ; I/O specs are defined in DISPATCH.
17 ; Modification history:
19 ; Created: ARR 30 March 1983
24 ; get the appropriate segment definitions
28 CODE SEGMENT BYTE PUBLIC 'CODE'
29 ASSUME
SS:DOSGROUP
,CS:DOSGROUP
39 i_need CurrentPDB
,WORD
48 I_need EXTERR_LOCUS
,BYTE ; Extended Error Locus
50 SUBTTL $
WAIT - return previous process error
code
53 ; process control data
55 i_need exit_code
,WORD ; code of exit
61 ; AX has the exit code
63 ASSUME
DS:NOTHING
,ES:NOTHING
71 SUBTTL Terminate
and stay resident handler
74 ; Input: DX is an offset from CurrentPDB at which to
75 ; truncate the current block.
77 ; output: The current block is truncated (expanded) to be [DX+15]/16
78 ; paragraphs long. An exit is simulated via resetting CurrentPDB
79 ; and restoring the vectors.
81 procedure $Keep_process
,NEAR
82 ASSUME
DS:NOTHING
,ES:NOTHING
,SS:DOSGROUP
84 PUSH AX ; keep exit code around
85 MOV BYTE PTR [Exit_type
],Exit_keep_process
87 CMP DX,6h
; keep enough space around for system
88 JAE Keep_shrink
; info
94 invoke $SETBLOCK
; ignore return codes.
97 JC keep_done
; failed on modification
100 MOV DS:[PDB_block_len
],AX
104 JMP SHORT exit_inner
; and let abort take care of the rest
106 EndProc $Keep_process
108 procedure Stay_resident
,NEAR
109 ASSUME
DS:NOTHING
,ES:NOTHING
,SS:NOTHING
110 MOV AX,(Keep_process
SHL 8) + 0 ; Lower part is return code
117 EndProc Stay_resident
119 SUBTTL $EXIT
- return to parent process
130 ASSUME
DS:NOTHING
,ES:NOTHING
,SS:DOSGROUP
132 XCHG AH,BYTE PTR [DidCTRLC
]
134 MOV BYTE PTR [Exit_type
],exit_terminate
136 MOV BYTE PTR [Exit_type
],exit_ctrl_c
140 invoke get_user_stack
143 JMP SHORT abort_inner
146 BREAK <$ABORT
-- Terminate a process
>
149 ; user_CS:00 must point to valid program header block
151 ; Restore terminate and Cntrl-C addresses, flush buffers and transfer to
152 ; the terminate address
154 ; TO THE TERMINATE ADDRESS
156 procedure $ABORT
,NEAR
157 ASSUME
DS:NOTHING
,ES:NOTHING
160 MOV [exit_type
],exit_abort
163 ; abort_inner must have AL set as the exit code! The exit type is retrieved
164 ; from exit_type. Also, the PDB at user_CS needs to be correct as the one
165 ; that is terminating.
171 invoke Get_user_stack
172 MOV DS,[SI.user_CS
] ; set up old interrupts
176 MOV DI,addr_int_terminate
183 transfer reset_environment