In the CoreStartImage() function [MdeModulePkg/Core/Dxe/Image/Image.c], if the image entry point returns a failure code, then the DXE Core logs a helpful DEBUG_ERROR message, with the following format string:
"Error: Image at %11p start failed: %r\n" Do similarly in the SMM Core (update the message slightly). Cc: Ard Biesheuvel <ard.biesheu...@linaro.org> Cc: Eric Dong <eric.d...@intel.com> Cc: Hao A Wu <hao.a...@intel.com> Cc: Igor Mammedov <imamm...@redhat.com> Cc: Jian J Wang <jian.j.w...@intel.com> Cc: Jiewen Yao <jiewen....@intel.com> Cc: Jordan Justen <jordan.l.jus...@intel.com> Cc: Michael Kinney <michael.d.kin...@intel.com> Cc: Philippe Mathieu-Daudé <phi...@redhat.com> Cc: Ray Ni <ray...@intel.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1512 Signed-off-by: Laszlo Ersek <ler...@redhat.com> --- MdeModulePkg/Core/PiSmmCore/Dispatcher.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c index 9bec731e5312..76ee9e0b89cc 100644 --- a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c +++ b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c @@ -883,44 +883,50 @@ SmmDispatcher ( RemoveEntryList (&DriverEntry->ScheduledLink); REPORT_STATUS_CODE_WITH_EXTENDED_DATA ( EFI_PROGRESS_CODE, EFI_SOFTWARE_SMM_DRIVER | EFI_SW_PC_INIT_BEGIN, &DriverEntry->ImageHandle, sizeof (DriverEntry->ImageHandle) ); // // Cache state of SmmEntryPointRegistered before calling entry point // PreviousSmmEntryPointRegistered = gSmmCorePrivate->SmmEntryPointRegistered; // // For each SMM driver, pass NULL as ImageHandle // RegisterSmramProfileImage (DriverEntry, TRUE); PERF_START_IMAGE_BEGIN (DriverEntry->ImageHandle); Status = ((EFI_IMAGE_ENTRY_POINT)(UINTN)DriverEntry->ImageEntryPoint)(DriverEntry->ImageHandle, gST); PERF_START_IMAGE_END (DriverEntry->ImageHandle); if (EFI_ERROR(Status)){ + DEBUG (( + DEBUG_ERROR, + "Error: SMM image at %11p start failed: %r\n", + DriverEntry->SmmLoadedImage.ImageBase, + Status + )); UnregisterSmramProfileImage (DriverEntry, TRUE); SmmFreePages(DriverEntry->ImageBuffer, DriverEntry->NumberOfPage); // // Uninstall LoadedImage // Status = gBS->UninstallProtocolInterface ( DriverEntry->ImageHandle, &gEfiLoadedImageProtocolGuid, DriverEntry->LoadedImage ); if (!EFI_ERROR (Status)) { if (DriverEntry->LoadedImage->FilePath != NULL) { gBS->FreePool (DriverEntry->LoadedImage->FilePath); } gBS->FreePool (DriverEntry->LoadedImage); } Status = SmmUninstallProtocolInterface ( DriverEntry->SmmImageHandle, &gEfiLoadedImageProtocolGuid, &DriverEntry->SmmLoadedImage ); if (!EFI_ERROR(Status)) { -- 2.19.1.3.g30247aa5d201 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#54733): https://edk2.groups.io/g/devel/message/54733 Mute This Topic: https://groups.io/mt/71494208/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-