Skip to content

MemProtect

Changes the protection of a range of the caller's mapped memory.

Number Selector Blocking Since
0x0B SVC_MANAGEMEMORY MNGMEM_PROTECT (2) no 2.0
Err MemProtect(VirtAddr va, size_t size, MemProt new_prot);

Registers: (va, size, prot) -> r0 status

Parameters

Name Direction Description
va in Start of the range, page-aligned.
size in Length in bytes.
new_prot in PROT_READ / PROT_WRITE / PROT_EXEC, but never writable and executable.

Returns

ZUZU_OK, or an error code.

Errors

Error Condition
ERR_NOPERM new_prot is beyond what the mapping was allowed when it was made: the PERM_WRITE / PERM_EXEC of the handle it came from, or what the injector chose.
ERR_BADARG The range is not mapped, not aligned, or the protection is not allowed.