[NTOSKRNL] Round memory size up, "debug log" part

Assumed to better match actual physical RAM size.

CORE-12321
This commit is contained in:
Serge Gautherie 2018-02-03 00:19:18 +01:00 committed by Mark Jansen
parent 092c3710f2
commit 9ff9bd81c4
3 changed files with 11 additions and 6 deletions

View file

@ -1580,8 +1580,9 @@ Phase1InitializationDiscard(IN PVOID Context)
WINDOWS_NT_INFO_STRING,
&MsgEntry);
/* Get total RAM size */
Size = MmNumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024;
/* Get total RAM size, in MiB */
/* Round size up. Assumed to better match actual physical RAM size */
Size = ALIGN_UP_BY(MmNumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024);
/* Create the string */
StringBuffer = InitBuffer->VersionBuffer;

View file

@ -93,7 +93,8 @@ KdpGetMemorySizeInMBs(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
}
}
return NumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024;
/* Round size up. Assumed to better match actual physical RAM size */
return ALIGN_UP_BY(NumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024);
}
/* See also: kd64\kdinit.c */
@ -255,7 +256,8 @@ KdpInitDebugLog(PKD_DISPATCH_TABLE DispatchTable,
KeInitializeSpinLock(&KdpDebugLogSpinLock);
/* Display separator + ReactOS version at start of the debug log */
MemSizeMBs = MmNumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024;
/* Round size up. Assumed to better match actual physical RAM size */
MemSizeMBs = ALIGN_UP_BY(MmNumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024);
KdpPrintBanner(MemSizeMBs);
}
else if (BootPhase == 2)
@ -554,7 +556,8 @@ KdpScreenInit(PKD_DISPATCH_TABLE DispatchTable,
KeInitializeSpinLock(&KdpDmesgLogSpinLock);
/* Display separator + ReactOS version at start of the debug log */
MemSizeMBs = MmNumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024;
/* Round size up. Assumed to better match actual physical RAM size */
MemSizeMBs = ALIGN_UP_BY(MmNumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024);
KdpPrintBanner(MemSizeMBs);
}
else if (BootPhase == 2)

View file

@ -62,7 +62,8 @@ KdpGetMemorySizeInMBs(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
}
}
return NumberOfPhysicalPages * PAGE_SIZE / 1024 / 1024;
/* Round size up. Assumed to better match actual physical RAM size */
return ALIGN_UP_BY(NumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024);
}
/* See also: kd\kdio.c */