1/* 2 * Copyright 2017, Data61 3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4 * ABN 41 687 119 230. 5 * 6 * This software may be distributed and modified according to the terms of 7 * the BSD 2-Clause license. Note that NO WARRANTY is provided. 8 * See "LICENSE_BSD2.txt" for details. 9 * 10 * @TAG(DATA61_BSD) 11 */ 12#pragma once 13 14#include <vspace/vspace.h> 15 16/** 17 * Allocate a new stack and start running func on it. 18 * If func returns, you will be back on the old stack. 19 * 20 * @param vspace interface to allocate stack with 21 * @param func to jump to with the new stack. 22 * @param arg to pass to func. 23 * @param[out] retval The return value of func is written to this pointer if it is non-null 24 * @ret 0 on success or -1 if stack allocation fails. 25 * 26 */ 27int sel4utils_run_on_stack(vspace_t *vspace, void * (*func)(void *arg), void *arg, void **retval); 28 29