diff --git a/kernel/procsupt.asm b/kernel/procsupt.asm index b61c1da0..54d68576 100644 --- a/kernel/procsupt.asm +++ b/kernel/procsupt.asm @@ -320,7 +320,11 @@ reloc_call_call_p_0: int 21h mov ds,[cs:_DGROUP_] jc .L_1 + mov ah, 4dh ; get exit code + int 21h + push ax call _P_0_exit + pop ax jmp .L_2 .L_1: diff --git a/kernel/proto.h b/kernel/proto.h index 5436390e..e73d3cf6 100644 --- a/kernel/proto.h +++ b/kernel/proto.h @@ -448,7 +448,7 @@ struct int25regs; VOID ASMCFUNC SEGM(HMA_TEXT) int2526_handler(WORD mode,__FAR(struct int25regs) r); struct config; VOID ASMCFUNC SEGM(HMA_TEXT) P_0(__FAR(const struct config)Config); -VOID ASMCFUNC SEGM(HMA_TEXT) P_0_exit(void); +VOID ASMCFUNC SEGM(HMA_TEXT) P_0_exit(unsigned short retcode); VOID ASMCFUNC SEGM(HMA_TEXT) P_0_bad(void); struct int2f12regs; VOID ASMCFUNC SEGM(HMA_TEXT) int2F_12_handler(__FAR(struct int2f12regs) r); diff --git a/kernel/task.c b/kernel/task.c index 5e476295..35af7f6f 100644 --- a/kernel/task.c +++ b/kernel/task.c @@ -964,12 +964,16 @@ VOID ASMCFUNC P_0(const struct config FAR *Config) p0_execblk_p = exb; } -VOID ASMCFUNC P_0_exit(void) +VOID ASMCFUNC P_0_exit(unsigned short retcode) { - _printf("\nShell %s exited, press any key...\n", GET_PTR(Shell)); - con_flush_stdin(); - read_char_stdin(0); - fdexit(0); + if (retcode == 0) { + _printf("\nShell %s exited, press any key...\n", GET_PTR(Shell)); + con_flush_stdin(); + read_char_stdin(0); + } else { + _printf("\nShell %s exited with code 0x%x\n", GET_PTR(Shell), retcode); + } + fdexit(retcode & 0xff); } VOID ASMCFUNC P_0_bad(void)