/*===========================================================================* * sef_local_startup * *===========================================================================*/ static void sef_local_startup() { mmc_log_info(&log, "Initializing the MMC block device\n"); if (apply_env()) { mmc_log_warn(&log, "Failed while applying environment settings\n"); exit(EXIT_FAILURE); } if (host.host_init(&host)) { mmc_log_warn(&log, "Failed to initialize the host controller\n"); exit(EXIT_FAILURE); } /* * Register callbacks for fresh start, live update and restart. * Use the same function for all event types */ sef_setcb_init_fresh(block_system_event_cb); sef_setcb_init_lu(block_system_event_cb); /* Register a signal handler */ sef_setcb_signal_handler(block_signal_handler_cb); /* SEF startup */ sef_startup(); }
static void sef_local_startup(void) { sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_signal_handler(sef_cb_signal_handler); sef_startup(); }
/*===========================================================================* * sef_local_startup * *===========================================================================*/ PRIVATE void sef_local_startup(void) { sef_setcb_init_fresh(init_server); sef_setcb_init_restart(init_server); sef_setcb_signal_handler(got_signal); /* No support for live update yet. */ sef_startup(); }
/*===========================================================================* * sef_local_startup * *===========================================================================*/ static void sef_local_startup(void) { /* Perform local SEF initialization. */ sef_setcb_init_fresh(vbox_init); sef_setcb_init_restart(vbox_init); sef_setcb_signal_handler(vbox_signal); sef_startup(); }
/* * Set callbacks and initialize the System Event Framework (SEF). */ static void vnd_startup(void) { /* Register init and signal callbacks. */ sef_setcb_init_fresh(vnd_init); sef_setcb_signal_handler(vnd_signal); /* Let SEF perform startup. */ sef_startup(); }
/*===========================================================================* * sef_local_startup * *===========================================================================*/ static void sef_local_startup(void) { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fresh); sef_setcb_init_lu(sef_cb_init_fresh); /* Register signal callback. */ sef_setcb_signal_handler(sef_cb_signal_handler); /* Let SEF perform startup. */ sef_startup(); }
/*===========================================================================* * sef_local_startup * *===========================================================================*/ static void sef_local_startup() { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fresh); /* No live update support for now. */ /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); /* Let SEF perform startup. */ sef_startup(); }
static void sef_local_startup() { sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_lu(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fresh); sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_workfree); sef_setcb_signal_handler(sef_cb_signal_handler); sef_startup(); }
/*===========================================================================* * usbd_init * *===========================================================================*/ static void usbd_init(void) { /* No DEBUG_DUMP, threading unavailable yet */ /* Set one handler for all messages */ sef_setcb_init_fresh(usbd_sef_handler); sef_setcb_init_lu(usbd_sef_handler); sef_setcb_init_restart(usbd_sef_handler); /* Initialize DDEkit (involves sef_startup()) */ ddekit_init(); /* After threading initialization, add signal handler */ sef_setcb_signal_handler(usbd_signal_handler); }
/*===========================================================================* * sef_local_startup * *===========================================================================*/ static void sef_local_startup() { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); /* Register live update callbacks. */ sef_setcb_lu_prepare(sef_cb_lu_prepare); sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid); sef_setcb_lu_state_dump(sef_cb_lu_state_dump); /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); /* Let SEF perform startup. */ sef_startup(); }
/*===========================================================================* * sef_local_startup * *===========================================================================*/ PRIVATE void sef_local_startup() { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_lu(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fresh); /* Register live update callbacks. */ sef_setcb_lu_prepare(sef_cb_lu_prepare_always_ready); sef_setcb_lu_state_isvalid(sef_cb_lu_state_isvalid_workfree); /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); /* Let SEF perform startup. */ sef_startup(); }
/*===========================================================================* * sef_local_startup * *===========================================================================*/ PRIVATE void sef_local_startup() { /* Register init callbacks. */ sef_setcb_init_response(do_init_ready); sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_fail); /* Register live update callbacks. */ sef_setcb_lu_response(do_upd_ready); /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); sef_setcb_signal_manager(sef_cb_signal_manager); /* Let SEF perform startup. */ sef_startup(); }
/*===========================================================================* * sef_local_startup * *===========================================================================*/ static void sef_local_startup() { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_restart(sef_cb_init_restart); sef_setcb_init_lu(sef_cb_init_lu); /* Register response callbacks. */ sef_setcb_init_response(sef_cb_init_response); sef_setcb_lu_response(sef_cb_lu_response); /* Register signal callbacks. */ sef_setcb_signal_handler(sef_cb_signal_handler); sef_setcb_signal_manager(sef_cb_signal_manager); /* Let SEF perform startup. */ sef_startup(); }
/*===========================================================================* * main * *===========================================================================*/ int main(void) { message msg; int result, who_e, rcv_sts; int caller_slot; /* Initialize system so that all processes are runnable */ init_vm(); /* Register init callbacks. */ sef_setcb_init_restart(sef_cb_init_fail); sef_setcb_signal_handler(sef_cb_signal_handler); /* Let SEF perform startup. */ sef_startup(); SANITYCHECK(SCL_TOP); /* This is VM's main loop. */ while (TRUE) { int r, c; u32_t type, param; SANITYCHECK(SCL_TOP); if(missing_spares > 0) { alloc_cycle(); /* mem alloc code wants to be called */ } if ((r=sef_receive_status(ANY, &msg, &rcv_sts)) != OK) panic("sef_receive_status() error: %d", r); if (is_ipc_notify(rcv_sts)) { /* Unexpected notify(). */ printf("VM: ignoring notify() from %d\n", msg.m_source); continue; } who_e = msg.m_source; if(vm_isokendpt(who_e, &caller_slot) != OK) panic("invalid caller %d", who_e); type = param = msg.m_type; type &= 0x0000FFFF; param >>= 16; c = CALLNUMBER(type); result = ENOSYS; /* Out of range or restricted calls return this. */ if(msg.m_type == RS_INIT && msg.m_source == RS_PROC_NR) { result = do_rs_init(&msg); } else if (msg.m_type == VM_PAGEFAULT) { if (!IPC_STATUS_FLAGS_TEST(rcv_sts, IPC_FLG_MSG_FROM_KERNEL)) { printf("VM: process %d faked VM_PAGEFAULT " "message!\n", msg.m_source); } do_pagefaults(&msg); /* * do not reply to this call, the caller is unblocked by * a sys_vmctl() call in do_pagefaults if success. VM panics * otherwise */ continue; } else if(c < 0 || !vm_calls[c].vmc_func) { /* out of range or missing callnr */ } else { if (acl_check(&vmproc[caller_slot], c) != OK) { printf("VM: unauthorized %s by %d\n", vm_calls[c].vmc_name, who_e); } else { SANITYCHECK(SCL_FUNCTIONS); result = vm_calls[c].vmc_func(&msg); SANITYCHECK(SCL_FUNCTIONS); } } /* Send reply message, unless the return code is SUSPEND, * which is a pseudo-result suppressing the reply message. */ if(result != SUSPEND) { msg.m_type = result; if((r=send(who_e, &msg)) != OK) { printf("VM: couldn't send %d to %d (err %d)\n", msg.m_type, who_e, r); panic("send() error"); } } } return(OK); }