mirror of
https://github.com/reactos/reactos.git
synced 2025-03-01 03:45:16 +00:00
[NTOS:KD64] Revamp the debugger banner helpers a little.
- Directly call KdpGetMemorySizeInMBs() within KdpPrintBanner(), instead of having the caller doing it. - Use the miarm.h MiIsMemoryTypeInvisible() helper. - Add Doxygen comments.
This commit is contained in:
parent
cb0c9a4570
commit
c53eb190c7
1 changed files with 24 additions and 23 deletions
|
@ -25,14 +25,15 @@
|
||||||
|
|
||||||
/* UTILITY FUNCTIONS *********************************************************/
|
/* UTILITY FUNCTIONS *********************************************************/
|
||||||
|
|
||||||
/*
|
#include <mm/ARM3/miarm.h> // For MiIsMemoryTypeInvisible()
|
||||||
* Get the total size of the memory before
|
|
||||||
* Mm is initialized, by counting the number
|
/**
|
||||||
* of physical pages. Useful for debug logging.
|
* @brief
|
||||||
|
* Retrieves the total size of the memory before Mm is initialized,
|
||||||
|
* by counting the number of physical pages. Useful for debug logging.
|
||||||
*
|
*
|
||||||
* Strongly inspired by:
|
* Adapted from mm/ARM3/mminit.c!MiScanMemoryDescriptors().
|
||||||
* mm\ARM3\mminit.c : MiScanMemoryDescriptors(...)
|
**/
|
||||||
*/
|
|
||||||
static
|
static
|
||||||
SIZE_T
|
SIZE_T
|
||||||
KdpGetMemorySizeInMBs(
|
KdpGetMemorySizeInMBs(
|
||||||
|
@ -63,20 +64,14 @@ KdpGetMemorySizeInMBs(
|
||||||
MEMORY_ALLOCATION_DESCRIPTOR,
|
MEMORY_ALLOCATION_DESCRIPTOR,
|
||||||
ListEntry);
|
ListEntry);
|
||||||
|
|
||||||
/* Check if this is invisible memory */
|
/* If this is invisible memory, skip this descriptor */
|
||||||
if ((Descriptor->MemoryType == LoaderFirmwarePermanent) ||
|
if (MiIsMemoryTypeInvisible(Descriptor->MemoryType))
|
||||||
(Descriptor->MemoryType == LoaderSpecialMemory) ||
|
|
||||||
(Descriptor->MemoryType == LoaderHALCachedMemory) ||
|
|
||||||
(Descriptor->MemoryType == LoaderBBTMemory))
|
|
||||||
{
|
|
||||||
/* Skip this descriptor */
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if this is bad memory */
|
/* Check if this isn't bad memory */
|
||||||
if (Descriptor->MemoryType != LoaderBad)
|
if (Descriptor->MemoryType != LoaderBad)
|
||||||
{
|
{
|
||||||
/* Count this in the total of pages */
|
/* Count it in the physical pages */
|
||||||
NumberOfPhysicalPages += Descriptor->PageCount;
|
NumberOfPhysicalPages += Descriptor->PageCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,10 +81,16 @@ ReturnSize:
|
||||||
return ALIGN_UP_BY(NumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024);
|
return ALIGN_UP_BY(NumberOfPhysicalPages * PAGE_SIZE, 1024 * 1024) / (1024 * 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief
|
||||||
|
* Displays the kernel debugger initialization banner.
|
||||||
|
**/
|
||||||
static
|
static
|
||||||
VOID
|
VOID
|
||||||
KdpPrintBanner(IN SIZE_T MemSizeMBs)
|
KdpPrintBanner(VOID)
|
||||||
{
|
{
|
||||||
|
SIZE_T MemSizeMBs = KdpGetMemorySizeInMBs(KeLoaderBlock);
|
||||||
|
|
||||||
DPRINT1("-----------------------------------------------------\n");
|
DPRINT1("-----------------------------------------------------\n");
|
||||||
DPRINT1("ReactOS " KERNEL_VERSION_STR " (Build " KERNEL_VERSION_BUILD_STR ") (Commit " KERNEL_VERSION_COMMIT_HASH ")\n");
|
DPRINT1("ReactOS " KERNEL_VERSION_STR " (Build " KERNEL_VERSION_BUILD_STR ") (Commit " KERNEL_VERSION_COMMIT_HASH ")\n");
|
||||||
DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs);
|
DPRINT1("%u System Processor [%u MB Memory]\n", KeNumberProcessors, MemSizeMBs);
|
||||||
|
@ -97,7 +98,9 @@ KdpPrintBanner(IN SIZE_T MemSizeMBs)
|
||||||
if (KeLoaderBlock)
|
if (KeLoaderBlock)
|
||||||
{
|
{
|
||||||
DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions);
|
DPRINT1("Command Line: %s\n", KeLoaderBlock->LoadOptions);
|
||||||
DPRINT1("ARC Paths: %s %s %s %s\n", KeLoaderBlock->ArcBootDeviceName, KeLoaderBlock->NtHalPathName, KeLoaderBlock->ArcHalDeviceName, KeLoaderBlock->NtBootPathName);
|
DPRINT1("ARC Paths: %s %s %s %s\n",
|
||||||
|
KeLoaderBlock->ArcBootDeviceName, KeLoaderBlock->NtHalPathName,
|
||||||
|
KeLoaderBlock->ArcHalDeviceName, KeLoaderBlock->NtBootPathName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +168,6 @@ KdInitSystem(
|
||||||
BOOLEAN EnableKd, DisableKdAfterInit = FALSE, BlockEnable = FALSE;
|
BOOLEAN EnableKd, DisableKdAfterInit = FALSE, BlockEnable = FALSE;
|
||||||
PLDR_DATA_TABLE_ENTRY LdrEntry;
|
PLDR_DATA_TABLE_ENTRY LdrEntry;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
SIZE_T MemSizeMBs;
|
|
||||||
|
|
||||||
/* Check if this is Phase 1 */
|
/* Check if this is Phase 1 */
|
||||||
if (BootPhase)
|
if (BootPhase)
|
||||||
|
@ -401,9 +403,8 @@ KdInitSystem(
|
||||||
/* Let user-mode know that it's enabled as well */
|
/* Let user-mode know that it's enabled as well */
|
||||||
SharedUserData->KdDebuggerEnabled = TRUE;
|
SharedUserData->KdDebuggerEnabled = TRUE;
|
||||||
|
|
||||||
/* Display separator + ReactOS version at start of the debug log */
|
/* Display separator + ReactOS version at the start of the debug log */
|
||||||
MemSizeMBs = KdpGetMemorySizeInMBs(KeLoaderBlock);
|
KdpPrintBanner();
|
||||||
KdpPrintBanner(MemSizeMBs);
|
|
||||||
|
|
||||||
/* Check if the debugger should be disabled initially */
|
/* Check if the debugger should be disabled initially */
|
||||||
if (DisableKdAfterInit)
|
if (DisableKdAfterInit)
|
||||||
|
|
Loading…
Reference in a new issue