From 50f36e7cb3ec453ec9fe3c93cc5c8de747958036 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Fri, 5 Jun 2015 22:22:04 +0000 Subject: [PATCH] [NTVDM] - Implement the DOS idle interrupt. - Link to the parent's environment block by default in DosCreatePsp. - Fix INT 21h/36h (Get Free Space) to report 0xFFFF if the number of clusters is too high to fit in a word. svn path=/trunk/; revision=68028 --- .../subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c | 16 ++++++++++++++-- .../mvdm/ntvdm/dos/dos32krnl/process.c | 7 +++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c index 1405962b960..75a04fe7ea8 100644 --- a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c +++ b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/dos.c @@ -825,8 +825,8 @@ VOID WINAPI DosInt21h(LPWORD Stack) { setAX(LOWORD(SectorsPerCluster)); setCX(LOWORD(BytesPerSector)); - setBX(LOWORD(NumberOfFreeClusters)); - setDX(LOWORD(TotalNumberOfClusters)); + setBX(min(NumberOfFreeClusters, 0xFFFF)); + setDX(min(TotalNumberOfClusters, 0xFFFF)); } else { @@ -1873,6 +1873,15 @@ VOID WINAPI DosInt27h(LPWORD Stack) DosTerminateProcess(getCS(), 0, (getDX() + 0x0F) >> 4); } +VOID WINAPI DosIdle(LPWORD Stack) +{ + /* + * This will set the carry flag on the first call (to repeat the BOP), + * and clear it in the next, so that exactly one HLT occurs. + */ + setCF(!getCF()); +} + VOID WINAPI DosFastConOut(LPWORD Stack) { /* @@ -2070,10 +2079,13 @@ BOOLEAN DosKRNLInitialize(VOID) RegisterDosInt32(0x23, DosBreakInterrupt); // Ctrl-C / Ctrl-Break // RegisterDosInt32(0x24, DosInt24h ); // Critical Error RegisterDosInt32(0x27, DosInt27h ); // Terminate and Stay Resident + RegisterDosInt32(0x28, DosIdle ); // DOS Idle Interrupt RegisterDosInt32(0x29, DosFastConOut ); // DOS 2+ Fast Console Output RegisterDosInt32(0x2F, DosInt2Fh ); /* Unimplemented DOS interrupts */ + RegisterDosInt32(0x25, NULL); // Absolute Disk Read + RegisterDosInt32(0x26, NULL); // Absolute Disk Write RegisterDosInt32(0x2A, NULL); // Network - Installation Check /* Load the CON driver */ diff --git a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c index a5140777f4d..d1e22b1891e 100644 --- a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c +++ b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/process.c @@ -212,8 +212,11 @@ VOID DosCreatePsp(WORD Segment, WORD ProgramSize) /* Set the parent PSP */ PspBlock->ParentPsp = Sda->CurrentPsp; - /* No environment block yet */ - PspBlock->EnvBlock = 0; + if (Sda->CurrentPsp != SYSTEM_PSP) + { + /* Link to the parent's environment block */ + PspBlock->EnvBlock = SEGMENT_TO_PSP(Sda->CurrentPsp)->EnvBlock; + } /* Copy the parent handle table */ DosCopyHandleTable(PspBlock->HandleTable);