summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>2009-08-13 02:33:05 +0000
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>2009-08-13 02:33:05 +0000
commit0fac539f37c79acd4211e6afeb9a7904d81bbf58 (patch)
treed9eb9e420614a20522fc547b71e7601b736f0592
parentfd7544c6551ef7d4f1854d9646b3a7a86c667298 (diff)
downloadedk2-0fac539f37c79acd4211e6afeb9a7904d81bbf58.zip
edk2-0fac539f37c79acd4211e6afeb9a7904d81bbf58.tar.gz
edk2-0fac539f37c79acd4211e6afeb9a7904d81bbf58.tar.bz2
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
-rw-r--r--IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c b/IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/DebugLib.c
index 29639e9..339a002 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