On Wed, Nov 18, 2015 at 04:38:55PM +0100, Ard Biesheuvel wrote:
> The ARM_MEMORY_REGION_DESCRIPTOR array provided by the platform may
> contain entries that extend beyond the 4 GB boundary, above which
> we can't map anything on 32-bit ARM. If this is the case, map only
> the 1:1 addressable part.

Functionality-wise, it's good.
 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
> ---
>  ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c 
> b/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c
> index b2cfdba90049..4941c371f63f 100644
> --- a/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c
> +++ b/ArmPkg/Library/ArmLib/ArmV7/ArmV7Mmu.c
> @@ -147,8 +147,15 @@ FillTranslationTable (
>  {
>    UINT32  *SectionEntry;
>    UINT32  Attributes;
> -  UINT32  PhysicalBase = MemoryRegion->PhysicalBase;
> -  UINT32  RemainLength = MemoryRegion->Length;
> +  UINT32  PhysicalBase;
> +  UINT32  RemainLength;
> +
> +  if (MemoryRegion->PhysicalBase >= SIZE_4GB) {
> +    return;
> +  }
> +
> +  PhysicalBase = MemoryRegion->PhysicalBase;
> +  RemainLength = MIN(MemoryRegion->Length, SIZE_4GB - 
> MemoryRegion->PhysicalBase);

...but you can keep the line length down by just using PhysicalBase in
the line above.

>  
>    ASSERT(MemoryRegion->Length > 0);

And shouldn't this ASSERT remain at the very start of the function?

Adjust on check-in if you agree.
Reviewed-by: Leif Lindholm <leif.lindh...@linaro.org>

> 
> -- 
> 1.9.1
> 
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to