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
13#include <autoconf.h>
14#include <rumprun/gen_config.h>
15
16#include <rumprun/init_data.h>
17#include <simple/simple.h>
18#include <utils/util.h>
19#include <utils/attribute.h>
20#include <sel4/helpers.h>
21#include <rumprun/custom_simple.h>
22#include <sel4runtime.h>
23#include <muslcsys/vsyscall.h>
24
25int init_rumprun(custom_simple_t *custom_simple);
26
27static void CONSTRUCTOR(MUSLCSYS_WITH_VSYSCALL_PRIORITY) pre_init(void)
28{
29    ZF_LOGF_IF(sel4runtime_argc() != 2, "Incorrect number of arguments passed");
30    seL4_CPtr endpoint = (seL4_CPtr) atoi(sel4runtime_argv()[1]);
31    env.custom_simple.simple = &env.simple;
32    simple_init_rumprun(&env.custom_simple, endpoint);
33    preinit_rumprun(&env.custom_simple);
34    printf("Rumprun app initialised");
35}
36
37int main(int argc, char **argv)
38{
39    return init_rumprun(&env.custom_simple);
40}
41