Exemplo n.º 1
0
Arquivo: main.c Projeto: 8l/barrelfish
static errval_t boot_app_core(int argc, char *argv[])
{
    coreid_t parent_core_id;
    struct intermon_binding *intermon_binding;
    errval_t err;

#ifndef __scc__
    /* Create the self endpoint as the kernel doesn't do it */
    err = cap_retype(cap_selfep, cap_dispatcher, ObjType_EndPoint, 0);
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "Retyping dispatcher to self ep failed");
        return err;
    }
#endif

    err = boot_arch_app_core(argc, argv, &parent_core_id, &intermon_binding);
    if(err_is_fail(err)) {
        return err;
    }

    // connect it to our request handlers
    intermon_init(intermon_binding, parent_core_id);

    /* Request memserv and nameserv iref */
#ifndef __scc__
    err = request_mem_serv_iref(intermon_binding);
    assert(err_is_ok(err));
#endif
    err = request_name_serv_iref(intermon_binding);
    assert(err_is_ok(err));

    err = request_ramfs_serv_iref(intermon_binding);
    assert(err_is_ok(err));


#ifdef BARRELFISH_MULTIHOP_CHAN_H
    // request my part of the routing table
    err = multihop_request_routing_table(intermon_binding);
    assert(err_is_ok(err));
#endif // BARRELFISH_MULTIHOP_CHAN_H

#ifndef __scc__
    /* initialize self ram alloc */
    err = mon_ram_alloc_init(parent_core_id, intermon_binding);
    if (err_is_fail(err)) {
        return err_push(err, LIB_ERR_RAM_ALLOC_SET);
    }
#endif

    /* with memory alloc running, take part in cap ops */
    DEBUG_CAPOPS("sending capops_ready to %"PRIuCOREID"\n", parent_core_id);
    err = intermon_binding->tx_vtbl.capops_ready(intermon_binding, NOP_CONT);
    if (err_is_fail(err)) {
        return err_push(err, MON_ERR_SEND_REMOTE_MSG);
    }
    ((struct intermon_state*)intermon_binding->st)->capops_ready = true;

    /* Set up monitor rpc channel */
    err = monitor_rpc_init();
    if(err_is_fail(err)) {
        return err;
    }

#ifdef TRACING_EXISTS
    // Request trace caps
    err = request_trace_caps(intermon_binding);
    assert(err_is_ok(err));
#endif

    // Spawn local spawnd
#ifdef __scc__
    err = spawn_domain("spawnd");
#else
    err = spawn_spawnd(intermon_binding);
#endif
    if (err_is_fail(err)) {
        USER_PANIC_ERR(err, "error spawning spawnd");
    }

    /* Signal the monitor that booted us that we have initialized */
    err = intermon_binding->tx_vtbl.monitor_initialized(intermon_binding, NOP_CONT);
    if (err_is_fail(err)) {
        return err_push(err, MON_ERR_SEND_REMOTE_MSG);
    }

    return SYS_ERR_OK;
}
Exemplo n.º 2
0
Arquivo: main.c Projeto: 8l/barrelfish
/**
 * \brief Initialize monitor running on bsp core
 */
static errval_t boot_bsp_core(int argc, char *argv[])
{
    errval_t err;

    // First argument contains the bootinfo location
    bi = (struct bootinfo*)strtol(argv[1], NULL, 10);

    bsp_monitor = true;

    err = monitor_client_setup_mem_serv();
    assert(err_is_ok(err));

    /* Wait for mem_serv to advertise its iref to us */
    while (mem_serv_iref == 0) {
        messages_wait_and_handle_next();
    }
    update_ram_alloc_binding = false;

    /* Can now connect to and use mem_serv */
    err = ram_alloc_set(NULL);
    if (err_is_fail(err)) {
        return err_push(err, LIB_ERR_RAM_ALLOC_SET);
    }

    // Export ram_alloc service
    err = mon_ram_alloc_serve();
    assert(err_is_ok(err));

    /* Set up monitor rpc channel */
    err = monitor_rpc_init();
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "monitor rpc init failed");
        return err;
    }

    /* SKB needs vfs for ECLiPSe so we need to start ramfsd first... */
    err = spawn_domain("ramfsd");
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "failed spawning ramfsd");
        return err;
    }
    // XXX: Wait for ramfsd to initialize
    while (ramfs_serv_iref == 0) {
        messages_wait_and_handle_next();
    }

    /* Spawn skb (new nameserver) before other domains */
    err = spawn_domain("skb");
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "failed spawning skb");
        return err;
    }
    // XXX: Wait for name_server to initialize
    while (name_serv_iref == 0) {
        messages_wait_and_handle_next();
    }
#ifdef __k1om__
    char args[40];
    snprintf(args, sizeof(args), "0x%016lx 0x%02x", bi->host_msg,
             bi->host_msg_bits);
    char *mgr_argv[MAX_CMDLINE_ARGS + 1];
    spawn_tokenize_cmdargs(args, mgr_argv, ARRAY_LENGTH(mgr_argv));
    err = spawn_domain_with_args("xeon_phi", mgr_argv,environ);
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "failed spawning xeon_phi");
        return err;
    }
#endif

    /* Spawn boot domains in menu.lst */
    err = spawn_all_domains();
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "spawn_all_domains failed");
        return err;
    }

    return SYS_ERR_OK;
}
Exemplo n.º 3
0
/**
 * \brief Initialize monitor running on bsp core
 */
static errval_t boot_bsp_core(int argc, char *argv[])
{
    errval_t err;

    // First argument contains the bootinfo location
    bi = (struct bootinfo*)strtol(argv[1], NULL, 10);

    bsp_monitor = true;

    err = monitor_client_setup_mem_serv();
    assert(err_is_ok(err));

    /* Wait for mem_serv to advertise its iref to us */
    while (mem_serv_iref == 0) {
        messages_wait_and_handle_next();
    }
    update_ram_alloc_binding = false;

    /* Can now connect to and use mem_serv */
    err = ram_alloc_set(NULL);
    if (err_is_fail(err)) {
        return err_push(err, LIB_ERR_RAM_ALLOC_SET);
    }

    // Export ram_alloc service
    err = mon_ram_alloc_serve();
    assert(err_is_ok(err));

    /* Set up monitor rpc channel */
    err = monitor_rpc_init();
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "monitor rpc init failed");
        return err;
    }

    /* SKB needs vfs for ECLiPSe so we need to start ramfsd first... */
    err = spawn_domain("ramfsd");
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "failed spawning ramfsd");
        return err;
    }
    // XXX: Wait for ramfsd to initialize
    while (ramfs_serv_iref == 0) {
        messages_wait_and_handle_next();
    }

    /* Spawn skb (new nameserver) before other domains */
    err = spawn_domain("skb");
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "failed spawning skb");
        return err;
    }
    // XXX: Wait for name_server to initialize
    while (name_serv_iref == 0) {
        messages_wait_and_handle_next();
    }

    /* initialise rcap_db */
    err = rcap_db_init(); 
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "monitor rcap_db init failed");
        return err;
    }

    /* Spawn boot domains in menu.lst */
    err = spawn_all_domains();
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "spawn_all_domains failed");
        return err;
    }

    return SYS_ERR_OK;
}