Revert "added get_page_size() to core:mem/virtual"

This commit is contained in:
Jeroen van Rijn
2026-03-24 16:16:24 +01:00
committed by GitHub
parent 48c25fe76e
commit 2d77303b27
5 changed files with 0 additions and 31 deletions

View File

@@ -45,17 +45,6 @@ release :: proc "contextless" (data: rawptr, size: uint) {
_release(data, size)
}
get_page_size :: proc() -> int {
// NOTE(tetra): The page size never changes, so why do anything complicated
// if we don't have to.
@static page_size := -1
if page_size != -1 {
return page_size
}
page_size = _get_page_size()
return page_size
}
Protect_Flag :: enum u32 {
Read,
Write,

View File

@@ -3,7 +3,6 @@
package mem_virtual
import "core:sys/linux"
import "core:sys/posix"
_reserve :: proc "contextless" (size: uint) -> (data: []byte, err: Allocator_Error) {
addr, errno := linux.mmap(0, size, {}, {.PRIVATE, .ANONYMOUS})
@@ -34,10 +33,6 @@ _release :: proc "contextless" (data: rawptr, size: uint) {
_ = linux.munmap(data, size)
}
_get_page_size :: proc() -> int {
return int(posix.sysconf(._PAGE_SIZE))
}
_protect :: proc "contextless" (data: rawptr, size: uint, flags: Protect_Flags) -> bool {
pflags: linux.Mem_Protection
pflags = {}

View File

@@ -21,10 +21,6 @@ _decommit :: proc "contextless" (data: rawptr, size: uint) {
_release :: proc "contextless" (data: rawptr, size: uint) {
}
_get_page_size :: proc() -> int {
return 0
}
_protect :: proc "contextless" (data: rawptr, size: uint, flags: Protect_Flags) -> bool {
return false
}

View File

@@ -20,10 +20,6 @@ _release :: proc "contextless" (data: rawptr, size: uint) {
posix.munmap(data, size)
}
_get_page_size :: proc() -> int {
return int(posix.sysconf(._PAGE_SIZE))
}
_protect :: proc "contextless" (data: rawptr, size: uint, flags: Protect_Flags) -> bool {
#assert(i32(posix.Prot_Flag_Bits.READ) == i32(Protect_Flag.Read))
#assert(i32(posix.Prot_Flag_Bits.WRITE) == i32(Protect_Flag.Write))

View File

@@ -123,13 +123,6 @@ _release :: proc "contextless" (data: rawptr, size: uint) {
VirtualFree(data, 0, MEM_RELEASE)
}
_get_page_size :: proc() -> int {
info: SYSTEM_INFO
GetSystemInfo(&info)
return int(info.dwPageSize)
}
@(no_sanitize_address)
_protect :: proc "contextless" (data: rawptr, size: uint, flags: Protect_Flags) -> bool {
pflags: u32