mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-14 17:24:25 +02:00
ArmPkg/ArmMmuLib: ASSERT ArmReplaceLiveTranslationEntry alignment
This commit is contained in:
parent
3aee8784da
commit
584d13a2eb
@ -731,12 +731,22 @@ ArmMmuBaseLibConstructor (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
extern UINT32 ArmReplaceLiveTranslationEntrySize;
|
extern UINT32 ArmReplaceLiveTranslationEntrySize;
|
||||||
|
UINTN ArmReplaceLiveTranslationEntryEnd;
|
||||||
VOID *Hob;
|
VOID *Hob;
|
||||||
|
|
||||||
Hob = GetFirstGuidHob (&gArmMmuReplaceLiveTranslationEntryFuncGuid);
|
Hob = GetFirstGuidHob (&gArmMmuReplaceLiveTranslationEntryFuncGuid);
|
||||||
if (Hob != NULL) {
|
if (Hob != NULL) {
|
||||||
mReplaceLiveEntryFunc = *(ARM_REPLACE_LIVE_TRANSLATION_ENTRY *)GET_GUID_HOB_DATA (Hob);
|
mReplaceLiveEntryFunc = *(ARM_REPLACE_LIVE_TRANSLATION_ENTRY *)GET_GUID_HOB_DATA (Hob);
|
||||||
} else {
|
} 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
|
// The ArmReplaceLiveTranslationEntry () helper function may be invoked
|
||||||
// with the MMU off so we have to ensure that it gets cleaned to the PoC
|
// with the MMU off so we have to ensure that it gets cleaned to the PoC
|
||||||
|
@ -24,6 +24,7 @@ ArmMmuPeiLibConstructor (
|
|||||||
{
|
{
|
||||||
extern UINT32 ArmReplaceLiveTranslationEntrySize;
|
extern UINT32 ArmReplaceLiveTranslationEntrySize;
|
||||||
ARM_REPLACE_LIVE_TRANSLATION_ENTRY ArmReplaceLiveTranslationEntryFunc;
|
ARM_REPLACE_LIVE_TRANSLATION_ENTRY ArmReplaceLiveTranslationEntryFunc;
|
||||||
|
UINTN ArmReplaceLiveTranslationEntryEnd;
|
||||||
VOID *Hob;
|
VOID *Hob;
|
||||||
|
|
||||||
EFI_FV_FILE_INFO FileInfo;
|
EFI_FV_FILE_INFO FileInfo;
|
||||||
@ -31,6 +32,16 @@ ArmMmuPeiLibConstructor (
|
|||||||
|
|
||||||
ASSERT (FileHandle != NULL);
|
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);
|
Status = (*PeiServices)->FfsGetFileInfo (FileHandle, &FileInfo);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
@ -42,8 +53,7 @@ ArmMmuPeiLibConstructor (
|
|||||||
// when not executing in place.
|
// when not executing in place.
|
||||||
//
|
//
|
||||||
if (((UINTN)FileInfo.Buffer <= (UINTN)ArmReplaceLiveTranslationEntry) &&
|
if (((UINTN)FileInfo.Buffer <= (UINTN)ArmReplaceLiveTranslationEntry) &&
|
||||||
((UINTN)FileInfo.Buffer + FileInfo.BufferSize >=
|
((UINTN)FileInfo.Buffer + FileInfo.BufferSize >= ArmReplaceLiveTranslationEntryEnd))
|
||||||
(UINTN)ArmReplaceLiveTranslationEntry + ArmReplaceLiveTranslationEntrySize))
|
|
||||||
{
|
{
|
||||||
DEBUG ((DEBUG_INFO, "ArmMmuLib: skipping cache maintenance on XIP PEIM\n"));
|
DEBUG ((DEBUG_INFO, "ArmMmuLib: skipping cache maintenance on XIP PEIM\n"));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user