Enter restricted mode


#include <zircon/syscalls-next.h>

zx_status_t zx_restricted_enter(uint32_t options,
                                uintptr_t vector_table_ptr,
                                uintptr_t context);


Enters restricted mode from normal thread state. If successful, the current thread will return to normal mode via an entry point passed in vector_table_ptr.

vector_table_ptr must be within the current user address space. context may be any value. It is used as a value to pass back to normal mode when returning from restricted mode.

options must be zero.

Arguments to the function at vector_table_ptr are architecturally specific:

On x64, context is placed in rdi and an exception code is played in rsi. All other registers are currently undefined, including the stack pointer.

ARM64 support is currently unimplemented.

Currently, the exception code passed back to normal mode is always 0.


None (currently)

Return value

No return value on success, since the current thread indirectly returns via vector_table_ptr. In the event of failure, a negative error value is returned.


ZX_ERR_INVALID_ARGS vector_table_ptr is not a valid user address or options is non-zero.

ZX_ERR_BAD_STATE restricted mode register state is invalid. See zx_restricted_write_state() for details.

See also