Ejemplo n.º 1
0
static void file_thread(void *para)
{
	struct file_process_startup_para *package = para;
	printk("File thread startup, startup file %x, size %d, ks addr %x...", package->data, package->size, package->ks_start);
	
	memcpy((void*)package->ks_start, package->data, package->size);
	package->data = NULL;
	printk("Copy ok.\n");
	while(1)
	{
		kt_sleep(KT_STATE_WAITING_MSG);
	}
	
}
Ejemplo n.º 2
0
/**
	@brief Thread message slot managing
*/
static bool thread_msg(struct sysreq_thread_msg *req)
{
	bool r = false;
	struct ktm *msg;
	
	if (req->ops == SYSREQ_THREAD_MSG_SLEEP)
	{
		msg = ktm_prepare_loop();
		if (msg == NULL)
		{
			req->slot_base = NULL;
			req->slot_buffer_size = 0;
		}
		else
		{
			kt_sleep(KT_STATE_WAITING_MSG);

			req->slot_base			= (void*)msg->map->node.start;
			req->slot_buffer_size	= msg->desc.slot_buffer_size;
			r = true;
		}
	}
	else if (req->ops == SYSREQ_THREAD_MSG_SEND)
	{
		struct y_message *what = req->send.msg;
		ke_handle thread = req->send.to_thread;
		struct ko_thread *to;
		
		/* Translate thread */
		if (!(to = ke_handle_translate(thread)))
			goto end;
		
		r = ktm_send(to, what);
		
		ke_handle_put(thread, to);
	}
end:
	return r;
}