summaryrefslogtreecommitdiff
path: root/edk2/ShellPkg/Application
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-13 23:05:08 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-10-13 23:05:08 +0000
commitb60d0207d5ce67e1038c0485478cd2dd69482fec (patch)
treef448c4e066611129444875aa159108403368bd43 /edk2/ShellPkg/Application
parent08a4f751f579caf7325836be7a6a2eb18728f514 (diff)
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@12536 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'edk2/ShellPkg/Application')
-rw-r--r--edk2/ShellPkg/Application/Shell/ShellParametersProtocol.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.c b/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.c
index 02606d615..5beaadab2 100644
--- a/edk2/ShellPkg/Application/Shell/ShellParametersProtocol.c
+++ b/edk2/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);
}
/**