10BC0
Skip to content

[NTOS:ARM3] Change calculation for more system PTEs#8613

Merged
DarkFire01 merged 3 commits intoreactos:masterfrom
DarkFire01:PR-MoreSystemPTEs
Mar 5, 2026
Merged

[NTOS:ARM3] Change calculation for more system PTEs#8613
DarkFire01 merged 3 commits intoreactos:masterfrom
DarkFire01:PR-MoreSystemPTEs

Conversation

@DarkFire01
Copy link
Copy Markdown
Contributor
@DarkFire01 DarkFire01 commented Jan 20, 2026

We barely have enough space in system PTEs for more than one 3rd party driver to be loaded in the system, on top of this some drivers (Intel) decide they want more than 32mb! And some (VboxWDDM) want to map a 256mb space!!

I’ve heard multiple times our x86 memory lay out is hard coded and not even sure what it wants to be. So here’s my pitch, because I surely cannot make it worse right?

This allows x86 to run more then 1 or 2 third party drivers. And allows the intel GPU driver to load at all.

Testbot runs (Filled in by Devs)

Before After
MmNonPagedPoolStart 0xb1200000 0xb1d40000
MmNonPagedPoolEnd 0xffbe0000 0xffbe0000
MmSizeOfNonPagedPoolInBytes 0x3fd0000 0x6790000
MmPagedPoolStart 0xe1000000 0xe1000000
MmPagedPoolEnd 0xecbfffff 0xxf77fffff
MmSizeOfPagedPoolInBytes 0xbc00000 0x16800000
MmNumberOfSystemPtes 0xafdf 0x2bbff

@github-actions github-actions bot added the kernel&hal Code changes to the ntoskrnl and HAL label Jan 20, 2026
@DarkFire01
Copy link
Copy Markdown
Contributor Author
DarkFire01 commented Jan 20, 2026
image

IMG_7402

Whoa GPUs!

@binarymaster binarymaster added the enhancement For PRs with an enhancement/new feature. label Jan 20, 2026
@HBelusca
Copy link
Copy Markdown
Contributor

@DarkFire01
Copy link
Copy Markdown
Contributor Author

@HBelusca
Copy link
Copy Markdown
Contributor
HBelusca commented Jan 20, 2026

I suppose you've seen this text? https://git.reactos.org/?p=reactos.git;a=blob;f=ntoskrnl/mm/ARM3/mminit.c;hb=fc75870f1c127d7b5ffc51ba0c21571f1430f3ae#l44

I have and I don’t think this PR completely violates the root point that was made.

Out of curiosity, on your test system where the VboxWDDM would crash otherwise, what are the typical values of the following variables just before your fixup code is being run? :
MmNonPagedPoolStart, MmNonPagedSystemStart, MmNumberOfSystemPtes and NonPagedSystemSize, as well as your new PagedPoolEnd variable ?

@DarkFire01
Copy link
Copy Markdown
Contributor Author

Out of curiosity, on your test system where the VboxWDDM would crash otherwise, what are the typical values of the following variables just before your fixup code is being run? : MmNonPagedPoolStart, MmNonPagedSystemStart, MmNumberOfSystemPtes and NonPagedSystemSize, as well as your new PagedPoolEnd variable ?

I don't mind going and getting these, but id rather do it with the intel gpu driver which needs less extra stuff to make it work.

@obsolete-is-better
Copy link
Copy Markdown

The nvidia forceSW opengl bug appears to be resolved with this PR
nvidia vsync off

Testing this did require an additional patch due to a regression effecting nvidia drivers
HBelusca@f9c1105

and a registry change to disable vsync
nvidia_opengl_disable_vsync.reg.txt

@tkreuzer
Copy link
Copy Markdown
Contributor

Btw, the memory layout(s) can be found here: https://reactos.org/wiki/Techwiki:Memory_Layout

@DarkFire01 DarkFire01 force-pushed the PR-MoreSystemPTEs branch 2 times, most recently from f669d66 to 0c759a5 Compare January 30, 2026 21:49
@DarkFire01
Copy link
Copy Markdown
Contributor Author

This PR has been rewritten one more time.

(ntoskrnl\mm\mminit.c:139)           0x80000000 - 0x83000000	Boot Loaded Image
(ntoskrnl\mm\mminit.c:144)           0x83000000 - 0xB0000000	System PTE Space
(ntoskrnl\mm\mminit.c:148)           0xB0000000 - 0xB0083000	PFN Database
(ntoskrnl\mm\mminit.c:152)           0xB0083000 - 0xB0283000	ARM3 Non Paged Pool
(ntoskrnl\mm\mminit.c:156)           0xB9400000 - 0xBB400000	System View Space
(ntoskrnl\mm\mminit.c:160)           0xBB400000 - 0xC0000000	Session Space
(ntoskrnl\mm\mminit.c:163)           0xC0000000 - 0xC03FFFFF	Page Tables
(ntoskrnl\mm\mminit.c:166)           0xC0300000 - 0xC0300FFF	Page Directories
(ntoskrnl\mm\mminit.c:169)           0xC0400000 - 0xC07FFFFF	Hyperspace
(ntoskrnl\mm\mminit.c:172)           0xC1000000 - 0xE0FFFFFF	System Cache
(ntoskrnl\mm\mminit.c:176)           0xE1000000 - 0xE3800000	ARM3 Paged Pool
(ntoskrnl\mm\mminit.c:179)           0xFEB2E000 - 0xFFBE0000	Non Paged Pool Expansion PTE Space

opting for the system PTE region being placed in the unused space after Boot Loaded Image
this means another look is appreciated :) as that's a bit more complicated of a change and we want to make sure I didn't do something wrong.

Of course before anyone asks 58MBs of ram still boots
image

@DarkFire01
Copy link
Copy Markdown
Contributor Author

finally squeezed an updated ttest run out of the bots
https://reactos.org/testman/compare.php?ids=105882,105895,105920

729A
@DarkFire01 DarkFire01 force-pushed the PR-MoreSystemPTEs branch 2 times, most recently from cdf0155 to 670c91e Compare February 9, 2026 03:53
@DarkFire01 DarkFire01 changed the title [NTOS:ARM3] i386 specific: Change calculation for more system PTEs [NTOS:ARM3] Change calculation for more system PTEs Feb 11, 2026
@DarkFire01 DarkFire01 requested a review from tkreuzer February 11, 2026 14:49
@HBelusca
Copy link
Copy Markdown
Contributor
HBelusca commented Feb 16, 2026

Not sure I'm fully understanding your table right:

Before After
MmNonPagedPoolStart 0xb1200000 0xb1d40000
MmNonPagedPoolEnd 0xffbe0000 0xffbe0000
MmSizeOfNonPagedPoolInBytes 0x3fd0000 0x6790000

So, in the "After" case, the nonpaged pool starts at an higher address than in the "Before" case, yet at the same time they both end up at the same address (thus, the nonpaged pool range in the "After" case is slightly smaller). And yet, in the "After" case, the size of the nonpaged pool is larger ?! Something is fishy.

@HBelusca
Copy link
Copy Markdown
Contributor

For extra reference I'm linking some literature on the x86 memory map and the "known" (from public debugger symbols) global Mm variables that are also used by WinDbg for diagnostics:
https://techcommunity.microsoft.com/blog/askperf/memory-management---x86-virtual-address-space/372536
https://flylib.com/books/en/4.491.1.61/1/
https://www.cs.miami.edu/home/burt/journal/NT/memory.html

@DarkFire01
Copy link
Copy Markdown
Contributor Author
DarkFire01 commented Feb 25, 2026

Not sure I'm fully understanding your table right:
Before After
MmNonPagedPoolStart 0xb1200000 0xb1d40000
MmNonPagedPoolEnd 0xffbe0000 0xffbe0000
MmSizeOfNonPagedPoolInBytes 0x3fd0000 0x6790000

So, in the "After" case, the nonpaged pool starts at an higher address than in the "Before" case, yet at the same time they both end up at the same address (thus, the nonpaged pool range in the "After" case is slightly smaller). And yet, in the "After" case, the size of the nonpaged pool is larger ?! Something is fishy.

Now that i got a brain, uh
So MmSizeOfNonPagedPoolInBytes is not supposed to equal MmNonPagedPoolEnd - MmNonPagedPoolStart i thought.
https://git.reactos.org/?p=reactos.git;a=blob;f=ntoskrnl/mm/ARM3/mminit.c;hb=fc75870f1c127d7b5ffc51ba0c21571f1430f3ae#l44

    //
    // Non paged pool comes after the PFN database
    //
    MmNonPagedPoolStart = (PVOID)((ULONG_PTR)MmPfnDatabase +
                                  (MxPfnAllocation << PAGE_SHIFT));

Unless I'm misunderstanding something here?

This gets assigned twice.
Don't me wrong, Not a lot of our memory manager's regions on x86 makes sense. and the codes documentation doesn't do a good job of explaining WHY imo, but i THINK this is fine?

@HBelusca
Copy link
Copy Markdown
Contributor

This gets assigned twice. Don't me wrong, Not a lot of our memory manager's regions on x86 makes sense. and the codes documentation doesn't do a good job of explaining WHY imo, but i THINK this is fine?

I'll see. In the meantime, could you check this other question? -> #8613 (comment)

@DarkFire01
Copy link
Copy Markdown
Contributor Author

This gets assigned twice. Don't me wrong, Not a lot of our memory manager's regions on x86 makes sense. and the codes documentation doesn't do a good job of explaining WHY imo, but i THINK this is fine?

I'll see. In the meantime, could you check this other question? -> #8613 (comment)

I added an initialization for it.

* Keep MmNonPagedSystemStart initialized for debugger (KD/Windbg) use.
* On x86 ARM3, the System PTE space is placed in the loader-gap region.
*/
MmNonPagedSystemStart = MmSystemPteSpaceStart;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍

@DarkFire01 DarkFire01 force-pushed the PR-MoreSystemPTEs branch 2 times, most recently from 63e8d97 to 53933d0 Compare March 5, 2026 05:04
@github-actions github-actions bot added the ROSTESTS Label for ROS testcases PRs. label Mar 5, 2026
@DarkFire01 DarkFire01 merged commit 4cba65d into reactos:master Mar 5, 2026
66 of 67 checks passed
@DarkFire01 DarkFire01 deleted the PR-MoreSystemPTEs branch March 8, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement For PRs with an enhancement/new feature. kernel&hal Code changes to the ntoskrnl and HAL ROSTESTS Label for ROS testcases PRs.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

0