18#ifndef _MI_PAGING_LEVELS
19#error "Dude, fix your stuff before using this file"
31 PTE_READONLY | PTE_ENABLE_CACHE,
32 PTE_EXECUTE | PTE_ENABLE_CACHE,
33 PTE_EXECUTE_READ | PTE_ENABLE_CACHE,
34 PTE_READWRITE | PTE_ENABLE_CACHE,
35 PTE_WRITECOPY | PTE_ENABLE_CACHE,
36 PTE_EXECUTE_READWRITE | PTE_ENABLE_CACHE,
37 PTE_EXECUTE_WRITECOPY | PTE_ENABLE_CACHE,
42 PTE_READONLY | PTE_DISABLE_CACHE,
43 PTE_EXECUTE | PTE_DISABLE_CACHE,
44 PTE_EXECUTE_READ | PTE_DISABLE_CACHE,
45 PTE_READWRITE | PTE_DISABLE_CACHE,
46 PTE_WRITECOPY | PTE_DISABLE_CACHE,
47 PTE_EXECUTE_READWRITE | PTE_DISABLE_CACHE,
48 PTE_EXECUTE_WRITECOPY | PTE_DISABLE_CACHE,
53 PTE_READONLY | PTE_ENABLE_CACHE,
54 PTE_EXECUTE | PTE_ENABLE_CACHE,
55 PTE_EXECUTE_READ | PTE_ENABLE_CACHE,
56 PTE_READWRITE | PTE_ENABLE_CACHE,
57 PTE_WRITECOPY | PTE_ENABLE_CACHE,
58 PTE_EXECUTE_READWRITE | PTE_ENABLE_CACHE,
59 PTE_EXECUTE_WRITECOPY | PTE_ENABLE_CACHE,
64 PTE_READONLY | PTE_WRITECOMBINED_CACHE,
65 PTE_EXECUTE | PTE_WRITECOMBINED_CACHE,
66 PTE_EXECUTE_READ | PTE_WRITECOMBINED_CACHE,
67 PTE_READWRITE | PTE_WRITECOMBINED_CACHE,
68 PTE_WRITECOPY | PTE_WRITECOMBINED_CACHE,
69 PTE_EXECUTE_READWRITE | PTE_WRITECOMBINED_CACHE,
70 PTE_EXECUTE_WRITECOPY | PTE_WRITECOMBINED_CACHE,
121#if _MI_PAGING_LEVELS == 2
131#if _MI_PAGING_LEVELS == 4
143#if _MI_PAGING_LEVELS == 4
237MmDeleteVirtualMappingEx(
262 DPRINT1(
"NULL process given for user-mode mapping at %p\n",
Address);
265#if (_MI_PAGING_LEVELS == 2)
298 if (OldPte.
u.
Long != 0)
316 if (OldPte.
u.
Long != 0)
345 return OldPte.
u.
Long != 0;
361MmDeletePhysicalMapping(
417 *SwapEntry = OldPte.
u.
Long >> 1;
429#if _MI_PAGING_LEVELS == 2
473#if _MI_PAGING_LEVELS == 2
578 *SwapEntry = PointerPte->
u.
Long >> 1;
636 ULONG ProtectionMask;
641 DPRINT(
"MmCreateVirtualMappingUnsafe(%p, %p, %lu, %x)\n",
661 DPRINT1(
"NULL process given for user-mode mapping at %p\n",
Address);
664#if _MI_PAGING_LEVELS == 2
673 DPRINT1(
"Process %p given for kernel-mode mapping at %p -- 1 page starting at %Ix\n",
772#if _MI_PAGING_LEVELS == 2
814#if _MI_PAGING_LEVELS >= 3
835 ULONG ProtectionMask;
839 DPRINT(
"MmSetPageProtect(Process %p Address %p flProtect %x)\n",
894 DPRINT(
"MmSetDirtyBit(Process %p Address %p Bit %x)\n",
939 if (!MiSynchronizeSystemPde(PointerPde))
HARDWARE_PTE_ARMV6 TempPte
DECLSPEC_NORETURN VOID NTAPI KeBugCheck(ULONG BugCheckCode)
#define PsGetCurrentThread()
#define KeGetCurrentIrql()
_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 Add2Ptr(PTR, INC)
#define MM_EXECUTE_WRITECOPY
FORCEINLINE VOID MiLockProcessWorkingSetShared(IN PEPROCESS Process, IN PETHREAD Thread)
FORCEINLINE VOID MiDeletePde(_In_ PMMPDE PointerPde, _In_ PEPROCESS CurrentProcess)
FORCEINLINE VOID MiUnlockProcessWorkingSetShared(IN PEPROCESS Process, IN PETHREAD Thread)
FORCEINLINE USHORT MiDecrementPageTableReferences(IN PVOID Address)
#define MM_INVALID_PROTECTION
FORCEINLINE VOID MiUnlockProcessWorkingSetUnsafe(IN PEPROCESS Process, IN PETHREAD Thread)
VOID NTAPI MiMakePdeExistAndMakeValid(IN PMMPDE PointerPde, IN PEPROCESS TargetProcess, IN KIRQL OldIrql)
ULONG NTAPI MiMakeSystemAddressValid(IN PVOID PageTableVirtualAddress, IN PEPROCESS CurrentProcess)
FORCEINLINE VOID MI_MAKE_HARDWARE_PTE(IN PMMPTE NewPte, IN PMMPTE MappingPte, IN ULONG_PTR ProtectionMask, IN PFN_NUMBER PageFrameNumber)
ULONG NTAPI MiMakeProtectionMask(IN ULONG Protect)
FORCEINLINE USHORT MiIncrementPageTableReferences(IN PVOID Address)
FORCEINLINE VOID MiLockProcessWorkingSetUnsafe(IN PEPROCESS Process, IN PETHREAD Thread)
#define MiAddressToPte(x)
#define MiAddressToPde(x)
#define PAGE_EXECUTE_READ
#define PAGE_EXECUTE_WRITECOPY
#define PAGE_EXECUTE_READWRITE
#define RTL_BITS_OF(sizeOfArg)
FORCEINLINE VOID KeInvalidateTlbEntry(IN PVOID Address)
FORCEINLINE BOOLEAN MiIsPdeForAddressValid(PVOID Address)
#define MiGetPdeOffset(x)
FORCEINLINE PMMPTE MiAddressToPpe(PVOID Address)
FORCEINLINE PMMPTE MiAddressToPxe(PVOID Address)
#define MmSystemRangeStart
#define MiPteToAddress(_Pte)
FORCEINLINE PMMPFN MiGetPfnEntry(IN PFN_NUMBER Pfn)
_In_ PVOID _Out_opt_ BOOLEAN * WasDirty
#define PAGE_WRITETHROUGH
_In_ PVOID _Out_opt_ BOOLEAN _Out_opt_ PPFN_NUMBER Page
BOOLEAN NTAPI MmIsPageInUse(PFN_NUMBER Page)
#define InterlockedExchangePte(PointerPte, Value)
VOID NTAPI MmSetPageProtect(IN PEPROCESS Process, IN PVOID Address, IN ULONG Protection)
NTSTATUS NTAPI MmCreatePageFileMapping(IN PEPROCESS Process, IN PVOID Address, IN SWAPENTRY SwapEntry)
BOOLEAN NTAPI MmIsDisabledPage(PEPROCESS Process, PVOID Address)
ULONG NTAPI MmGetPageProtect(IN PEPROCESS Process, IN PVOID Address)
VOID NTAPI MmGetPageFileMapping(PEPROCESS Process, PVOID Address, SWAPENTRY *SwapEntry)
BOOLEAN NTAPI MmIsPagePresent(IN PEPROCESS Process, IN PVOID Address)
NTSTATUS NTAPI MmCreateVirtualMapping(IN PEPROCESS Process, IN PVOID Address, IN ULONG Protection, IN PPFN_NUMBER Pages, IN ULONG PageCount)
VOID NTAPI MmDeletePageFileMapping(IN PEPROCESS Process, IN PVOID Address, IN SWAPENTRY *SwapEntry)
const ULONG MmProtectToPteMask[32]
PFN_NUMBER NTAPI MmGetPfnForProcess(IN PEPROCESS Process, IN PVOID Address)
const ULONG MmProtectToValue[32]
BOOLEAN NTAPI MmIsPageSwapEntry(IN PEPROCESS Process, IN PVOID Address)
NTSTATUS NTAPI MmCreateVirtualMappingUnsafe(IN PEPROCESS Process, IN PVOID Address, IN ULONG Protection, IN PPFN_NUMBER Pages, IN ULONG PageCount)
VOID NTAPI MmDeleteVirtualMapping(IN PEPROCESS Process, IN PVOID Address, OUT PBOOLEAN WasDirty, OUT PPFN_NUMBER Page)
VOID NTAPI MmInitGlobalKernelPageDirectory(VOID)
VOID NTAPI MmSetDirtyBit(PEPROCESS Process, PVOID Address, BOOLEAN Bit)
static BOOLEAN MiIsPageTablePresent(PVOID Address)
NTSTATUS NTAPI MmCreateVirtualMappingUnsafeEx(_Inout_opt_ PEPROCESS Process, _In_ PVOID Address, _In_ ULONG flProtect, _In_ PFN_NUMBER Page, _In_ BOOLEAN IsPhysical)
NTSTATUS NTAPI MiFillSystemPageDirectory(IN PVOID Base, IN SIZE_T NumberOfBytes)
NTSTATUS NTAPI MmCreatePhysicalMapping(_Inout_opt_ PEPROCESS Process, _In_ PVOID Address, _In_ ULONG flProtect, _In_ PFN_NUMBER Page)
BOOLEAN Mmi386MakeKernelPageTableGlobal(PVOID PAddress)
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
ULONG64 UsedPageTableEntries
USHORT UsedPageTableEntries[768]
_Must_inspect_result_ typedef _In_ PHYSICAL_ADDRESS _Inout_ PLARGE_INTEGER NumberOfBytes
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
#define PAGE_WRITECOMBINE
#define PsGetCurrentProcess
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID _In_ ULONG_PTR _In_ SIZE_T _Inout_opt_ PLARGE_INTEGER _Inout_ PSIZE_T _In_ SECTION_INHERIT _In_ ULONG _In_ ULONG Protect