ReactOS 0.4.17-dev-1190-g4c812f4
mm.h
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: MIT (https://spdx.org/licenses/MIT)
4 * PURPOSE: Shared memory management definitions for x86 / x64
5 * COPYRIGHT: Copyright 2026 Ahmed ARIF <arif.ing@outlook.com>
6 */
7
8#pragma once
9
10/* Macros for portable PTE modification */
11#define MI_MAKE_PTE_CACHED(Pte) \
12 do \
13 { \
14 (Pte)->u.Hard.CacheDisable = 0; \
15 (Pte)->u.Hard.WriteThrough = 0; \
16 } while (0)
17
18/* Both bits are set so the PAT index lands on UC, not UC-minus. */
19#define MI_MAKE_PTE_NON_CACHED(Pte) \
20 do \
21 { \
22 (Pte)->u.Hard.CacheDisable = 1; \
23 (Pte)->u.Hard.WriteThrough = 1; \
24 } while (0)
25
26/* PAT1 is programmed as WC, without PAT fall back to UC. */
27#define MI_MAKE_PTE_WRITE_COMBINE(Pte) \
28 do \
29 { \
30 (Pte)->u.Hard.CacheDisable = !(KeFeatureBits & KF_PAT); \
31 (Pte)->u.Hard.WriteThrough = 1; \
32 } while (0)