https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e6fa62a8d2fff999e6c92…
commit e6fa62a8d2fff999e6c9205fc46926962d66b1e2
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Jun 13 11:12:57 2021 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sat Jun 19 12:01:24 2021 +0200
[NTOS:MM/x64] Fix Interlocked(Compare)ExchangePte and PAGE_FROM_SSE for x64
This fixes using PFNs with more than 20 bits.
---
ntoskrnl/include/internal/mm.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/ntoskrnl/include/internal/mm.h b/ntoskrnl/include/internal/mm.h
index a68359da713..a3a382cbcfc 100644
--- a/ntoskrnl/include/internal/mm.h
+++ b/ntoskrnl/include/internal/mm.h
@@ -159,11 +159,19 @@ typedef ULONG_PTR SWAPENTRY;
#error Unsupported architecture!
#endif
+#ifdef _M_AMD64
+#define InterlockedCompareExchangePte(PointerPte, Exchange, Comperand) \
+ InterlockedCompareExchange64((PLONG64)(PointerPte), Exchange, Comperand)
+
+#define InterlockedExchangePte(PointerPte, Value) \
+ InterlockedExchange64((PLONG64)(PointerPte), Value)
+#else
#define InterlockedCompareExchangePte(PointerPte, Exchange, Comperand) \
InterlockedCompareExchange((PLONG)(PointerPte), Exchange, Comperand)
#define InterlockedExchangePte(PointerPte, Value) \
InterlockedExchange((PLONG)(PointerPte), Value)
+#endif
typedef struct _MM_SECTION_SEGMENT
{
@@ -1282,7 +1290,11 @@ MmFindRegion(
#define IS_DIRTY_SSE(E) ((E) & 2)
#define WRITE_SSE(E) ((E) | 4)
#define IS_WRITE_SSE(E) ((E) & 4)
+#ifdef _WIN64
+#define PAGE_FROM_SSE(E) ((E) & 0xFFFFFFF000ULL)
+#else
#define PAGE_FROM_SSE(E) ((E) & 0xFFFFF000)
+#endif
#define SHARE_COUNT_FROM_SSE(E) (((E) & 0x00000FFC) >> 3)
#define MAX_SHARE_COUNT 0x1FF
#define MAKE_SSE(P, C) ((ULONG_PTR)((P) | ((C) << 3)))