protected void ProcessSoftwareEntry(SoftwarePageTableEntry spte, ulong virtualAddress) { if (spte.Entry == 0) { return; } if (spte.IsTransition && !spte.IsPrototype) { AddressRecord ar = new AddressRecord(); ar.VirtualAddress = virtualAddress; ar.PhysicalAddress = spte.RealEntry; ar.Size = 0x1000; ar.Flags = spte.Flags; _translationLookasideBuffer.Add(ar); } else { AddressRecord ar = new AddressRecord(); ar.VirtualAddress = virtualAddress; ar.PhysicalAddress = spte.Entry; // full original entry ar.Size = 0x1000; ar.Flags = spte.Flags; ar.IsSoftware = true; _translationLookasideBuffer.Add(ar); } }
protected void ProcessLargePdeEntry(LargePageDirectoryEntry lpde, ulong virtualAddress) { AddressRecord ar = new AddressRecord(); ar.VirtualAddress = virtualAddress; ar.PhysicalAddress = lpde.RealEntry; ar.Size = 0x200000; ar.Flags = lpde.Flags; _translationLookasideBuffer.Add(ar); }
protected void ProcessPteEntry(PageTableEntry pte, ulong virtualAddress) { AddressRecord ar = new AddressRecord(); ar.VirtualAddress = virtualAddress; ar.PhysicalAddress = pte.RealEntry; ar.Size = 0x1000; ar.Flags = pte.Flags; _translationLookasideBuffer.Add(ar); }
protected List <AddressRecord> BuildMemoryMap(ulong startAddress, ulong endAddress) { List <AddressRecord> memoryRecords = new List <AddressRecord>(); PopulateTlb(startAddress, endAddress); UInt64 contiguousVOffset = 0; UInt64 contiguousPOffset = 0; UInt32 totalLength = 0; if (_translationLookasideBuffer == null) { return(null); } uint lastFlag = _translationLookasideBuffer[0].Flags; foreach (AddressRecord ar in _translationLookasideBuffer) { if (ar.IsSoftware) { memoryRecords.Add(ar); continue; } if (ar.VirtualAddress == contiguousVOffset + totalLength && ar.PhysicalAddress == contiguousPOffset + totalLength) { totalLength += ar.Size; lastFlag = ar.Flags; } else { if (totalLength > 0) { AddressRecord ar2 = new AddressRecord(); ar2.VirtualAddress = contiguousVOffset; ar2.PhysicalAddress = contiguousPOffset; ar2.Size = totalLength; ar2.Flags = lastFlag; memoryRecords.Add(ar2); } contiguousPOffset = ar.PhysicalAddress; contiguousVOffset = ar.VirtualAddress; totalLength = ar.Size; lastFlag = ar.Flags; } } if (totalLength > 0) { AddressRecord ar2 = new AddressRecord(); ar2.VirtualAddress = contiguousVOffset; ar2.PhysicalAddress = contiguousPOffset; ar2.Size = totalLength; ar2.Flags = lastFlag; memoryRecords.Add(ar2); } return(memoryRecords); }