fixed default page size on posix

This commit is contained in:
Carlyle
2026-03-24 22:28:32 -07:00
parent b169c048fe
commit df7af333d4
2 changed files with 7 additions and 5 deletions

View File

@@ -6,7 +6,7 @@ import "core:sys/posix"
@(init, private, no_sanitize_address)
query_page_size_init :: proc "contextless" () {
size := posix.sysconf(._PAGESIZE)
PAGE_SIZE = int(max(size, 4096))
PAGE_SIZE = max(PAGE_SIZE, int(size))
// is power of two
assert_contextless(PAGE_SIZE != 0 && (PAGE_SIZE & (PAGE_SIZE-1)) == 0)

View File

@@ -5,10 +5,12 @@ import "core:sys/windows"
@(init, private, no_sanitize_address)
query_page_size_init :: proc "contextless" () {
sys_info: windows.SYSTEM_INFO
windows.GetSystemInfo(&sys_info)
PAGE_SIZE = max(PAGE_SIZE, int(sys_info.dwPageSize))
info: windows.SYSTEM_INFO
windows.GetSystemInfo(&info)
size := info.dwPageSize
PAGE_SIZE = max(PAGE_SIZE, int(size))
// is power of two
assert_contextless(PAGE_SIZE != 0 && (PAGE_SIZE & (PAGE_SIZE-1)) == 0)
}