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;
}
Ejemplo n.º 2
0
static inline void
mm_init(void)
{
	printc("core %ld: mm init as thread %d\n", cos_cpuid(), cos_get_thd_id());

	/* Expanding VAS. */
	printc("mm expanding %lu MBs @ %p\n", (NREGIONS-1) * round_up_to_pgd_page(1) / 1024 / 1024, 
	       (void *)round_up_to_pgd_page((unsigned long)&cos_comp_info.cos_poly[1]));
	if (cos_vas_cntl(COS_VAS_SPD_EXPAND, cos_spd_id(), 
			 round_up_to_pgd_page((unsigned long)&cos_comp_info.cos_poly[1]), 
			 (NREGIONS-1) * round_up_to_pgd_page(1))) {
		printc("MM could not expand VAS\n");
		BUG();
	}

	frame_init();
	printc("core %ld: mm init done\n", cos_cpuid());
}