X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FApplication%2FSmiHandlerProfileInfo%2FSmiHandlerProfileInfo.c;h=96e9977aad0ce8322c02f59d3566c07227f3f49b;hp=00cab0cd8e02de262085c9ec7aed6a1f22f09530;hb=f248539538efd522a71c1e9bf63c622e02d443f4;hpb=216b942d4d4795f5d919d43276d4f446190e5d35
diff --git a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
index 00cab0cd8e..96e9977aad 100644
--- a/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
+++ b/MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.c
@@ -245,7 +245,7 @@ GetShortPdbFileName (
2. FFS UI section
3. Image GUID
- @param[in] DriverInfo Pointer to memory profile driver info.
+ @param[in] ImageStruct Point to the image structure.
@return The resulting Ascii name string is stored in the mNameString global array.
@@ -266,8 +266,8 @@ GetDriverNameString (
//
// Method 1: Get the name string from image PDB
//
- if (ImageStruct->Header.Length > sizeof (SMM_CORE_IMAGE_DATABASE_STRUCTURE)) {
- GetShortPdbFileName ((CHAR8 *) (ImageStruct + 1), mNameString);
+ if (ImageStruct->PdbStringOffset != 0) {
+ GetShortPdbFileName ((CHAR8 *) ((UINTN) ImageStruct + ImageStruct->PdbStringOffset), mNameString);
return mNameString;
}
@@ -348,15 +348,17 @@ DumpSmmLoadedImage(
if (ImageStruct->Header.Signature == SMM_CORE_IMAGE_DATABASE_SIGNATURE) {
NameString = GetDriverNameString (ImageStruct);
Print(L" ImageBase, ImageStruct->ImageSize);
+ Print(L" Base=\"0x%lx\" Size=\"0x%lx\"", ImageStruct->ImageBase, ImageStruct->ImageSize);
if (ImageStruct->EntryPoint != 0) {
- Print(L" EntryPoint=\"0x%x\"", ImageStruct->EntryPoint);
+ Print(L" EntryPoint=\"0x%lx\"", ImageStruct->EntryPoint);
}
Print(L" FvFile=\"%g\"", &ImageStruct->FileGuid);
Print(L" RefId=\"0x%x\"", ImageStruct->ImageRef);
Print(L">\n");
- PdbString = (CHAR8 *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset);
- Print(L" %a\n", PdbString);
+ if (ImageStruct->PdbStringOffset != 0) {
+ PdbString = (CHAR8 *)((UINTN)ImageStruct + ImageStruct->PdbStringOffset);
+ Print(L" %a\n", PdbString);
+ }
Print(L" \n");
}
@@ -535,8 +537,10 @@ DumpSmiChildContext (
IN UINTN ContextSize
)
{
+ CHAR16 *Str;
+
if (CompareGuid (HandlerType, &gEfiSmmSwDispatch2ProtocolGuid)) {
- Print(L" SwSmi=\"0x%x\"", ((EFI_SMM_SW_REGISTER_CONTEXT *)Context)->SwSmiInputValue);
+ Print(L" SwSmi=\"0x%lx\"", ((SMI_HANDLER_PROFILE_SW_REGISTER_CONTEXT *)Context)->SwSmiInputValue);
} else if (CompareGuid (HandlerType, &gEfiSmmSxDispatch2ProtocolGuid)) {
Print(L" SxType=\"%a\"", SxTypeToString(((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Type));
Print(L" SxPhase=\"%a\"", SxPhaseToString(((EFI_SMM_SX_REGISTER_CONTEXT *)Context)->Phase));
@@ -555,7 +559,11 @@ DumpSmiChildContext (
Print(L" IoTrapType=\"%a\"", IoTrapTypeToString(((EFI_SMM_IO_TRAP_REGISTER_CONTEXT *)Context)->Type));
} else if (CompareGuid (HandlerType, &gEfiSmmUsbDispatch2ProtocolGuid)) {
Print(L" UsbType=\"0x%x\"", UsbTypeToString(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context)->Type));
- Print(L" UsbDevicePath=\"%s\"", ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL *)(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context) + 1), TRUE, TRUE));
+ Str = ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL *)(((SMI_HANDLER_PROFILE_USB_REGISTER_CONTEXT *)Context) + 1), TRUE, TRUE);
+ Print(L" UsbDevicePath=\"%s\"", Str);
+ if (Str != NULL) {
+ FreePool (Str);
+ }
} else {
Print(L" Context=\"");
InternalDumpData (Context, ContextSize);
@@ -601,14 +609,14 @@ DumpSmiHandler(
Print(L" %a\n", (UINT8 *)ImageStruct + ImageStruct->PdbStringOffset);
}
Print(L" \n");
- Print(L" \n", SmiHandlerStruct->Handler);
+ Print(L" \n", SmiHandlerStruct->Handler);
if (ImageStruct != NULL) {
- Print(L" 0x%x\n", SmiHandlerStruct->Handler - ImageStruct->ImageBase);
+ Print(L" 0x%x\n", (UINTN) (SmiHandlerStruct->Handler - ImageStruct->ImageBase));
}
Print(L" \n", SmiHandlerStruct->Handler);
- Print(L" \n", SmiHandlerStruct->CallerAddr);
+ Print(L" \n", SmiHandlerStruct->CallerAddr);
if (ImageStruct != NULL) {
- Print(L" 0x%x\n", SmiHandlerStruct->CallerAddr - ImageStruct->ImageBase);
+ Print(L" 0x%x\n", (UINTN) (SmiHandlerStruct->CallerAddr - ImageStruct->ImageBase));
}
Print(L" \n", SmiHandlerStruct->Handler);
SmiHandlerStruct = (VOID *)((UINTN)SmiHandlerStruct + SmiHandlerStruct->Length);