15#define MODULE_INVOLVED_IN_ARM3
59 DPRINT(
"MiMapLockedPagesInUserSpace(%p, %p, 0x%x, %p)\n",
74 DPRINT1(
"FIXME: Need to check for large pages\n");
105 AddressSpaceLocked =
TRUE;
117 if (
Result == TableFoundNode)
122 EndingVa = StartingVa + NumberOfPages *
PAGE_SIZE - 1;
129 EndingVa = StartingVa + NumberOfPages *
PAGE_SIZE - 1;
133 EndingVa <= StartingVa ||
141 AddressSpaceLocked =
TRUE;
153 if (
Result == TableFoundNode)
177 while (NumberOfPages != 0 &&
193 EffectiveCacheAttribute = CacheAttribute;
229 DPRINT1(
"FIXME: MiNotMapped is not supported\n");
236 switch (EffectiveCacheAttribute)
271 ASSERT(AddressSpaceLocked);
278 if (AddressSpaceLocked)
311 ASSERT(NumberOfPages != 0);
337 while (NumberOfPages != 0 &&
458 EndPage = MdlPages + PageCount;
618 Pfn1->
u3.
e1.StartOfAllocation = 0;
619 Pfn1->
u3.
e1.EndOfAllocation = 0;
627 if (Pfn1->
u3.
e2.ReferenceCount != 1)
642 }
while (--NumberOfPages != 0);
652 Mdl->MdlFlags &= ~MDL_PAGES_LOCKED;
695 LastPage = MdlPages + PageCount;
725 if (!BugCheckOnFailure)
return NULL;
742 switch (CacheAttribute)
784 }
while (++MdlPages < LastPage);
891 ExtraPageCount = (
PFN_COUNT)*(MdlPages + PageCount);
896 PageCount += ExtraPageCount;
897 PointerPte -= ExtraPageCount;
937 ULONG LockPages, TotalPages;
941 PMMPTE PointerPte, LastPte;
943#if (_MI_PAGING_LEVELS >= 3)
946#if (_MI_PAGING_LEVELS == 4)
1005 CurrentProcess =
NULL;
1011 TotalPages = LockPages;
1060 }
while (
Address < LastAddress);
1085 DPRINT1(
"MDL PROBE FAILED!\n");
1095#if (_MI_PAGING_LEVELS >= 3)
1098#if (_MI_PAGING_LEVELS == 4)
1169 Mdl->Process = CurrentProcess;
1229 DPRINT1(
"Access fault failed\n");
1298 DPRINT1(
"Access fault failed\n");
1329 goto CleanupWithLock;
1360 *MdlPages++ = PageFrameIndex;
1365#if (_MI_PAGING_LEVELS >= 3)
1368#if (_MI_PAGING_LEVELS == 4)
1372 }
while (PointerPte <= LastPte);
1496 LastPage = MdlPages + PageCount;
1509 }
while (++MdlPages < LastPage);
1532 Mdl->MdlFlags &= ~MDL_IO_SPACE;
1533 Mdl->MdlFlags &= ~MDL_PAGES_LOCKED;
1553 LastPage = MdlPages + PageCount;
1569 Mdl->MdlFlags &= ~MDL_PAGES_LOCKED;
1576 LastPage = MdlPages;
1583 }
while (++MdlPages < LastPage);
1597 Pfn1 = (
PMMPFN)*MdlPages;
1599 }
while (++MdlPages < LastPage);
1609 Mdl->MdlFlags &= ~MDL_PAGES_LOCKED;
1648 LastPage = MdlPages + PageCount;
1663 ASSERT(!PointerPte[0].
u.Hard.Valid &&
1669 if (PointerPte[1].
u.Long !=
TempPte.u.Long)
1675 PointerPte[1].
u.Long);
1679 if (PointerPte[0].
u.List.NextEntry < 3)
1689 if (PointerPte[0].
u.List.NextEntry - 2 < PageCount)
1691 DPRINT1(
"Reserved mapping too small. Need %Iu pages, have %Iu\n",
1693 PointerPte[0].
u.List.NextEntry - 2);
1701 switch (CacheAttribute)
1721 for (; (MdlPages < LastPage) && (*MdlPages !=
LIST_HEAD); ++MdlPages)
1730 Mdl->MappedSystemVa = MappingAddress;
1775 ASSERT(!PointerPte[0].
u.Hard.Valid &&
1781 if (PointerPte[1].
u.Long !=
TempPte.u.Long)
1787 PointerPte[1].
u.Long);
1791 if (PointerPte[0].
u.List.NextEntry < 3)
1820 ExtraPageCount = MdlPages[PageCount];
1823 PageCount += ExtraPageCount;
1824 PointerPte -= ExtraPageCount;
1895MmProbeAndLockProcessPages(
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
HARDWARE_PTE_ARMV6 TempPte
#define MM_USER_PROBE_ADDRESS
#define MM_HIGHEST_USER_ADDRESS
#define STATUS_NOT_IMPLEMENTED
#define NT_SUCCESS(StatCode)
static const WCHAR Cleanup[]
#define _IRQL_requires_max_(irql)
#define ExAllocatePoolWithTag(hernya, size, tag)
#define PsGetCurrentThread()
#define KeGetCurrentIrql()
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
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
#define EXCEPTION_EXECUTE_HANDLER
#define InterlockedExchangeAddSizeT(a, b)
#define InterlockedDecrement16
MI_PFN_CACHE_ATTRIBUTE MiPlatformCacheAttributes[2][MmMaximumCacheType]
PMMVAD NTAPI MiLocateAddress(IN PVOID VirtualAddress)
#define PTE_UNMAPPING_ADDRESS_NOT_OWNED
FORCEINLINE BOOLEAN MI_IS_PHYSICAL_ADDRESS(IN PVOID Address)
PMDL NTAPI MiAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress, IN PHYSICAL_ADDRESS HighAddress, IN PHYSICAL_ADDRESS SkipBytes, IN SIZE_T TotalBytes, IN MI_PFN_CACHE_ATTRIBUTE CacheAttribute, IN ULONG Flags)
PMMPTE MmSystemPtesStart[MaximumPtePoolTypes]
FORCEINLINE VOID MiDeletePde(_In_ PMMPDE PointerPde, _In_ PEPROCESS CurrentProcess)
FORCEINLINE VOID MI_MAKE_HARDWARE_PTE_USER(IN PMMPTE NewPte, IN PMMPTE MappingPte, IN ULONG_PTR ProtectionMask, IN PFN_NUMBER PageFrameNumber)
VOID NTAPI MiRemoveNode(IN PMMADDRESS_NODE Node, IN PMM_AVL_TABLE Table)
PMMPTE MmSystemPtesEnd[MaximumPtePoolTypes]
#define PTE_MAPPING_ADDRESS_INVALID
VOID NTAPI MiReleaseSystemPtes(IN PMMPTE StartingPte, IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
enum _MI_PFN_CACHE_ATTRIBUTE MI_PFN_CACHE_ATTRIBUTE
FORCEINLINE VOID MI_ERASE_PTE(IN PMMPTE PointerPte)
FORCEINLINE USHORT MiDecrementPageTableReferences(IN PVOID Address)
VOID NTAPI MiDecrementShareCount(IN PMMPFN Pfn1, IN PFN_NUMBER PageFrameIndex)
FORCEINLINE VOID MiUnlockProcessWorkingSet(IN PEPROCESS Process, IN PETHREAD Thread)
FORCEINLINE VOID MiUnlockProcessWorkingSetUnsafe(IN PEPROCESS Process, IN PETHREAD Thread)
VOID NTAPI MiMakePdeExistAndMakeValid(IN PMMPDE PointerPde, IN PEPROCESS TargetProcess, IN KIRQL OldIrql)
FORCEINLINE VOID MiDereferencePfnAndDropLockCount(IN PMMPFN Pfn1)
PMMPTE NTAPI MiReserveSystemPtes(IN ULONG NumberOfPtes, IN MMSYSTEM_PTE_POOL_TYPE SystemPtePoolType)
FORCEINLINE VOID MiReferenceProbedPageAndBumpLockCount(IN PMMPFN Pfn1)
#define PTE_MAPPING_ADDRESS_NOT_OWNED
VOID NTAPI MiDecrementReferenceCount(IN PMMPFN Pfn1, IN PFN_NUMBER PageFrameIndex)
TABLE_SEARCH_RESULT NTAPI MiFindEmptyAddressRangeInTree(IN SIZE_T Length, IN ULONG_PTR Alignment, IN PMM_AVL_TABLE Table, OUT PMMADDRESS_NODE *PreviousVad, OUT PULONG_PTR Base)
FORCEINLINE VOID MI_WRITE_VALID_PTE(IN PMMPTE PointerPte, IN MMPTE TempPte)
#define MI_IS_PFN_DELETED(x)
TABLE_SEARCH_RESULT NTAPI MiCheckForConflictingNode(IN ULONG_PTR StartVpn, IN ULONG_PTR EndVpn, IN PMM_AVL_TABLE Table, OUT PMMADDRESS_NODE *NodeOrParent)
FORCEINLINE USHORT MiIncrementPageTableReferences(IN PVOID Address)
VOID NTAPI MiInsertVad(_Inout_ PMMVAD Vad, _Inout_ PMM_AVL_TABLE VadRoot)
FORCEINLINE PMMPFN MI_PFN_ELEMENT(IN PFN_NUMBER Pfn)
FORCEINLINE VOID MiLockProcessWorkingSet(IN PEPROCESS Process, IN PETHREAD Thread)
FORCEINLINE VOID MiLockProcessWorkingSetUnsafe(IN PEPROCESS Process, IN PETHREAD Thread)
#define PTE_MAPPING_ADDRESS_EMPTY
VOID NTAPI MmMapMemoryDumpMdl(IN PMDL Mdl)
BOOLEAN MmTrackLockedPages
PVOID NTAPI MmMapLockedPagesWithReservedMapping(_In_ PVOID MappingAddress, _In_ ULONG PoolTag, _In_ PMDL Mdl, _In_ MEMORY_CACHING_TYPE CacheType)
PVOID NTAPI MmMapLockedPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode)
VOID NTAPI MmFreePagesFromMdl(IN PMDL Mdl)
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
VOID NTAPI MmProbeAndLockSelectedPages(IN OUT PMDL MemoryDescriptorList, IN LARGE_INTEGER PageList[], IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
VOID NTAPI MmUnmapReservedMapping(_In_ PVOID BaseAddress, _In_ ULONG PoolTag, _In_ PMDL Mdl)
PMDL NTAPI MmAllocatePagesForMdlEx(IN PHYSICAL_ADDRESS LowAddress, IN PHYSICAL_ADDRESS HighAddress, IN PHYSICAL_ADDRESS SkipBytes, IN SIZE_T TotalBytes, IN MEMORY_CACHING_TYPE CacheType, IN ULONG Flags)
NTSTATUS NTAPI MmPrefetchPages(IN ULONG NumberOfLists, IN PREAD_LIST *ReadLists)
PMDL NTAPI MmAllocatePagesForMdl(IN PHYSICAL_ADDRESS LowAddress, IN PHYSICAL_ADDRESS HighAddress, IN PHYSICAL_ADDRESS SkipBytes, IN SIZE_T TotalBytes)
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
VOID NTAPI MmBuildMdlForNonPagedPool(IN PMDL Mdl)
static VOID NTAPI MiUnmapLockedPagesInUserSpace(_In_ PVOID BaseAddress, _In_ PMDL Mdl)
ULONG MiCacheOverride[MiNotMapped+1]
SIZE_T MmSystemLockPagesCount
PMDL NTAPI MmCreateMdl(IN PMDL Mdl, IN PVOID Base, IN SIZE_T Length)
PVOID NTAPI MmMapLockedPagesSpecifyCache(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN MEMORY_CACHING_TYPE CacheType, IN PVOID BaseAddress, IN ULONG BugCheckOnFailure, IN ULONG Priority)
SIZE_T NTAPI MmSizeOfMdl(IN PVOID Base, IN SIZE_T Length)
VOID NTAPI MmUnmapLockedPages(IN PVOID BaseAddress, IN PMDL Mdl)
static PVOID NTAPI MiMapLockedPagesInUserSpace(_In_ PMDL Mdl, _In_ PVOID StartVa, _In_ MEMORY_CACHING_TYPE CacheType, _In_opt_ PVOID BaseAddress)
NTSTATUS NTAPI MmProtectMdlSystemAddress(IN PMDL MemoryDescriptorList, IN ULONG NewProtect)
NTSTATUS NTAPI MmAdvanceMdl(IN PMDL Mdl, IN ULONG NumberOfBytes)
#define MiAddressToPte(x)
#define MiAddressToPde(x)
#define ExFreePoolWithTag(_P, _T)
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
@ VadDevicePhysicalMemory
_In_ ULONG _In_ ULONG _In_ ULONG Length
FORCEINLINE VOID KeFlushProcessTb(VOID)
#define MI_IS_PAGE_COPY_ON_WRITE(x)
#define MI_PAGE_WRITE_COMBINED(x)
#define MI_PAGE_DISABLE_CACHE(x)
#define MI_IS_PAGE_WRITEABLE(x)
#define MiIsPteOnPpeBoundary(PointerPte)
#define MM_HIGHEST_VAD_ADDRESS
#define _MI_PAGING_LEVELS
FORCEINLINE PMMPTE MiAddressToPpe(PVOID Address)
FORCEINLINE PMMPTE MiAddressToPxe(PVOID Address)
#define MiIsPteOnPdeBoundary(PointerPte)
#define MiIsPteOnPxeBoundary(PointerPte)
#define MI_PAGE_WRITE_THROUGH(x)
#define MiPteToAddress(_Pte)
BOOLEAN NTAPI KeInvalidateAllCaches(VOID)
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
FORCEINLINE VOID MmLockAddressSpace(PMMSUPPORT AddressSpace)
#define MM_VIRTMEM_GRANULARITY
FORCEINLINE VOID MmUnlockAddressSpace(PMMSUPPORT AddressSpace)
_Out_ PKAPC_STATE ApcState
NTSTATUS NTAPI MmAccessFault(IN ULONG FaultCode, IN PVOID Address, IN KPROCESSOR_MODE Mode, IN PVOID TrapInformation)
VOID NTAPI KeFlushEntireTb(IN BOOLEAN Invalid, IN BOOLEAN AllProcessors)
#define STATUS_INVALID_ADDRESS
#define STATUS_PROCESS_IS_TERMINATING
#define STATUS_ACCESS_VIOLATION
#define STATUS_CONFLICTING_ADDRESSES
VOID NTAPI KeStackAttachProcess(IN PKPROCESS Process, OUT PRKAPC_STATE ApcState)
VOID NTAPI KeUnstackDetachProcess(IN PRKAPC_STATE ApcState)
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
NTSTATUS NTAPI PsChargeProcessNonPagedPoolQuota(_In_ PEPROCESS Process, _In_ SIZE_T Amount)
Charges the non paged pool quota of a given process.
VOID NTAPI PsReturnProcessNonPagedPoolQuota(_In_ PEPROCESS Process, _In_ SIZE_T Amount)
Returns the non paged quota pool that the process was taking up.
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
#define ProbeForWriteChar(Ptr)
PMM_AVL_TABLE PhysicalVadRoot
PFN_NUMBER NumberOfLockedPages
struct _MMPFN::@1804::@1810 e2
union _MMVAD_LONG::@2623 u2
union _MMVAD_LONG::@2622 u
#define LIST_HEAD(name, type)
#define RtlZeroMemory(Destination, Length)
#define STATUS_INSUFFICIENT_RESOURCES
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_In_ WDFINTERRUPT _In_ WDF_INTERRUPT_POLICY _In_ WDF_INTERRUPT_PRIORITY Priority
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
int WINAPI EndPage(_In_ HDC)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
_Must_inspect_result_ _In_ ULONG Flags
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
enum _LOCK_OPERATION LOCK_OPERATION
#define MmGetMdlByteOffset(_Mdl)
#define MmGetMdlByteCount(_Mdl)
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS HighAddress
#define MmGetMdlVirtualAddress(_Mdl)
_Inout_ PMDL MemoryDescriptorList
#define MmInitializeMdl(_MemoryDescriptorList, _BaseVa, _Length)
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
_Must_inspect_result_ _In_ ULONG NewProtect
#define MmGetMdlPfnArray(_Mdl)
#define ADDRESS_AND_SIZE_TO_SPAN_PAGES(_Va, _Size)
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS SkipBytes
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_opt_ PHYSICAL_ADDRESS _In_ MEMORY_CACHING_TYPE CacheType
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS _In_ PHYSICAL_ADDRESS _In_ SIZE_T TotalBytes
#define MDL_PARTIAL_HAS_BEEN_MAPPED
#define MDL_WRITE_OPERATION
#define MDL_FREE_EXTRA_PTES
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE
#define MM_DONT_ZERO_ALLOCATION
#define MDL_MAPPING_CAN_FAIL
#define MDL_PARENT_MAPPED_SYSTEM_VA
#define MM_ALLOCATE_FROM_LOCAL_NODE_ONLY
#define MDL_DESCRIBES_AWE
#define MDL_SOURCE_IS_NONPAGED_POOL
#define MDL_MAPPED_TO_SYSTEM_VA
#define PsGetCurrentProcess