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 int boot_spd_map_memory(struct cobj_header *h, spdid_t spdid, vaddr_t comp_info)
{
	unsigned int i;
	vaddr_t dest_daddr;

	local_md[spdid].spdid = spdid;
	local_md[spdid].h = h;
	local_md[spdid].page_start = cos_get_heap_ptr();
	local_md[spdid].comp_info = comp_info;
	for (i = 0 ; i < h->nsect ; i++) {
		struct cobj_sect *sect;
		char *dsrc;
		int left;

		sect = cobj_sect_get(h, i);
		dest_daddr = sect->vaddr;
		left = cobj_sect_size(h, i);

		while (left > 0) {
			dsrc = cos_get_vas_page();
			if ((vaddr_t)dsrc != mman_get_page(cos_spd_id(), (vaddr_t)dsrc, 0)) BUG();
			if (dest_daddr != (mman_alias_page(cos_spd_id(), (vaddr_t)dsrc, spdid, dest_daddr))) BUG();

			dest_daddr += PAGE_SIZE;
			left -= PAGE_SIZE;
		}
	}
	local_md[spdid].page_end = (void*)dest_daddr;

	return 0;
}
static void parse_initialization_strings(void)
{
	int i;

	init_strs = (struct component_init_str*)((char*)cos_get_heap_ptr()-PAGE_SIZE);
	for (i = 1 ; init_strs[i].spdid ; i++) ;
	//printc("initialization string for %d is %s\n", init_strs[i].spdid, init_strs[i].init_str);
}
Ejemplo n.º 4
0
void *cos_get_vas_page(void)
{
	char *h;
	long r;
	do {
		h = cos_get_heap_ptr();
		r = (long)h+PAGE_SIZE;
	} while (cos_cmpxchg(&cos_comp_info.cos_heap_ptr, (long)h, r) != r);
	return h;
}
Ejemplo n.º 5
0
void
vm_init(void *d)
{
	vmid = (int)d;
	cos_meminfo_init(&booter_info.mi, BOOT_MEM_KM_BASE, VM_UNTYPED_SIZE, BOOT_CAPTBL_SELF_UNTYPED_PT);
	cos_compinfo_init(&booter_info, BOOT_CAPTBL_SELF_PT, BOOT_CAPTBL_SELF_CT, BOOT_CAPTBL_SELF_COMP,
			  (vaddr_t)cos_get_heap_ptr(), VM_CAPTBL_FREE, &booter_info);

	PRINTC("Micro Booter started.\n");
	test_run_vk();
	PRINTC("Micro Booter done.\n");

	EXIT();
	return;
}
static void 
cgraph_init(void)
{
	int i;
	/* The hack to give this component the component graph is to
	 * place it @ cos_heap_ptr-PAGE_SIZE.  See cos_loader.c.
	 */
	struct comp_graph *g = (struct comp_graph *)cos_get_heap_ptr();

	graph = (struct comp_graph *)((char*)g-PAGE_SIZE);
	for (i = 0 ; graph[i].client && graph[i].server ; i++) {
		cos_cap_cntl_spds(graph[i].client, graph[i].server, 0);	
	}
	nedges = i;

	return;
}