mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
OvmfPkg/EmuVariableFvbRuntimeDxe: avoid accessing varstore header with cmp
Use explicit MmioReadXX() calls to enforce use of instructions supported by #VC exception handler emulator. Does also work in case the varstore header is located in RAM or ROM because x86 has no special mmio instructions and non-x86 architectures do not use this code. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
a9309b6589
commit
0917ddad25
1 changed files with 5 additions and 4 deletions
|
|
@ -26,6 +26,7 @@
|
|||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/PlatformFvbLib.h>
|
||||
#include <Library/IoLib.h>
|
||||
#include "Fvb.h"
|
||||
|
||||
#define EFI_AUTHENTICATED_VARIABLE_GUID \
|
||||
|
|
@ -572,10 +573,10 @@ ValidateFvHeader (
|
|||
// Length of FvBlock cannot be 2**64-1
|
||||
// HeaderLength cannot be an odd number
|
||||
//
|
||||
if ((FwVolHeader->Revision != EFI_FVH_REVISION) ||
|
||||
(FwVolHeader->Signature != EFI_FVH_SIGNATURE) ||
|
||||
(FwVolHeader->FvLength != EMU_FVB_SIZE) ||
|
||||
(FwVolHeader->HeaderLength != EMU_FV_HEADER_LENGTH)
|
||||
if ((MmioRead8 ((UINTN)(&FwVolHeader->Revision)) != EFI_FVH_REVISION) ||
|
||||
(MmioRead32 ((UINTN)(&FwVolHeader->Signature)) != EFI_FVH_SIGNATURE) ||
|
||||
(MmioRead64 ((UINTN)(&FwVolHeader->FvLength)) != EMU_FVB_SIZE) ||
|
||||
(MmioRead16 ((UINTN)(&FwVolHeader->HeaderLength)) != EMU_FV_HEADER_LENGTH)
|
||||
)
|
||||
{
|
||||
DEBUG ((DEBUG_INFO, "EMU Variable FVB: Basic FV headers were invalid\n"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue