\r
#define BYTES_PER_RECORD 512\r
\r
+/**\r
+ Extracts ASSERT() information from a status code structure.\r
+\r
+ Converts the status code specified by CodeType, Value, and Data to the ASSERT()\r
+ arguments specified by Filename, Description, and LineNumber. If CodeType is \r
+ an EFI_ERROR_CODE, and CodeType has a severity of EFI_ERROR_UNRECOVERED, and \r
+ Value has an operation mask of EFI_SW_EC_ILLEGAL_SOFTWARE_STATE, extract \r
+ Filename, Description, and LineNumber from the optional data area of the \r
+ status code buffer specified by Data. The optional data area of Data contains \r
+ a Null-terminated ASCII string for the FileName, followed by a Null-terminated \r
+ ASCII string for the Description, followed by a 32-bit LineNumber. If the \r
+ ASSERT() information could be extracted from Data, then return TRUE. \r
+ Otherwise, FALSE is returned. \r
+\r
+ If Data is NULL, then ASSERT().\r
+ If Filename is NULL, then ASSERT().\r
+ If Description is NULL, then ASSERT().\r
+ If LineNumber is NULL, then ASSERT().\r
+\r
+ @param CodeType The type of status code being converted.\r
+ @param Value The status code value being converted.\r
+ @param Data Pointer to status code data buffer. \r
+ @param Filename Pointer to the source file name that generated the ASSERT().\r
+ @param Description Pointer to the description of the ASSERT().\r
+ @param LineNumber Pointer to source line number that generated the ASSERT().\r
+\r
+ @retval TRUE The status code specified by CodeType, Value, and Data was \r
+ converted ASSERT() arguments specified by Filename, Description, \r
+ and LineNumber.\r
+ @retval FALSE The status code specified by CodeType, Value, and Data could \r
+ not be converted to ASSERT() arguments.\r
+\r
+**/\r
+STATIC\r
+BOOLEAN\r
+ReportStatusCodeExtractAssertInfo (\r
+ IN EFI_STATUS_CODE_TYPE CodeType,\r
+ IN EFI_STATUS_CODE_VALUE Value, \r
+ IN CONST EFI_STATUS_CODE_DATA *Data, \r
+ OUT CHAR8 **Filename,\r
+ OUT CHAR8 **Description,\r
+ OUT UINT32 *LineNumber\r
+ )\r
+{\r
+ EFI_DEBUG_ASSERT_DATA *AssertData;\r
+\r
+ ASSERT (Data != NULL);\r
+ ASSERT (Filename != NULL);\r
+ ASSERT (Description != NULL);\r
+ ASSERT (LineNumber != NULL);\r
+\r
+ if (((CodeType & EFI_STATUS_CODE_TYPE_MASK) == EFI_ERROR_CODE) && \r
+ ((CodeType & EFI_STATUS_CODE_SEVERITY_MASK) == EFI_ERROR_UNRECOVERED) &&\r
+ ((Value & EFI_STATUS_CODE_OPERATION_MASK) == EFI_SW_EC_ILLEGAL_SOFTWARE_STATE)) {\r
+ AssertData = (EFI_DEBUG_ASSERT_DATA *)(Data + 1);\r
+ *Filename = (CHAR8 *)(AssertData + 1);\r
+ *Description = *Filename + AsciiStrLen (*Filename) + 1;\r
+ *LineNumber = AssertData->LineNumber;\r
+ return TRUE;\r
+ }\r
+ return FALSE;\r
+}\r
+\r
EFI_STATUS\r
EFIAPI\r
SecPeiReportStatusCode (\r
//\r
// Compute Top Of Memory for Stack and PEI Core Allocations\r
//\r
- TopOfMemory = LargestRegion + ((LargestRegionSize) & (~15));\r
+ TopOfMemory = LargestRegion + LargestRegionSize;\r
\r
//\r
// Allocate 128KB for the Stack\r
//\r
- TopOfStack = (VOID *) (UINTN) (TopOfMemory - sizeof (EFI_PEI_STARTUP_DESCRIPTOR));\r
+ TopOfStack = (VOID *)((UINTN)TopOfMemory - sizeof (EFI_PEI_STARTUP_DESCRIPTOR) - CPU_STACK_ALIGNMENT);\r
+ TopOfStack = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);\r
TopOfMemory = TopOfMemory - STACK_SIZE;\r
\r
//\r