From 737dd930e77c9939e8a52af6d0e30bb7bf80a022 Mon Sep 17 00:00:00 2001 From: Mike Beaton Date: Mon, 29 Apr 2024 08:47:09 +0100 Subject: [PATCH] CrScreenshotDxe: Work around TPL-related ASSERT within firmware compiled to assert (#539) (such as recently updated DEBUG version of OpenDuet) --- Platform/CrScreenshotDxe/CrScreenshotDxe.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Platform/CrScreenshotDxe/CrScreenshotDxe.c b/Platform/CrScreenshotDxe/CrScreenshotDxe.c index 71f8c16c..558b1a63 100644 --- a/Platform/CrScreenshotDxe/CrScreenshotDxe.c +++ b/Platform/CrScreenshotDxe/CrScreenshotDxe.c @@ -166,6 +166,16 @@ TakeScreenshot ( UINTN Index; UINT8 Temp; + // + // This is required to avoid assert (only noticeable on firmware compiled to + // assert) from gBS->RaiseTPL(TPL_CALLBACK) within the file system accesses + // below. Makes explicit what was happening anyway, which is that we're + // effectively lowering the TPL for a long running task, during a keyboard + // interrupt. + // REF: https://github.com/acidanthera/audk/blob/bcdcc4160d7460c46c08c9395aae81be44ef23a9/FatPkg/EnhancedFatDxe/Misc.c#L399 + // + gBS->RestoreTPL (TPL_CALLBACK); + Status = OcFindWritableOcFileSystem (&Fs); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_INFO, "OCSCR: Can't find writable FS - %r\n", Status));