15 #define MODULE_INVOLVED_IN_ARM3 38 BoundaryMask = ~(BoundaryPfn - 1);
57 LastPage =
Page + PageCount;
62 if ((LastPage - 1) > HighestPfn) LastPage = HighestPfn + 1;
63 if (
Page < LowestPfn)
Page = LowestPfn;
68 if (!(PageCount) || ((
Page + SizeInPages) > LastPage))
continue;
89 if ((!(
Length) && (BoundaryPfn)) &&
90 (((
Page ^ (
Page + SizeInPages - 1)) & BoundaryMask)))
101 if (++
Length == SizeInPages)
133 EndPfn = Pfn1 - SizeInPages + 1;
142 Pfn1->
u3.
e2.ReferenceCount = 1;
145 Pfn1->
u3.
e1.StartOfAllocation = 0;
146 Pfn1->
u3.
e1.EndOfAllocation = 0;
154 if (Pfn1 == EndPfn)
break;
161 Pfn1->
u3.
e1.StartOfAllocation = 1;
162 (Pfn1 + SizeInPages - 1)->
u3.e1.EndOfAllocation = 1;
172 EndPfn = Pfn1 + SizeInPages;
223 PFN_NUMBER PreviousPage = 0,
Page, HighPage, BoundaryMask, Pages = 0;
228 if (LowestPfn > HighestPfn)
return NULL;
229 if (LowestPfn + SizeInPages <= LowestPfn)
return NULL;
230 if (LowestPfn + SizeInPages - 1 > HighestPfn)
return NULL;
231 if (BaseAddressPages < SizeInPages)
return NULL;
236 HighPage = HighestPfn + 1 - SizeInPages;
237 BoundaryMask = ~(BoundaryPfn - 1);
243 EndPte = StartPte + BaseAddressPages;
244 while (StartPte < EndPte)
260 if ((
Page >= LowestPfn) && (
Page <= HighPage))
265 if (!(BoundaryPfn) ||
266 (!((
Page ^ (
Page + SizeInPages - 1)) & BoundaryMask)))
279 if (Pages == SizeInPages)
292 if (
Page != (PreviousPage + 1))
304 if (++Pages == SizeInPages)
362 EndPfn = Pfn1 + SizeInPages;
369 }
while (++Pfn1 < EndPfn);
421 HighestAcceptablePfn,
448 HighestAcceptablePfn,
454 DPRINT1(
"Unable to allocate contiguous memory for %d bytes (%d pages), out of memory!\n",
NumberOfBytes, SizeInPages);
464 PFN_NUMBER PageFrameIndex, LastPage, PageCount;
493 if ((!Pfn1) || (Pfn1->
u3.
e1.StartOfAllocation == 0))
509 Pfn1->
u3.
e1.StartOfAllocation = 0;
527 }
while (Pfn1++->
u3.e1.EndOfAllocation == 0);
533 Pfn1->
u3.
e1.EndOfAllocation = 0;
538 PageCount = (
ULONG)(Pfn1 - StartPfn + 1);
553 LastPage = PageFrameIndex + PageCount;
559 }
while (PageFrameIndex < LastPage);
580 PFN_NUMBER LowestPfn, HighestPfn, BoundaryPfn;
609 if (LowestPfn > HighestPfn)
return NULL;
#define KeGetCurrentIrql()
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS BoundaryAddressMultiple
_In_ ULONG _In_ ULONG _In_ ULONG Length
PVOID NTAPI MiCheckForContiguousMemory(IN PVOID BaseAddress, IN PFN_NUMBER BaseAddressPages, IN PFN_NUMBER SizeInPages, IN PFN_NUMBER LowestPfn, IN PFN_NUMBER HighestPfn, IN PFN_NUMBER BoundaryPfn, IN MI_PFN_CACHE_ATTRIBUTE CacheAttribute)
PVOID MmNonPagedPoolExpansionStart
PVOID NTAPI MiFindContiguousMemory(IN PFN_NUMBER LowestPfn, IN PFN_NUMBER HighestPfn, IN PFN_NUMBER BoundaryPfn, IN PFN_NUMBER SizeInPages, IN MEMORY_CACHING_TYPE CacheType)
PHYSICAL_MEMORY_RUN Run[1]
PVOID NTAPI MmMapIoSpace(IN PHYSICAL_ADDRESS PhysicalAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
VOID NTAPI MiFreeContiguousMemory(IN PVOID BaseAddress)
VOID NTAPI MmFreeContiguousMemory(IN PVOID BaseAddress)
enum _MI_PFN_CACHE_ATTRIBUTE MI_PFN_CACHE_ATTRIBUTE
#define MiAddressToPte(x)
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
#define MI_SET_PROCESS2(x)
MI_PFN_CACHE_ATTRIBUTE MiPlatformCacheAttributes[2][MmMaximumCacheType]
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ MEMORY_CACHING_TYPE CacheType
#define KeLeaveGuardedRegion()
ULONG_PTR VerifierAllocation
VOID NTAPI MiDecrementShareCount(IN PMMPFN Pfn1, IN PFN_NUMBER PageFrameIndex)
PFN_NUMBER NTAPI MiFindContiguousPages(IN PFN_NUMBER LowestPfn, IN PFN_NUMBER HighestPfn, IN PFN_NUMBER BoundaryPfn, IN PFN_NUMBER SizeInPages, IN MEMORY_CACHING_TYPE CacheType)
PPHYSICAL_MEMORY_DESCRIPTOR MmPhysicalMemoryBlock
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
PVOID NTAPI MiAllocateContiguousMemory(IN SIZE_T NumberOfBytes, IN PFN_NUMBER LowestAcceptablePfn, IN PFN_NUMBER HighestAcceptablePfn, IN PFN_NUMBER BoundaryPfn, IN MEMORY_CACHING_TYPE CacheType)
#define KeEnterGuardedRegion()
#define ExAllocatePoolWithTag(hernya, size, tag)
#define BYTES_TO_PAGES(Size)
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS PhysicalAddress
FORCEINLINE PMMPFN MI_PFN_ELEMENT(IN PFN_NUMBER Pfn)
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
_Out_ PNDIS_HANDLE _Out_ PUINT _In_ PNDIS_STRING _In_ NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS LowestAcceptableAddress
PVOID MmNonPagedPoolStart
#define MI_SET_PFN_DELETED(x)
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
VOID NTAPI MmUnmapIoSpace(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes)
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
PVOID NTAPI MmAllocateContiguousMemory(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS HighestAcceptableAddress)
VOID NTAPI MmFreeContiguousMemorySpecifyCache(IN PVOID BaseAddress, IN SIZE_T NumberOfBytes, IN MEMORY_CACHING_TYPE CacheType)
struct _MMPFN::@1753::@1759 e2
BOOLEAN NTAPI MiIsPfnInUse(IN PMMPFN Pfn1)
PFN_NUMBER MmHighestPhysicalPage
ULONG MmSizeOfNonPagedPoolInBytes
FORCEINLINE PVOID MiPteToAddress(PMMPTE PointerPte)
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE
#define ExFreePoolWithTag(_P, _T)
VOID NTAPI MiUnlinkFreeOrZeroedPage(IN PMMPFN Entry)
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
PVOID NTAPI MmAllocateContiguousMemorySpecifyCache(IN SIZE_T NumberOfBytes, IN PHYSICAL_ADDRESS LowestAcceptableAddress OPTIONAL, IN PHYSICAL_ADDRESS HighestAcceptableAddress, IN PHYSICAL_ADDRESS BoundaryAddressMultiple OPTIONAL, IN MEMORY_CACHING_TYPE CacheType OPTIONAL)
PULONG MinorVersion OPTIONAL