Skip to content

MemMapAnon

Maps fresh zeroed memory, backed by no object, into the caller's address space.

Number Selector Blocking Since
0x0B SVC_MANAGEMEMORY MNGMEM_MAP (0) (HANDLE_ANON) no 2.0
void * MemMapAnon(size_t size, VirtAddr hint_va, MemProt prot);

Registers: (HANDLE_ANON, size, hint | prot) -> r0 address or error

Pages are allocated on first touch.

Parameters

Name Direction Description
size in Size in bytes.
hint_va in Page-aligned address to map at, or 0 to let the kernel choose.
prot in PROT_READ / PROT_WRITE / PROT_EXEC.

Returns

The mapped address, or an error encoded as a pointer; check with PtrIsErr().

Errors

Error Condition
ERR_BADARG size or hint_va is unusable.
ERR_OVERFLOW size is too large.
ERR_NOMEM No address space left.