From d72bc455ab4974e570a9d91e0709b3ddf477ac1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Sat, 8 Aug 2015 17:27:23 +0000 Subject: [PATCH] [NTVDM]: Addendum to r68609 (explicitely mention that the CS segment is the one of the caller). Add a debug print. svn path=/trunk/; revision=68638 --- reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c index ed04a7ca511..a3d6cf3ee07 100644 --- a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c +++ b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c @@ -182,7 +182,10 @@ static BOOLEAN DosControlBreak(VOID) VOID WINAPI DosInt20h(LPWORD Stack) { - /* This is the exit interrupt */ + /* + * This is the exit interrupt (alias to INT 21h, AH=00h). + * CS must be the PSP segment. + */ DosTerminateProcess(Stack[STACK_CS], 0, 0); } @@ -204,6 +207,7 @@ VOID WINAPI DosInt21h(LPWORD Stack) /* Terminate Program */ case 0x00: { + /* CS must be the PSP segment */ DosTerminateProcess(Stack[STACK_CS], 0, 0); break; } @@ -563,6 +567,7 @@ VOID WINAPI DosInt21h(LPWORD Stack) /* Create New PSP */ case 0x26: { + /* DOS 2+ assumes that the caller's CS is the segment of the PSP to copy */ DosClonePsp(getDX(), Stack[STACK_CS]); break; } @@ -2096,7 +2101,11 @@ VOID WINAPI DosAbsoluteWrite(LPWORD Stack) VOID WINAPI DosInt27h(LPWORD Stack) { - DosTerminateProcess(Stack[STACK_CS], 0, (getDX() + 0x0F) >> 4); + WORD KeepResident = (getDX() + 0x0F) >> 4; + + /* Terminate and Stay Resident. CS must be the PSP segment. */ + DPRINT1("Process going resident: %u paragraphs kept\n", KeepResident); + DosTerminateProcess(Stack[STACK_CS], 0, KeepResident); } VOID WINAPI DosIdle(LPWORD Stack)