Thanks Siva for the report, you are right.

I have just pushed a fix in rev 14771 that should fix this defect.

 

Thanks again,

Olivier

 

From: Sivasakthivel Nainar [mailto:sivasakthiv...@ami.com] 
Sent: 08 October 2013 00:20
To: edk2-devel@lists.sourceforge.net; Olivier Martin
Subject: AARCH64 MMU Translation table walking

 

HI Olivier, 

  ArmPkg\Drivers\CpuDxe\AArch64\Mmu.c  has the code to  find the  memory
type programmed for the given  region. 

 

Equates are defined in AARch64mmu.h

#define TT_TYPE_MASK                            0x3

#define TT_TYPE_TABLE_ENTRY                     0x3

#define TT_TYPE_BLOCK_ENTRY                     0x1

#define TT_TYPE_BLOCK_ENTRY_LEVEL3              0x3

 

 

 

 

In the below code,  If   level  3 table,  Blockentrytype = 3.  Since this
entry type  satisfies (EntryType == TT_TYPE_TABLE_ENTRY) condition,  It
will try to call the   GetMemoryRegionRec()  again instead . Do we need
another condition to make it  reach the else part?

 

In other words,  How to handle the situation (EntryType ==
TT_TYPE_TABLE_ENTRY) = TRUE and  (EntryType == BlockEntryType) = TRUE

 

 

Thanks
Siva

 

   

 

ArmPkg\Drivers\CpuDxe\AArch64\Mmu.c   code snippet 

 

 

 

  if (TableLevel != 3) {

    BlockEntryType = TT_TYPE_BLOCK_ENTRY;

  } else {

    BlockEntryType = TT_TYPE_BLOCK_ENTRY_LEVEL3;

  }

 

  // Find the block entry linked to the Base Address

  BlockEntry = (UINT64*)TT_GET_ENTRY_FOR_ADDRESS (TranslationTable,
TableLevel, *BaseAddress);

  EntryType = *BlockEntry & TT_TYPE_MASK;

 

  if (EntryType == TT_TYPE_TABLE_ENTRY) {

    NextTranslationTable = (UINT64*)(*BlockEntry &
TT_ADDRESS_MASK_DESCRIPTION_TABLE);

 

    // The entry is a page table, so we go to the next level

    Status = GetMemoryRegionRec (

        NextTranslationTable, // Address of the next level page table

        TableLevel + 1, // Next Page Table level

        (UINTN*)TT_LAST_BLOCK_ADDRESS(NextTranslationTable, TT_ENTRY_COUNT),

        BaseAddress, RegionLength, RegionAttributes);

 

    // In case of 'Success', it means the end of the block region has been
found into the upper

    // level translation table

    if (!EFI_ERROR(Status)) {

      return EFI_SUCCESS;

    }

  } else if (EntryType == BlockEntryType) {

    // We have found the BlockEntry attached to the address. We save its
start address (the start

    // address might be before the 'BaseAdress') and attributes

    *BaseAddress      = *BaseAddress & ~(TT_ADDRESS_AT_LEVEL(TableLevel) -
1);

    *RegionLength     = 0;

    *RegionAttributes = *BlockEntry & TT_ATTRIBUTES_MASK;

  } else {

    // We have an 'Invalid' entry

    return EFI_UNSUPPORTED;

  }

The information contained in this message may be confidential and
proprietary to American Megatrends, Inc. This communication is intended to
be read only by the individual or entity to whom it is addressed or by their
designee. If the reader of this message is not the intended recipient, you
are on notice that any distribution of this message, in any form, is
strictly prohibited. Please promptly notify the sender by reply e-mail or by
telephone at 770-246-8600, and then delete or destroy all copies of the
transmission.
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to