static int init(void) { unsigned short int i; void *b; lock_static_init(&netif_lock); NET_LOCK_TAKE(); cos_vect_init_static(&tmap); rb_init(&rb1_md_wildcard, &rb1); rb_init(&rb2_md, &rb2); /* Setup the region from which headers will be transmitted. */ if (cos_buff_mgmt(COS_BM_XMIT_REGION, &xmit_headers, sizeof(xmit_headers), 0)) { prints("net: error setting up xmit region."); } /* Wildcard upcall */ if (cos_net_create_net_brand(0, &rb1_md_wildcard)) BUG(); for (i = 0 ; i < NUM_WILDCARD_BUFFS ; i++) { if(!(b = alloc_rb_buff(&rb1_md_wildcard))) { prints("net: could not allocate the ring buffer."); } if(rb_add_buff(&rb1_md_wildcard, b, MTU)) { prints("net: could not populate the ring with buffer"); } } NET_LOCK_RELEASE(); return 0; }
void cos_init(void *arg) { struct cobj_header *h; int num_cobj; LOCK(); cos_vect_init_static(&spd_info_addresses); h = (struct cobj_header *)cos_comp_info.cos_poly[0]; num_cobj = (int)cos_comp_info.cos_poly[1]; boot_find_cobjs(h, num_cobj); /* This component really might need more vas */ if (cos_vas_cntl(COS_VAS_SPD_EXPAND, cos_spd_id(), round_up_to_pgd_page((unsigned long)&num_cobj), round_up_to_pgd_page(1))) { printc("Could not expand boot component to %p:%x\n", (void *)round_up_to_pgd_page((unsigned long)&num_cobj), (unsigned int)round_up_to_pgd_page(1)); BUG(); } printc("h @ %p, heap ptr @ %p\n", h, cos_get_heap_ptr()); printc("header %p, size %d, num comps %d, new heap %p\n", h, h->size, num_cobj, cos_get_heap_ptr()); /* Assumes that hs have been setup with boot_find_cobjs */ boot_create_system(); UNLOCK(); return; }
static void init(void) { cos_vect_init_static(&spd_vect); }
void cos_init(void *arg) { cos_vect_init_static(&bthds); }
static void start_timer_thread(void) { spdid_t spdid = cos_spd_id(); unsigned int tick_freq; INIT_LIST(&events, next, prev); events.thread_id = 0; INIT_LIST(&periodic, next, prev); periodic.thread_id = 0; cos_vect_init_static(&thd_evts); cos_vect_init_static(&thd_periodic); sched_timeout_thd(spdid); tick_freq = sched_tick_freq(); assert(tick_freq == 100); ticks = sched_timestamp(); /* currently timeouts are expressed in ticks, so we don't need this */ // usec_per_tick = USEC_PER_SEC/tick_freq; cyc_per_tick = sched_cyc_per_tick(); // printc("cyc_per_tick = %lld\n", cyc_per_tick); /* When the system boots, we have no pending waits */ assert(EMPTY_LIST(&events, next, prev)); sched_block(spdid, 0); /* Wait for events, then act on expired events. Loop. */ while (1) { event_time_t next_wakeup; cos_mpd_update(); /* update mpd config given this * thread is now in this component * (no dependency if we are in the * same protection domain as the * scheduler) */ ticks = sched_timestamp(); if (sched_component_take(spdid)) { prints("fprr: scheduler lock failed!!!"); BUG(); } event_expiration(ticks); next_wakeup = next_event_time(); /* Are there no pending events??? */ if (TIMER_NO_EVENTS == next_wakeup) { if (sched_component_release(spdid)) { prints("fprr: scheduler lock release failed!!!"); BUG(); } sched_block(spdid, 0); } else { unsigned int wakeup; assert(next_wakeup > ticks); wakeup = (unsigned int)(next_wakeup - ticks); if (sched_component_release(spdid)) { prints("fprr: scheduler lock release failed!!!"); BUG(); } sched_timeout(spdid, wakeup); } } }
static void init(void) { LOCK_INIT(); cos_vect_init_static(&spd_vect); }