diff options
author | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-10-13 23:05:08 +0000 |
---|---|---|
committer | jcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-10-13 23:05:08 +0000 |
commit | cf6a8f1453bed5aca0ac32b4038c83ce62b77327 (patch) | |
tree | 06960caf73ca56b0401bdbefb60f8f22e37a4cc1 /ShellPkg/Application/Shell | |
parent | 7a95efda40f616117ffd86e338c8bafc287d8221 (diff) | |
download | edk2-platforms-cf6a8f1453bed5aca0ac32b4038c83ce62b77327.tar.xz |
ShellPkg: Set CRC value whenever changing a system table.
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
Diffstat (limited to 'ShellPkg/Application/Shell')
-rw-r--r-- | ShellPkg/Application/Shell/ShellParametersProtocol.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c b/ShellPkg/Application/Shell/ShellParametersProtocol.c index 02606d615b..5beaadab2e 100644 --- a/ShellPkg/Application/Shell/ShellParametersProtocol.c +++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c @@ -471,6 +471,31 @@ StripQuotes ( }
/**
+ Calcualte the 32-bit CRC in a EFI table using the service provided by the
+ gRuntime service.
+
+ @param Hdr Pointer to an EFI standard header
+
+**/
+VOID
+CalculateEfiHdrCrc (
+ IN OUT EFI_TABLE_HEADER *Hdr
+ )
+{
+ UINT32 Crc;
+
+ Hdr->CRC32 = 0;
+
+ //
+ // If gBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then
+ // Crc will come back as zero if we set it to zero here
+ //
+ Crc = 0;
+ gBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc);
+ Hdr->CRC32 = Crc;
+}
+
+/**
Funcion will replace the current StdIn and StdOut in the ShellParameters protocol
structure by parsing NewCommandLine. The current values are returned to the
user.
@@ -1039,6 +1064,8 @@ UpdateStdInStdOutStdErr( }
FreePool(CommandLineCopy);
+ CalculateEfiHdrCrc(&gST->Hdr);
+
if (gST->ConIn == NULL ||gST->ConOut == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
@@ -1112,6 +1139,8 @@ RestoreStdInStdOutStdErr ( gST->StandardErrorHandle = SystemTableInfo->ConErrHandle;
}
+ CalculateEfiHdrCrc(&gST->Hdr);
+
return (EFI_SUCCESS);
}
/**
|