audk/ArmPkg/Drivers
Michael Kubacki 38ba4a64c5 ArmPkg/Drivers/CpuDxe: Use lower and upper attributes
GetNextEntryAttribute() is currently applying a 64-bit mask
(TT_ATTRIBUTES_MASK) to a 32-bit descriptor value (EntryType).
The original descriptor was 64 bits containing the upper and
lower attributes which are included in TT_ATTRIBUTES_MASK.

The PrevEntryAttribute parameter is also a UINT32, but passed to
PageAttributeToGcdAttribute() for a UINT64 parameter where the
function checks masks in the upper 32 bits of the integer value:

  PageAttributeToGcdAttribute (*PrevEntryAttribute)
  ...
  STATIC
  UINT64
  PageAttributeToGcdAttribute (
    IN UINT64  PageAttributes
    )
  ...
  if ((PageAttributes & (TT_PXN_MASK | TT_UXN_MASK)) != 0) {
    GcdAttributes |= EFI_MEMORY_XP;
  }
  ...
  #define TT_PXN_MASK  BIT53
  #define TT_UXN_MASK  BIT54  // EL1&0

This change removes UINT32 intermediary values. For EntryType,
eliminating an unncessary cast. For EntryAttribute, preserving the
upper and lower attributes for evaluation in
PageAttributeToGcdAttribute().

This also resolves the following compiler warning previously present
on Visual Studio for the assignment to the previously 32-bit local
variables.

  '=': conversion from 'UINT64' to 'UINT32', possible loss of data

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2023-11-28 19:10:19 +00:00
..
ArmCrashDumpDxe ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmGic ArmPkg: Fix ArmGicAcknowledgeInterrupt () for GICv3 2023-06-01 15:52:01 +00:00
ArmPciCpuIo2Dxe ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmPsciMpServicesDxe ArmPkg/ArmPsciMpServices: Add EFI_NOT_READY return 2023-10-18 09:00:09 +00:00
ArmScmiDxe ArmPkg/ArmScmiDxe: Fix the calculation of RequiredArraySize 2023-02-06 13:56:24 +00:00
CpuDxe ArmPkg/Drivers/CpuDxe: Use lower and upper attributes 2023-11-28 19:10:19 +00:00
CpuPei ArmPkg/CpuPei: Implement the memory attributes PPI 2023-06-26 09:11:53 +00:00
GenericWatchdogDxe ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
MmCommunicationDxe ArmPkg: MmCommunicationDxe: Update MM communicate `MessageLength` check 2022-01-27 02:16:17 +00:00
MmCommunicationPei ArmPkg: Apply Uncrustify to Non-Compliant Files 2023-07-03 14:29:32 +00:00
TimerDxe ArmPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00