mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
ArmPkg/ArmMmuLib: ASSERT ArmReplaceLiveTranslationEntry alignment
This commit is contained in:
parent
c24587e6bf
commit
9e2b1a158f
@ -755,12 +755,22 @@ ArmMmuBaseLibConstructor (
|
||||
)
|
||||
{
|
||||
extern UINT32 ArmReplaceLiveTranslationEntrySize;
|
||||
UINTN ArmReplaceLiveTranslationEntryEnd;
|
||||
VOID *Hob;
|
||||
|
||||
Hob = GetFirstGuidHob (&gArmMmuReplaceLiveTranslationEntryFuncGuid);
|
||||
if (Hob != NULL) {
|
||||
mReplaceLiveEntryFunc = *(ARM_REPLACE_LIVE_TRANSLATION_ENTRY *)GET_GUID_HOB_DATA (Hob);
|
||||
} else {
|
||||
ArmReplaceLiveTranslationEntryEnd = (UINTN)ArmReplaceLiveTranslationEntry + ArmReplaceLiveTranslationEntrySize;
|
||||
//
|
||||
// Align this routine to a log2 upper bound of its size, so that it is
|
||||
// guaranteed not to cross a page or block boundary
|
||||
// (see ArmMmuLibReplaceEntry.S).
|
||||
//
|
||||
ASSERT (IS_ALIGNED ((UINTN)ArmReplaceLiveTranslationEntry, 0x200));
|
||||
ASSERT (((UINTN)ArmReplaceLiveTranslationEntry >> EFI_PAGE_SHIFT) == ((ArmReplaceLiveTranslationEntryEnd - 1) >> EFI_PAGE_SHIFT));
|
||||
|
||||
//
|
||||
// The ArmReplaceLiveTranslationEntry () helper function may be invoked
|
||||
// with the MMU off so we have to ensure that it gets cleaned to the PoC
|
||||
|
@ -24,6 +24,7 @@ ArmMmuPeiLibConstructor (
|
||||
{
|
||||
extern UINT32 ArmReplaceLiveTranslationEntrySize;
|
||||
ARM_REPLACE_LIVE_TRANSLATION_ENTRY ArmReplaceLiveTranslationEntryFunc;
|
||||
UINTN ArmReplaceLiveTranslationEntryEnd;
|
||||
VOID *Hob;
|
||||
|
||||
EFI_FV_FILE_INFO FileInfo;
|
||||
@ -31,6 +32,16 @@ ArmMmuPeiLibConstructor (
|
||||
|
||||
ASSERT (FileHandle != NULL);
|
||||
|
||||
ArmReplaceLiveTranslationEntryEnd = (UINTN)ArmReplaceLiveTranslationEntry + ArmReplaceLiveTranslationEntrySize;
|
||||
|
||||
//
|
||||
// Align this routine to a log2 upper bound of its size, so that it is
|
||||
// guaranteed not to cross a page or block boundary
|
||||
// (see ArmMmuLibReplaceEntry.S).
|
||||
//
|
||||
ASSERT (IS_ALIGNED ((UINTN)ArmReplaceLiveTranslationEntry, 0x200));
|
||||
ASSERT (((UINTN)ArmReplaceLiveTranslationEntry >> EFI_PAGE_SHIFT) == ((ArmReplaceLiveTranslationEntryEnd - 1) >> EFI_PAGE_SHIFT));
|
||||
|
||||
Status = (*PeiServices)->FfsGetFileInfo (FileHandle, &FileInfo);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
@ -42,8 +53,7 @@ ArmMmuPeiLibConstructor (
|
||||
// when not executing in place.
|
||||
//
|
||||
if (((UINTN)FileInfo.Buffer <= (UINTN)ArmReplaceLiveTranslationEntry) &&
|
||||
((UINTN)FileInfo.Buffer + FileInfo.BufferSize >=
|
||||
(UINTN)ArmReplaceLiveTranslationEntry + ArmReplaceLiveTranslationEntrySize))
|
||||
((UINTN)FileInfo.Buffer + FileInfo.BufferSize >= ArmReplaceLiveTranslationEntryEnd))
|
||||
{
|
||||
DEBUG ((DEBUG_INFO, "ArmMmuLib: skipping cache maintenance on XIP PEIM\n"));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user