/* Get the leaf entry for a given linear address from one entry in page table */
UINT64 GetEntryFromSubPageTable(IN IA32_PAGING_ENTRY *PagingEntry, IN OUT UINTN *Level, IN UINTN MaxLeafLevel, IN UINT64 Address)
/* Get the leaf entry for a given linear address from one entry in page table */
UINT64 GetEntryFromSubPageTable(IN IA32_PAGING_ENTRY *PagingEntry, IN OUT UINTN *Level, IN UINTN MaxLeafLevel, IN UINT64 Address)
{
  UINT64             Index;
  IA32_PAGING_ENTRY  *ChildPageEntry;
  if (PagingEntry->Pce.Present == 0) {
    return 0;
  }
  if ((PagingEntry->Uint64 & mValidMaskLeafFlag[*Level].Uint64) == mValidMaskLeafFlag[*Level].Uint64) {
    return PagingEntry->Uint64;
  }
  ChildPageEntry = (IA32_PAGING_ENTRY  *)(UINTN)(IA32_PNLE_PAGE_TABLE_BASE_ADDRESS (&PagingEntry->Pnle));
  *Level         = *Level -1;
  Index          = Address >> (*Level * 9 + 3);
  ASSERT (Index == (Index & ((1<< 9) - 1)));
  return GetEntryFromSubPageTable (&ChildPageEntry[Index], Level, MaxLeafLevel, Address - (Index << (9 * *Level + 3)));
}