[NTOS:KE] Explicitly use IOPM_SIZE for initializing the IO map, that is indeed also equal to PAGE_SIZE * 2 but is self-documented.

This commit is contained in:
Hermès Bélusca-Maïto 2019-11-24 22:56:55 +01:00
parent b2ca7d3ed9
commit 03a9ccce65
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
3 changed files with 8 additions and 8 deletions

View file

@ -75,12 +75,12 @@ KiInitMachineDependent(VOID)
// /* Allocate the IOPM save area */
// Ki386IopmSaveArea = ExAllocatePoolWithTag(PagedPool,
// PAGE_SIZE * 2,
// TAG('K', 'e', ' ', ' '));
// IOPM_SIZE,
// ' eK');
// if (!Ki386IopmSaveArea)
// {
// /* Bugcheck. We need this for V86/VDM support. */
// KeBugCheckEx(NO_PAGES_AVAILABLE, 2, PAGE_SIZE * 2, 0, 0);
// KeBugCheckEx(NO_PAGES_AVAILABLE, 2, IOPM_SIZE, 0, 0);
// }
}

View file

@ -590,12 +590,12 @@ KiInitializeKernel(IN PKPROCESS InitProcess,
/* Allocate the IOPM save area */
Ki386IopmSaveArea = ExAllocatePoolWithTag(PagedPool,
PAGE_SIZE * 2,
IOPM_SIZE,
' eK');
if (!Ki386IopmSaveArea)
{
/* Bugcheck. We need this for V86/VDM support. */
KeBugCheckEx(NO_PAGES_AVAILABLE, 2, PAGE_SIZE * 2, 0, 0);
KeBugCheckEx(NO_PAGES_AVAILABLE, 2, IOPM_SIZE, 0, 0);
}
}

View file

@ -668,8 +668,8 @@ Ke386CallBios(IN ULONG Int,
/* Make sure there's space for two IOPMs, then copy & clear the current */
ASSERT(((PKIPCR)KeGetPcr())->GDT[KGDT_TSS / 8].LimitLow >=
(0x2000 + IOPM_OFFSET - 1));
RtlCopyMemory(Ki386IopmSaveArea, &Tss->IoMaps[0].IoMap, PAGE_SIZE * 2);
RtlZeroMemory(&Tss->IoMaps[0].IoMap, PAGE_SIZE * 2);
RtlCopyMemory(Ki386IopmSaveArea, &Tss->IoMaps[0].IoMap, IOPM_SIZE);
RtlZeroMemory(&Tss->IoMaps[0].IoMap, IOPM_SIZE);
/* Save the old offset and base, and set the new ones */
OldOffset = Process->IopmOffset;
@ -681,7 +681,7 @@ Ke386CallBios(IN ULONG Int,
Ki386SetupAndExitToV86Mode(VdmTeb);
/* Restore IOPM */
RtlCopyMemory(&Tss->IoMaps[0].IoMap, Ki386IopmSaveArea, PAGE_SIZE * 2);
RtlCopyMemory(&Tss->IoMaps[0].IoMap, Ki386IopmSaveArea, IOPM_SIZE);
Process->IopmOffset = OldOffset;
Tss->IoMapBase = OldBase;