Skip to content

Commit

Permalink
ArmPkg/Drivers/CpuDxe: Avoid EntryType cast
Browse files Browse the repository at this point in the history
In a code review, we opted to eliminate as many casts as possible
in GetNextEntryAttribute() which includes the EntryType cast from
UINT64 to UINT32.

Signed-off-by: Michael Kubacki <[email protected]>
  • Loading branch information
makubacki committed Nov 21, 2023
1 parent f58b704 commit e42172f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ GetNextEntryAttribute (
UINTN Index;
UINT64 Entry;
UINT64 EntryAttribute; // MU_CHANGE: Use 64-bit entry value
UINT32 EntryType;
UINT64 EntryType; // MU_CHANGE: Remove EntryType cast
EFI_STATUS Status;
UINTN NumberOfDescriptors;
EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap;
Expand All @@ -167,11 +167,9 @@ GetNextEntryAttribute (
for (Index = 0; Index < EntryCount; Index++) {
Entry = TableAddress[Index];

// MU_CHANGE [BEGIN]: Add UINT32 cast
EntryType = (UINT32)(Entry & TT_TYPE_MASK);
EntryType = Entry & TT_TYPE_MASK; // MU_CHANGE: Remove EntryType cast
EntryAttribute = Entry & TT_ATTRIBUTES_MASK; // MU_CHANGE: Return all attributes from page table
// MU_CHANGE: Use 64-bit entry value
// MU_CHANGE [END]: Add UINT32 cast

// If Entry is a Table Descriptor type entry then go through the sub-level table
if ((EntryType == TT_TYPE_BLOCK_ENTRY) ||
Expand Down

0 comments on commit e42172f

Please sign in to comment.