void cos_upcall_fn(upcall_type_t t, void *arg1, void *arg2, void *arg3)
{
	switch (t) {
	case COS_UPCALL_BRAND_EXEC:
	{
		cos_upcall_exec(arg1);
		break;
	}
	case COS_UPCALL_BOOTSTRAP:
	{
		static int first = 1;
		if (first) { first = 0; __alloc_libc_initilize(); }
		cos_argreg_init();
		cos_init(arg1);
		break;
	}
	default:
		/* fault! */
		*(int*)NULL = 0;
		return;
	}
	return;
}
예제 #2
0
void cos_upcall_fn(upcall_type_t t, void *arg1, void *arg2, void *arg3)
{
	static int first = 1;
	if (first) { 
		first = 0; 
		__alloc_libc_initilize(); 
		constructors_execute();
	}

	switch (t) {
	case COS_UPCALL_THD_CREATE:
	/* New thread creation method passes in this type. */
	{
		/* A new thread is created in this comp. */
		if (arg1 == 0) {
			/* arg1 is the thread init data. 0 means
			 * bootstrap. */
			cos_init(NULL);
		} else {
			u32_t idx = (int)arg1 - 1;
			if (idx >= COS_THD_INIT_REGION_SIZE) {
				/* This means static defined entry */
				cos_thd_entry_static(idx - COS_THD_INIT_REGION_SIZE);
			} else {
				/* Execute dynamic allocated entry. */
				cos_thd_entry_exec(idx);
			}
		}
		return;
	}
	default:
		/* fault! */
		*(int*)NULL = 0;
		return;
	}
	return;
}