Added dev_init, dev_init called from ctx_switch.c before dispatch_nosave calls ctx_switch_half, and also added wrapper for event_wait