17#define IS_PAE() (g_IsPae)
19#define PTE_BASE 0xC0000000
21#define MiAddressToPteX86(x) \
22 ((PULONG)(((((ULONG)(x)) >> 12) << 2) + PTE_BASE))
23#define MiAddressToPtePAE(x) \
24 ((PULONGLONG)(((((ULONG)(x)) >> 12) << 3) + PTE_BASE))
26#define GET_PTE_VALUE_X86(Addr) (*MiAddressToPteX86(Addr))
27#define GET_PTE_VALUE_PAE(Addr) (*MiAddressToPtePAE(Addr))
28#define GET_PTE_VALUE(Addr) (IS_PAE() ? GET_PTE_VALUE_PAE(Addr) : GET_PTE_VALUE_X86(Addr))
30#define PTE_IS_VALID(PteValue) ((PteValue) & 1)
32#define PTE_GET_PFN_X86(PteValue) (((PteValue) >> PAGE_SHIFT) & 0x0fffffULL)
33#define PTE_GET_PFN_PAE(PteValue) (((PteValue) >> PAGE_SHIFT) & 0xffffffULL)
34#define PTE_GET_PFN(PteValue) (IS_PAE() ? PTE_GET_PFN_PAE(PteValue) : PTE_GET_PFN_X86(PteValue))
36#elif defined(_M_AMD64)
39#define PTE_BASE 0xFFFFF68000000000ULL
45 Offset &= 0xFFFFFFFFFULL << 3;
48#define MiAddressToPte(x) _MiAddressToPte((PVOID)(x))
50#define GET_PTE_VALUE(Addr) (*_MiAddressToPte((PVOID)(Addr)))
51#define PTE_IS_VALID(PteValue) ((PteValue) & 1)
52#define PTE_GET_PFN(PteValue) (((PteValue) >> PAGE_SHIFT) & 0xFffffffffULL)
61*pMmAllocatePagesForMdlEx)(
79#if defined(_M_IX86) || defined(_M_AMD64)
84 for (
i = 0;
i < ValidPtes;
i++)
87 PteValue = GET_PTE_VALUE(CurrentAddress);
89 ok(PTE_IS_VALID(PteValue),
90 "[%lu] PTE for %p is not valid (0x%I64x)\n",
91 i, CurrentAddress, PteValue);
94 ok(PTE_GET_PFN(PteValue) == Pfns[
i],
95 "[%lu] PTE for %p has PFN %Ix, expected %Ix\n",
96 i, CurrentAddress, PTE_GET_PFN(PteValue), Pfns[
i]);
98 for (;
i < TotalPtes;
i++)
101 PteValue = GET_PTE_VALUE(CurrentAddress);
104 "[%lu] PTE for %p is nonzero (0x%I64x)\n",
105 i, CurrentAddress, PteValue);
108 PteValue = GET_PTE_VALUE(CurrentAddress);
111 "PTE for %p contains 0x%I64x, expected %x\n",
112 CurrentAddress, PteValue,
PoolTag & ~1);
114 PteValue = GET_PTE_VALUE(CurrentAddress);
121 ExpectedValue = (TotalPtes + 2) << 12;
122#elif defined(_M_AMD64)
123 ExpectedValue = ((
ULONG64)TotalPtes + 2) << 32;
129 ExpectedValue = (TotalPtes + 2) * 2;
132 ok(PteValue == ExpectedValue,
133 "PTE for %p contains 0x%I64x, expected %x\n",
134 CurrentAddress, PteValue, ExpectedValue);
154 if (
skip(pMmAllocatePagesForMdlEx !=
NULL,
"MmAllocatePagesForMdlEx unavailable\n"))
160 MaxPhysical.
QuadPart = 0xffffffffffffffffLL;
163 Mdl = pMmAllocatePagesForMdlEx(ZeroPhysical,
186 "ValidateMapping returned");
197 "ValidateMapping returned");
211 "ValidateMapping returned");
222 "ValidateMapping returned");
228 Mdl = pMmAllocatePagesForMdlEx(ZeroPhysical,
251 "ValidateMapping returned");
253 for (
i = 0;
i < TotalPtes;
i++)
265 "ValidateMapping returned");
271 Mdl = pMmAllocatePagesForMdlEx(ZeroPhysical,
309 Mapping = MmAllocateMappingAddress(1,
'MRmK');
314 "ValidateMapping returned");
316 MmFreeMappingAddress(
Mapping,
'MRmK');
325 "ValidateMapping returned");
335 MmFreeMappingAddress(
Mapping,
'MRmK');
339 Mapping = MmAllocateMappingAddress(1, 0);
343 MmFreeMappingAddress(
Mapping, 0);
347 Mapping = MmAllocateMappingAddress(1, 1);
352 "ValidateMapping returned");
356 MmFreeMappingAddress(
Mapping, 1);
365 "ValidateMapping returned");
static BOOLEAN g_IsReactOS
#define ok_eq_pointer(value, expected)
#define ok_bool_true(value, desc)
#define _IRQL_requires_max_(irql)
static PVOID Mapping[EMS_PHYSICAL_PAGES]
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
#define KmtEndSeh(ExpectedStatus)
PVOID KmtGetSystemRoutineAddress(IN PCWSTR RoutineName)
PVOID NTAPI MmMapLockedPagesWithReservedMapping(_In_ PVOID MappingAddress, _In_ ULONG PoolTag, _In_ PMDL Mdl, _In_ MEMORY_CACHING_TYPE CacheType)
VOID NTAPI MmFreePagesFromMdl(IN PMDL Mdl)
VOID NTAPI MmUnmapReservedMapping(_In_ PVOID BaseAddress, _In_ ULONG PoolTag, _In_ PMDL Mdl)
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
#define _Must_inspect_result_
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
_In_ ULONG _In_ ULONG Offset
BOOLEAN NTAPI ExIsProcessorFeaturePresent(IN ULONG ProcessorFeature)
FORCEINLINE PMMPTE _MiAddressToPte(PVOID Address)
#define KI_USER_SHARED_DATA
EH_STD::__hash_map__< TestClass, TestClass, ThrowHash, ThrowEqual, eh_allocator(TestClass) > TestMap
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
_Must_inspect_result_ _In_ ULONG Flags
_Must_inspect_result_ _In_ PHYSICAL_ADDRESS HighAddress
_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
enum _MEMORY_CACHING_TYPE MEMORY_CACHING_TYPE