Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor debug print updates for DxePagingAuditTestApp #382

Merged
merged 3 commits into from
Dec 8, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,7 @@ ImageCodeSectionsRoDataSectionsXp (
BOOLEAN TestFailure;
UINT64 SectionStart;
UINT64 SectionEnd;
CHAR8 *PdbFileName;

DEBUG ((DEBUG_INFO, "%a Enter...\n", __FUNCTION__));

Expand Down Expand Up @@ -1243,6 +1244,15 @@ ImageCodeSectionsRoDataSectionsXp (
}

// Check PE/COFF image
PdbFileName = PeCoffLoaderGetPdbPointer (LoadedImage->ImageBase);
if (PdbFileName == NULL) {
DEBUG ((DEBUG_WARN, "%a Could not get name of image loaded at 0x%llx - 0x%llx...\n",
__func__,
(UINTN)LoadedImage->ImageBase,
(UINTN)LoadedImage->ImageBase + LoadedImage->ImageSize
));
}

DosHdr = (EFI_IMAGE_DOS_HEADER *)(UINTN)LoadedImage->ImageBase;
PeCoffHeaderOffset = 0;
if (DosHdr->e_magic == EFI_IMAGE_DOS_SIGNATURE) {
Expand All @@ -1260,7 +1270,8 @@ ImageCodeSectionsRoDataSectionsXp (

if (!IsLoadedImageSectionAligned (SectionAlignment, LoadedImage->ImageCodeType)) {
UT_LOG_ERROR (
"Image 0x%llx - 0x%llx is not aligned\n",
"Image %a: 0x%llx - 0x%llx is not aligned\n",
PdbFileName,
kuqin12 marked this conversation as resolved.
Show resolved Hide resolved
(UINTN)LoadedImage->ImageBase,
(UINTN)LoadedImage->ImageBase + LoadedImage->ImageSize
);
Expand All @@ -1287,7 +1298,8 @@ ImageCodeSectionsRoDataSectionsXp (
(EFI_IMAGE_SCN_CNT_INITIALIZED_DATA || EFI_IMAGE_SCN_CNT_UNINITIALIZED_DATA)) != 0))
{
UT_LOG_ERROR (
"Image Section 0x%llx-0x%llx contains code and data\n",
"Image %a: Section 0x%llx-0x%llx contains code and data\n",
PdbFileName,
SectionStart,
SectionEnd
);
Expand All @@ -1313,7 +1325,8 @@ ImageCodeSectionsRoDataSectionsXp (
{
if ((Attributes & EFI_MEMORY_RO) == 0) {
UT_LOG_ERROR (
"Image Section 0x%llx-0x%llx is not EFI_MEMORY_RO\n",
"Image %a: Section 0x%llx-0x%llx is not EFI_MEMORY_RO\n",
PdbFileName,
SectionStart,
SectionEnd
);
Expand All @@ -1322,7 +1335,8 @@ ImageCodeSectionsRoDataSectionsXp (
} else {
if ((Attributes & EFI_MEMORY_XP) == 0) {
UT_LOG_ERROR (
"Image Section 0x%llx-0x%llx is not EFI_MEMORY_XP\n",
"Image %a: Section 0x%llx-0x%llx is not EFI_MEMORY_XP\n",
PdbFileName,
SectionStart,
SectionEnd
);
Expand Down Expand Up @@ -1377,7 +1391,7 @@ BspStackIsXpAndHasGuardPage (
StackBase = (EFI_PHYSICAL_ADDRESS)((MemoryHob->AllocDescriptor.MemoryBaseAddress / EFI_PAGE_SIZE) * EFI_PAGE_SIZE);
StackLength = (EFI_PHYSICAL_ADDRESS)(EFI_PAGES_TO_SIZE (EFI_SIZE_TO_PAGES (MemoryHob->AllocDescriptor.MemoryLength)));

UT_LOG_INFO ("BSP stack located at 0x%llx - 0x%llx", StackBase, StackBase + StackLength);
UT_LOG_INFO ("BSP stack located at 0x%llx - 0x%llx\n", StackBase, StackBase + StackLength);

Attributes = 0;
Status = GetRegionCommonAccessAttributes (
Expand Down Expand Up @@ -1545,7 +1559,7 @@ DxePagingAuditTestAppEntryPoint (
);

if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_INFO, "%a Could not retrieve command line args!\n", __FUNCTION__));
DEBUG ((DEBUG_ERROR, "%a Could not retrieve command line args!\n", __FUNCTION__));
return EFI_PROTOCOL_ERROR;
}

Expand All @@ -1563,13 +1577,13 @@ DxePagingAuditTestAppEntryPoint (
}
} else {
if (StrnCmp (ShellParams->Argv[1], L"-h", MAX_CHARS_TO_READ) != 0) {
DEBUG ((DEBUG_INFO, "Invalid argument!\n"));
DEBUG ((DEBUG_ERROR, "Invalid argument!\n"));
}

DEBUG ((DEBUG_INFO, "-h : Print available flags\n"));
DEBUG ((DEBUG_INFO, "-d : Dump the page table files\n"));
DEBUG ((DEBUG_INFO, "-r : Run the application tests\n"));
DEBUG ((DEBUG_INFO, "NOTE: Combined flags (i.e. -rd) is not supported\n"));
Print (L"-h : Print available flags\n");
Print (L"-d : Dump the page table files\n");
Print (L"-r : Run the application tests\n");
Print (L"NOTE: Combined flags (i.e. -rd) is not supported\n");
}
}

Expand Down
Loading