23 #include "precompiled.h"
33 # define MAP_ANONYMOUS MAP_ANON
72 (void)
Protect(address, size, prot);
86 bool Protect(uintptr_t address,
size_t size,
int prot)
89 if(
mprotect((
void*)address, size, prot) != 0)
104 if(!
Commit(uintptr_t(p), size, pageType, prot))
113 void Free(
void* p,
size_t size)
#define UNUSED(param)
mark a function parameter as unused and avoid the corresponding compiler warning. ...
void BeginOnDemandCommits()
install a handler that attempts to commit memory whenever a read/write page fault is encountered...
int mprotect(void *addr, size_t len, int prot)
bool Commit(uintptr_t address, size_t size, PageType pageType, int prot)
map physical memory to previously reserved address space.
#define ENSURE(expr)
ensure the expression <expr> evaluates to non-zero.
void * mmap(void *start, size_t len, int prot, int flags, int fd, off_t ofs)
void EndOnDemandCommits()
decrements the reference count begun by BeginOnDemandCommit and removes the page fault handler when i...
bool Decommit(uintptr_t address, size_t size)
unmap physical memory.
const Status INVALID_PARAM
bool Protect(uintptr_t address, size_t size, int prot)
set the memory protection flags for all pages that intersect the given interval.
#define DEBUG_WARN_ERR(status)
display the error dialog with text corresponding to the given error code.
static const int mmap_flags
void ReleaseAddressSpace(void *p, size_t size)
release address space and decommit any memory.
void * Allocate(size_t size, PageType pageType, int prot)
reserve address space and commit memory.
int munmap(void *start, size_t len)
void * ReserveAddressSpace(size_t size, size_t commitSize, PageType pageType, int prot)
reserve address space and set the parameters for any later on-demand commits.
void Free(void *p, size_t size)
decommit memory and release address space.