From 93e6fa1b012c75e5f4997437025c28d997008428 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Wed, 6 May 2015 23:06:28 +0000 Subject: [PATCH] [NTVDM] Implement EMS function AH = 59h (Get Expanded Memory Hardware Information). svn path=/trunk/; revision=67585 --- .../mvdm/ntvdm/dos/dos32krnl/emsdrv.c | 30 +++++++++++++++++++ .../mvdm/ntvdm/dos/dos32krnl/emsdrv.h | 9 ++++++ 2 files changed, 39 insertions(+) diff --git a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.c b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.c index 041bc02b470..32f132900bc 100644 --- a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.c +++ b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.c @@ -361,6 +361,36 @@ static VOID WINAPI EmsIntHandler(LPWORD Stack) break; } + /* Get Expanded Memory Hardware Information */ + case 0x59: + { + if (getAL() == 0x00) + { + PEMS_HARDWARE_INFO HardwareInfo = (PEMS_HARDWARE_INFO)SEG_OFF_TO_PTR(getES(), getDI()); + + /* Return the hardware information */ + HardwareInfo->RawPageSize = EMS_PAGE_SIZE >> 4; + HardwareInfo->AlternateRegSets = 0; + HardwareInfo->ContextAreaSize = sizeof(Mapping); + HardwareInfo->DmaRegisterSets = 0; + HardwareInfo->DmaChannelOperation = 0; + } + else if (getAL() == 0x01) + { + /* Same as function AH = 42h */ + setAH(EMS_STATUS_OK); + setBX(RtlNumberOfClearBits(&AllocBitmap)); + setDX(EmsTotalPages); + } + else + { + DPRINT1("Invalid subfunction %02X for EMS function AH = 59h\n", getAL()); + setAH(EMS_STATUS_UNKNOWN_FUNCTION); + } + + break; + } + default: { DPRINT1("EMS function AH = %02X NOT IMPLEMENTED\n", getAH()); diff --git a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.h b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.h index e3bf33b0046..0bfd52110cf 100644 --- a/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.h +++ b/reactos/subsystems/mvdm/ntvdm/dos/dos32krnl/emsdrv.h @@ -58,6 +58,15 @@ typedef struct _EMS_COPY_DATA USHORT DestSegment; } EMS_COPY_DATA, *PEMS_COPY_DATA; +typedef struct _EMS_HARDWARE_INFO +{ + WORD RawPageSize; + WORD AlternateRegSets; + WORD ContextAreaSize; + WORD DmaRegisterSets; + WORD DmaChannelOperation; +} EMS_HARDWARE_INFO, *PEMS_HARDWARE_INFO; + #pragma pack(pop) #endif