mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 05:22:57 +00:00
[NTVDM]
Fix the XMS driver. AH = 08h is supposed to return the size of the largest free block in AX, and the total amount of *free* memory in DX. svn path=/trunk/; revision=67675
This commit is contained in:
parent
c0e9ec7940
commit
367a28ce87
1 changed files with 24 additions and 2 deletions
|
@ -185,6 +185,28 @@ static inline PXMS_HANDLE GetHandleRecord(WORD Handle)
|
||||||
return Entry->Size ? Entry : NULL;
|
return Entry->Size ? Entry : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static WORD XmsGetLargestFreeBlock(VOID)
|
||||||
|
{
|
||||||
|
WORD Result = 0;
|
||||||
|
DWORD CurrentIndex = 0;
|
||||||
|
ULONG RunStart;
|
||||||
|
ULONG RunSize;
|
||||||
|
|
||||||
|
while (CurrentIndex < XMS_BLOCKS)
|
||||||
|
{
|
||||||
|
RunSize = RtlFindNextForwardRunClear(&AllocBitmap, CurrentIndex, &RunStart);
|
||||||
|
if (RunSize == 0) break;
|
||||||
|
|
||||||
|
/* Update the maximum */
|
||||||
|
if (RunSize > Result) Result = RunSize;
|
||||||
|
|
||||||
|
/* Go to the next run */
|
||||||
|
CurrentIndex = RunStart + RunSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
|
||||||
static CHAR XmsAlloc(WORD Size, PWORD Handle)
|
static CHAR XmsAlloc(WORD Size, PWORD Handle)
|
||||||
{
|
{
|
||||||
BYTE i;
|
BYTE i;
|
||||||
|
@ -380,8 +402,8 @@ static VOID WINAPI XmsBopProcedure(LPWORD Stack)
|
||||||
/* Query Free Extended Memory */
|
/* Query Free Extended Memory */
|
||||||
case 0x08:
|
case 0x08:
|
||||||
{
|
{
|
||||||
setAX(FreeBlocks);
|
setAX(XmsGetLargestFreeBlock());
|
||||||
setDX(XMS_BLOCKS);
|
setDX(FreeBlocks);
|
||||||
setBL(XMS_STATUS_SUCCESS);
|
setBL(XMS_STATUS_SUCCESS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue