This adds a function (from DxeMain.c) that calculates and sets a CRC into a system table header and then calls the function in the 2 places where the shell changes the system table.
signed-off-by: jcarsey
reviewed-by: geekboy15a
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12536
6f19259b-4bc3-4df7-8a09-
765794883524
+/**\r
+ Calcualte the 32-bit CRC in a EFI table using the service provided by the\r
+ gRuntime service.\r
+\r
+ @param Hdr Pointer to an EFI standard header\r
+\r
+**/\r
+VOID\r
+CalculateEfiHdrCrc (\r
+ IN OUT EFI_TABLE_HEADER *Hdr\r
+ )\r
+{\r
+ UINT32 Crc;\r
+\r
+ Hdr->CRC32 = 0;\r
+\r
+ //\r
+ // If gBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then\r
+ // Crc will come back as zero if we set it to zero here\r
+ //\r
+ Crc = 0;\r
+ gBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc);\r
+ Hdr->CRC32 = Crc;\r
+}\r
+\r
/**\r
Funcion will replace the current StdIn and StdOut in the ShellParameters protocol\r
structure by parsing NewCommandLine. The current values are returned to the\r
/**\r
Funcion will replace the current StdIn and StdOut in the ShellParameters protocol\r
structure by parsing NewCommandLine. The current values are returned to the\r
}\r
FreePool(CommandLineCopy);\r
\r
}\r
FreePool(CommandLineCopy);\r
\r
+ CalculateEfiHdrCrc(&gST->Hdr);\r
+\r
if (gST->ConIn == NULL ||gST->ConOut == NULL) {\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
if (gST->ConIn == NULL ||gST->ConOut == NULL) {\r
return (EFI_OUT_OF_RESOURCES);\r
}\r
gST->StandardErrorHandle = SystemTableInfo->ConErrHandle;\r
}\r
\r
gST->StandardErrorHandle = SystemTableInfo->ConErrHandle;\r
}\r
\r
+ CalculateEfiHdrCrc(&gST->Hdr);\r
+\r
return (EFI_SUCCESS);\r
}\r
/**\r
return (EFI_SUCCESS);\r
}\r
/**\r