15#define MODULE_INVOLVED_IN_ARM3
44 PMMPTE PointerPte, LastPte;
52 LastPte = PointerPte + PageCount;
62 }
while (++PointerPte < LastPte);
93 if (++UnprotectedPages == PageCount)
break;
113 *PoolFlink = *PoolBlink =
NULL;
119 PoolVa = Links->Flink;
123 if (Safe) *PoolFlink = PoolVa;
127 if (Links != Links->Blink)
130 PoolVa = Links->Blink;
134 if (Safe) *PoolBlink = PoolVa;
154 PVOID PoolFlink, PoolBlink;
170 PVOID PoolFlink, PoolBlink;
335 FirstEntry = FreeEntry;
336 FreeEntry->
Size = PoolPages;
338 FreeEntry->
Owner = FirstEntry;
349 while (PoolPages-- > 1)
355 FreeEntry->
Owner = FirstEntry;
430 PMMPTE PointerPte, StartPte;
436 PVOID BaseVa, BaseVaStart;
447 if (SizeInPages == 0)
466 if (BaseVa)
return BaseVa;
486 DPRINT(
"Paged pool expansion: %lu %x\n",
i, SizeInPages);
497 DPRINT1(
"FAILED to allocate %Iu bytes from paged pool\n", SizeInBytes);
512 PageTableCount = (
PFN_COUNT)(PointerPde + 1 -
535 BaseVaStart = BaseVa;
553#if (_MI_PAGING_LEVELS >= 3)
618 DPRINT1(
"FAILED to allocate %Iu bytes from paged pool\n", SizeInBytes);
633 EndAllocation =
i + SizeInPages - 1;
658 StartPte = PointerPte + SizeInPages;
665 }
while (++PointerPte < StartPte);
679 if (BaseVa)
return BaseVa;
702 NextEntry = NextHead->
Flink;
703 while (NextEntry != NextHead)
717 if (FreeEntry->
Size >= SizeInPages)
722 FreeEntry->
Size -= SizeInPages;
739 if (FreeEntry->
Size != 0)
773 Pfn1->
u3.
e1.StartOfAllocation = 1;
785 if (SizeInPages != 1)
790 PointerPte += SizeInPages - 1;
799 Pfn1->
u3.
e1.EndOfAllocation = 1;
820 }
while (++NextHead < LastHead);
832 PointerPte = StartPte;
833 if (StartPte ==
NULL)
838 DPRINT(
"Out of NP Expansion Pool\n");
850 MiAcquirePfnLockAtDpcLevel();
855 MiReleasePfnLockFromDpcLevel();
878 Pfn1->
u3.
e2.ReferenceCount = 1;
887 }
while (--SizeInPages > 0);
892 Pfn1->
u3.
e1.EndOfAllocation = 1;
898 Pfn1->
u3.
e1.StartOfAllocation = 1;
907 MiReleasePfnLockFromDpcLevel();
920 PMMPTE PointerPte, StartPte;
951 NumberOfPages = End -
i + 1;
952 if ((NumberOfPages == 1) &&
962 ASSERT(FreePages == NumberOfPages);
988 return NumberOfPages;
998 if ((Pfn1->
u3.
e1.EndOfAllocation == 1) &&
1008 while (Pfn1->
u3.
e1.EndOfAllocation == 0)
1020 NumberOfPages = (
PFN_COUNT)(PointerPte - StartPte + 1);
1030 StartPfn->
u3.
e1.StartOfAllocation = 0;
1031 Pfn1->
u3.
e1.EndOfAllocation = 0;
1036 FreePages = NumberOfPages;
1091 if ((Pfn1) && (Pfn1->
u3.
e1.StartOfAllocation == 0))
1102 FreePages += FreeEntry->
Size;
1114 FreeEntry = StartingVa;
1131 PointerPte -= NumberOfPages + 1;
1162 if ((Pfn1) && (Pfn1->
u3.
e1.EndOfAllocation == 0))
1169 FreeEntry = FreeEntry->
Owner;
1194 FreeEntry->
Size += FreePages;
1212 FreeEntry->
Size += FreePages;
1219 if (FreeEntry == StartingVa)
1225 FreeEntry->
Size = FreePages;
1248 NextEntry = StartingVa;
1255 NextEntry->
Owner = FreeEntry;
1258 }
while (NextEntry != LastEntry);
1271 return NumberOfPages;
1278 PMMPTE PointerPte, LastPte;
1279 PMMPDE PointerPde, LastPde;
1303 DPRINT1(
"Session Pool Start: 0x%p End: 0x%p\n",
1325 PdeCount = LastPde - PointerPde;
1349 BitmapSize =
sizeof(
RTL_BITMAP) + ((PoolSize + 31) / 32) *
sizeof(
ULONG);
1440 DPRINT1(
"MmRaisePoolQuota(): Failed to increase pool quota, not enough non paged pool space (current size -- %lu || allocated size -- %lu)\n",
1448 DPRINT1(
"MmRaisePoolQuota(): Failed to increase pool quota, not enough resident pages available (current available pages -- %lu)\n",
1474 DPRINT1(
"MmRaisePoolQuota(): Failed to increase pool quota, not enough paged pool space (current size -- %lu || allocated size -- %lu)\n",
1575MmAllocateMappingAddress(
1589 if (SizeInPages == 0)
1606 DPRINT1(
"Failed to reserve system PTEs\n");
1612 TempPte.u.List.NextEntry = SizeInPages;
1640MmFreeMappingAddress(
1655 if (PointerPte[1].
u.Long !=
TempPte.u.Long)
1661 PointerPte[1].
u.Long);
1666 if (SizeInPages < 3)
1676 for (
i = 2;
i < SizeInPages;
i++)
1678 if (PointerPte[
i].
u.Long != 0)
#define BASE_POOL_TYPE_MASK
HARDWARE_PTE_ARMV6 TempPte
HARDWARE_PDE_ARMV6 TempPde
#define _Requires_lock_held_(lock)
#define RtlInitializeBitMap
#define RtlFindClearBitsAndSet
#define NT_SUCCESS(StatCode)
#define ASSERT_IRQL_EQUAL(x)
#define __drv_freesMem(kind)
#define _IRQL_requires_max_(irql)
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define InsertHeadList(ListHead, Entry)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define IsListEmpty(ListHead)
#define KeSetEvent(pEvt, foo, foo2)
#define InitializeListHead(ListHead)
VOID NTAPI KeClearEvent(IN PKEVENT Event)
VOID NTAPI ExInitializePoolDescriptor(IN PPOOL_DESCRIPTOR PoolDescriptor, IN POOL_TYPE PoolType, IN ULONG PoolIndex, IN ULONG Threshold, IN PVOID PoolLock)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
VOID FASTCALL KeInitializeGuardedMutex(OUT PKGUARDED_MUTEX GuardedMutex)
VOID FASTCALL KeReleaseGuardedMutex(IN OUT PKGUARDED_MUTEX GuardedMutex)
VOID FASTCALL KeAcquireGuardedMutex(IN PKGUARDED_MUTEX GuardedMutex)
VOID FASTCALL KeReleaseQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber, IN KIRQL OldIrql)
KIRQL FASTCALL KeAcquireQueuedSpinLock(IN KSPIN_LOCK_QUEUE_NUMBER LockNumber)
#define InterlockedIncrementSizeT(a)
VOID NTAPI MiInitializeSystemPtes(IN PMMPTE StartingPte, IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE PoolType)
FORCEINLINE BOOLEAN MI_IS_PHYSICAL_ADDRESS(IN PVOID Address)
#define PTE_MAPPING_EMPTY
#define PTE_MAPPING_NOT_OWNED
PFN_NUMBER MiLowPagedPoolThreshold
PMM_SESSION_SPACE MmSessionSpace
#define MI_GET_NEXT_COLOR()
PFN_NUMBER NTAPI MiRemoveAnyPage(IN ULONG Color)
VOID NTAPI MiReleaseSystemPtes(IN PMMPTE StartingPte, IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
#define MI_MAKE_SOFTWARE_PTE(p, x)
PFN_NUMBER MmMaximumNonPagedPoolInPages
NTSTATUS NTAPI MiInitializeAndChargePfn(OUT PPFN_NUMBER PageFrameIndex, IN PMMPDE PointerPde, IN PFN_NUMBER ContainingPageFrame, IN BOOLEAN SessionAllocation)
PFN_NUMBER MiHighPagedPoolThreshold
VOID NTAPI MiInitializePfnForOtherProcess(IN PFN_NUMBER PageFrameIndex, IN PVOID PteAddress, IN PFN_NUMBER PteFrame)
FORCEINLINE VOID MI_WRITE_VALID_PDE(IN PMMPDE PointerPde, IN MMPDE TempPde)
PKEVENT MiLowNonPagedPoolEvent
FORCEINLINE VOID MI_WRITE_INVALID_PTE(IN PMMPTE PointerPte, IN MMPTE InvalidPte)
PMMPTE NTAPI MiReserveSystemPtes(IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
#define PTE_MAPPING_RESERVED
PFN_NUMBER MiLowNonPagedPoolThreshold
PFN_NUMBER MiHighNonPagedPoolThreshold
PKEVENT MiHighPagedPoolEvent
FORCEINLINE VOID MI_WRITE_VALID_PTE(IN PMMPTE PointerPte, IN MMPTE TempPte)
PFN_COUNT NTAPI MiDeleteSystemPageableVm(IN PMMPTE PointerPte, IN PFN_NUMBER PageCount, IN ULONG Flags, OUT PPFN_NUMBER ValidPages)
PKEVENT MiLowPagedPoolEvent
PFN_NUMBER MmSizeOfPagedPoolInPages
PKEVENT MiHighNonPagedPoolEvent
#define MiAddressToPte(x)
#define MiAddressToPde(x)
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
#define _Must_inspect_result_
#define DEFAULT_UNREACHABLE
_In_ ULONG _In_ ULONG Offset
#define MM_EMPTY_PTE_LIST
#define MI_MAX_FREE_PAGE_LISTS
#define MiPteToAddress(_Pte)
struct _MMFREE_POOL_ENTRY * PMMFREE_POOL_ENTRY
#define VERIFIER_POOL_MASK
PFN_NUMBER MmResidentAvailablePages
_In_ SIZE_T _Out_ PSIZE_T NewMaxQuota
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
#define MI_SET_PROCESS2(x)
#define MI_QUOTA_NON_PAGED_NEEDED_PAGES
#define MI_CHARGE_PAGED_POOL_QUOTA
_In_ SIZE_T CurrentMaxQuota
PFN_COUNT MmNumberOfPhysicalPages
FORCEINLINE PFN_NUMBER MiGetPfnEntryIndex(IN PMMPFN Pfn1)
#define MI_NON_PAGED_QUOTA_MIN_RESIDENT_PAGES
PFN_NUMBER MmAvailablePages
#define MI_CHARGE_NON_PAGED_POOL_QUOTA
#define MM_FREE_POOL_SIGNATURE
_In_ SIZE_T QuotaToReturn
VOID NTAPI KeFlushEntireTb(IN BOOLEAN Invalid, IN BOOLEAN AllProcessors)
ULONG MmMaximumNonPagedPoolInBytes
ULONG MmSizeOfNonPagedPoolInBytes
PVOID MmNonPagedPoolExpansionStart
PVOID MmNonPagedPoolStart
PFN_NUMBER MmSystemPageDirectory[PPE_PER_PAGE]
ULONG MiNonPagedPoolSListMaximum
PFN_NUMBER MiStartOfInitialPoolFrame
PFN_COUNT MmNumberOfFreeNonPagedPool
SIZE_T MmTotalPagedPoolQuota
PFN_COUNT MiExpansionPoolPagesInitialCharge
VOID NTAPI MiProtectedPoolRemoveEntryList(IN PLIST_ENTRY Entry)
VOID NTAPI MiInitializePoolEvents(VOID)
ULONG MiPagedPoolSListMaximum
SIZE_T MmTotalNonPagedPoolQuota
VOID NTAPI MiInitializeNonPagedPool(VOID)
BOOLEAN MmProtectFreedNonPagedPool
KGUARDED_MUTEX MmPagedPoolMutex
PVOID NTAPI MiAllocatePoolPages(IN POOL_TYPE PoolType, IN SIZE_T SizeInBytes)
FORCEINLINE VOID MiProtectedPoolUnProtectLinks(IN PLIST_ENTRY Links, OUT PVOID *PoolFlink, OUT PVOID *PoolBlink)
MM_PAGED_POOL_INFO MmPagedPoolInfo
VOID NTAPI MiInitializeNonPagedPoolThresholds(VOID)
SLIST_HEADER MiNonPagedPoolSListHead
VOID NTAPI MiProtectFreeNonPagedPool(IN PVOID VirtualAddress, IN ULONG PageCount)
PFN_NUMBER MiEndOfInitialPoolFrame
LIST_ENTRY MmNonPagedPoolFreeListHead[MI_MAX_FREE_PAGE_LISTS]
FORCEINLINE VOID MiProtectedPoolProtectLinks(IN PVOID PoolFlink, IN PVOID PoolBlink)
SIZE_T MmAllocatedNonPagedPool
POOL_TYPE NTAPI MmDeterminePoolType(IN PVOID PoolAddress)
SLIST_HEADER MiPagedPoolSListHead
NTSTATUS NTAPI MiInitializeSessionPool(VOID)
ULONG MmConsumedPoolPercentage
BOOLEAN NTAPI MiUnProtectFreeNonPagedPool(IN PVOID VirtualAddress, IN ULONG PageCount)
ULONG NTAPI MiFreePoolPages(IN PVOID StartingVa)
VOID NTAPI MiProtectedPoolInsertList(IN PLIST_ENTRY ListHead, IN PLIST_ENTRY Entry, IN BOOLEAN Critical)
static KSPIN_LOCK PspQuotaLock
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
base of all file and directory entries
struct _LIST_ENTRY * Flink
struct _MMFREE_POOL_ENTRY * Owner
struct _MMPFN::@1804::@1810 e2
ULONG_PTR VerifierAllocation
PMMPTE LastPteForPagedPool
SIZE_T AllocatedPagedPool
PRTL_BITMAP EndOfPagedPoolBitmap
PRTL_BITMAP PagedPoolAllocationMap
PMMPDE NextPdeForPagedPoolExpansion
PMMPTE FirstPteForPagedPool
PFN_NUMBER SessionPageDirectoryIndex
KGUARDED_MUTEX PagedPoolMutex
MM_PAGED_POOL_INFO PagedPoolInfo
struct _MM_SESSION_SPACE * GlobalVirtualAddress
POOL_DESCRIPTOR PagedPool
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ _Strict_type_match_ POOL_TYPE PoolType
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ WDFDMATRANSACTION _In_ PFN_WDF_PROGRAM_DMA _In_ WDF_DMA_DIRECTION _In_ PMDL _In_ PVOID VirtualAddress
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
_Must_inspect_result_ _In_ WDFCMRESLIST List
FORCEINLINE USHORT ExQueryDepthSList(_In_ PSLIST_HEADER SListHead)
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
@ LockQueueMmNonPagedPoolLock
#define BYTES_TO_PAGES(Size)
#define InterlockedPushEntrySList(SListHead, SListEntry)
#define InterlockedPopEntrySList(SListHead)
FORCEINLINE VOID InitializeSListHead(_Out_ PSLIST_HEADER SListHead)