Page 1 of 1

[SOLVED] Strange Windows API function

Posted: Thu Sep 09, 2021 10:50 am
by Rukog
While coding in C# I found this strange looking function
https://docs.microsoft.com/en-us/dotnet ... empagesize

It returns the page size in bytes from paging mechanism.

Ive printed its value and it shows me 4096-Byte.
Does it mean this value can be different among 4-KByte Page 2-MByte Page and 1-GByte Page ?

It's strange that user level can get a such kernel related information.

Re: Strange Windows API function

Posted: Thu Sep 09, 2021 12:24 pm
by Octocontrabass
Windows NT was originally written to run on several different non-x86 platforms, and some of them did not support 4kiB pages.

Userspace needs to know the page size because memory management operates at page granularity.