mirror of
https://github.com/acidanthera/audk.git
synced 2025-05-29 19:00:10 +02:00
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
This commit is contained in:
parent
7a95efda40
commit
cf6a8f1453
@ -470,6 +470,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
|
Funcion will replace the current StdIn and StdOut in the ShellParameters protocol
|
||||||
structure by parsing NewCommandLine. The current values are returned to the
|
structure by parsing NewCommandLine. The current values are returned to the
|
||||||
@ -1039,6 +1064,8 @@ UpdateStdInStdOutStdErr(
|
|||||||
}
|
}
|
||||||
FreePool(CommandLineCopy);
|
FreePool(CommandLineCopy);
|
||||||
|
|
||||||
|
CalculateEfiHdrCrc(&gST->Hdr);
|
||||||
|
|
||||||
if (gST->ConIn == NULL ||gST->ConOut == NULL) {
|
if (gST->ConIn == NULL ||gST->ConOut == NULL) {
|
||||||
return (EFI_OUT_OF_RESOURCES);
|
return (EFI_OUT_OF_RESOURCES);
|
||||||
}
|
}
|
||||||
@ -1112,6 +1139,8 @@ RestoreStdInStdOutStdErr (
|
|||||||
gST->StandardErrorHandle = SystemTableInfo->ConErrHandle;
|
gST->StandardErrorHandle = SystemTableInfo->ConErrHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CalculateEfiHdrCrc(&gST->Hdr);
|
||||||
|
|
||||||
return (EFI_SUCCESS);
|
return (EFI_SUCCESS);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user