zephyr::raw

Function k_thread_user_mode_enter

Source
pub unsafe extern "C" fn k_thread_user_mode_enter(
    entry: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut c_void, _: *mut c_void)>,
    p1: *mut c_void,
    p2: *mut c_void,
    p3: *mut c_void,
) -> !
Expand description

@brief Drop a thread’s privileges permanently to user mode

This allows a supervisor thread to be re-used as a user thread. This function does not return, but control will transfer to the provided entry point as if this was a new user thread.

The implementation ensures that the stack buffer contents are erased. Any thread-local storage will be reverted to a pristine state.

Memory domain membership, resource pool assignment, kernel object permissions, priority, and thread options are preserved.

A common use of this function is to re-use the main thread as a user thread once all supervisor mode-only tasks have been completed.

@param entry Function to start executing from @param p1 1st entry point parameter @param p2 2nd entry point parameter @param p3 3rd entry point parameter