From 0fac539f37c79acd4211e6afeb9a7904d81bbf58 Mon Sep 17 00:00:00 2001 From: eric_tian Date: Thu, 13 Aug 2009 02:33:05 +0000 Subject: [PATCH] recalculate the total size of format string printed by DebugPrint(). To ensure constructed BaseListMarker can work on IPF, code preserves 4bytes to guarantee it's 64bits alignment. So the calculation algorithm on total size also should be updated. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9062 6f19259b-4bc3-4df7-8a09-765794883524 --- .../PeiDxeDebugLibReportStatusCode/DebugLib.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c index 29639e9424..339a002cd5 100644 --- a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c +++ b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c @@ -68,9 +68,23 @@ DebugPrint ( } // - // Compute the total size of the record + // Compute the total size of the record. + // Note that the passing-in format string and variable parameters will be constructed to + // the following layout: // - TotalSize = sizeof (EFI_DEBUG_INFO) + 12 * sizeof (UINT64) + AsciiStrSize (Format); + // Buffer->|------------------------| + // | Pading | 4 bytes + // DebugInfo->|------------------------| + // | EFI_DEBUG_INFO | sizeof(EFI_DEBUG_INFO) + // BaseListMarker->|------------------------| + // | ... | + // | variable arguments | 12 * sizeof (UINT64) + // | ... | + // |------------------------| + // | Format String | + // |------------------------|<- (UINT8 *)Buffer + sizeof(Buffer) + // + TotalSize = 4 + sizeof (EFI_DEBUG_INFO) + 12 * sizeof (UINT64) + AsciiStrSize (Format); // // If the TotalSize is larger than the maximum record size, then return -- 2.39.2