From ef2496f4914c5e1a246c8cf55a3f1fc3540e88ab Mon Sep 17 00:00:00 2001 From: zhanghm18 <142378820+zhanghm18GIT@users.noreply.github.com> Date: Sun, 26 Jul 2026 23:05:25 +0800 Subject: [PATCH 1/2] Complete HEAPMNG full-range bookkeeping --- hooks/HFix4GB.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hooks/HFix4GB.cpp b/hooks/HFix4GB.cpp index 5c151181..e98f1645 100644 --- a/hooks/HFix4GB.cpp +++ b/hooks/HFix4GB.cpp @@ -1,6 +1,8 @@ asm( + // Allocate one 4-byte map entry for every 4 KiB page in the complete + // 32-bit virtual address space: 0x100000 entries * 4 = 0x400000 bytes. ".section h0; .set h0,0x957E35;" - "PUSH 0x3FF000;" + "PUSH 0x400000;" ".section h1; .set h1,0x915A92;" "ADD EAX,EAX;" @@ -11,4 +13,9 @@ asm( ".section h2; .set h2,0x915B05;" "JMP .-0x73;" -); \ No newline at end of file + + // Keep 0x100000 as the one-past-end page index while allowing free + // regions in the 3-4 GiB range to coalesce with a right neighbour. + ".section h3; .set h3,0x958107;" + "CMP EAX,0x100000;" +); From a402f341ddb0b09cea67ed115dd7bfe91f87a464 Mon Sep 17 00:00:00 2001 From: zhanghm18 <142378820+zhanghm18GIT@users.noreply.github.com> Date: Sun, 26 Jul 2026 23:06:55 +0800 Subject: [PATCH 2/2] Document HEAPMNG full-range bookkeeping --- changelog.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index be9a8470..a5e35d1b 100644 --- a/changelog.md +++ b/changelog.md @@ -155,7 +155,7 @@ These don't matter except for other assembly patches ## Improvements -- Allows to use 4GB on x64 +- Complete HEAPMNG page-map coverage and enable free-region coalescing across the 3-4 GiB range on x64. - hooks/HFix4GB.cpp