PageProtection
Description
Page-level memory protection bits. The actual OS permissions are platform-mapped: POSIX uses mprotect with PROT_* combinations; Windows uses VirtualProtect with PAGE_*.
Fields
| Name | Description |
|---|---|
PAGE_PROT_NONE |
Reads, writes, and executes all trap. Use for guard pages or to make a freed region trap on any dangling-pointer access. |
PAGE_PROT_READ |
Reads allowed, writes/executes trap. Use for after-init read-only tables. |
PAGE_PROT_READ_WRITE |
Reads and writes allowed. The default state for freshly-allocated memory. |
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Page.c:156:
}
bool PageProtect(void *ptr, size bytes, PageProtection prot) {
if (!ptr || !bytes) {
return false;- In
Page.h:70:
PAGE_PROT_READ = 1,
PAGE_PROT_READ_WRITE = 2,
} PageProtection;
///
- In
Page.h:90:
/// TAGS: Allocator, Page, Memory-Protection
///
bool PageProtect(void *ptr, size bytes, PageProtection prot);
///
Last updated on