Exemple #1
0
void l4x_exit_thread(void)
{
#ifndef CONFIG_L4_VCPU
	int i;

	if (unlikely(current->thread.is_hybrid)) {
		l4_cap_idx_t hybgate;
		l4_msgtag_t tag;
		l4_umword_t o = 0;

		hybgate = L4LX_KERN_CAP_HYBRID_BASE
		           + (current->pid << L4_CAP_SHIFT);

		tag = l4_ipc_gate_get_infos(hybgate, &o);
		if (l4_error(tag))
			printk("hybrid: Could not get gate info, leaking mem.\n");
		else
			kfree((void *)o);

		tag = l4_task_unmap(L4_BASE_TASK_CAP,
		                    l4_obj_fpage(hybgate, 0, L4_FPAGE_RWX),
		                    L4_FP_ALL_SPACES);
		if (l4_error(tag))
			printk("hybrid: Delete of gate failed.\n");
	}

	for (i = 0; i < NR_CPUS; i++) {
		l4_cap_idx_t thread_id = current->thread.user_thread_ids[i];

		/* check if we were a non-user thread (i.e., have no
		   user-space partner) */
		if (unlikely(l4_is_invalid_cap(thread_id) || !thread_id))
			continue;

#ifdef DEBUG
		LOG_printf("exit_thread: trying to delete %s(%d, " PRINTF_L4TASK_FORM ")\n",
		           current->comm, current->pid, PRINTF_L4TASK_ARG(thread_id));
#endif

		/* If task_delete fails we don't free the task number so that it
		 * won't be used again. */

		if (likely(!l4lx_task_delete_thread(thread_id))) {
			l4x_hybrid_remove(current);
			current->thread.user_thread_ids[i] = L4_INVALID_CAP;
			l4lx_task_number_free(thread_id);
			current->thread.started = 0;
		} else
			printk("%s: failed to delete task " PRINTF_L4TASK_FORM "\n",
			       __func__, PRINTF_L4TASK_ARG(thread_id));

	}
#endif

#ifdef CONFIG_X86_DS
	ds_exit_thread(current);
#endif
}
Exemple #2
0
int kthreads_seq_show(struct seq_file *m, void *v)
{
	int i = *(int *)v;

	if (!l4_is_invalid_cap(l4lx_thread_names[i].id))
		seq_printf(m, PRINTF_L4TASK_FORM ": %s\n",
		           PRINTF_L4TASK_ARG(l4lx_thread_names[i].id),
		           l4lx_thread_names[i].name);
	return 0;
}
Exemple #3
0
static void log_efault(const char *str, const void *user_addr,
                       const void *kernel_addr, unsigned long size)
{
    pte_t *ptep = lookup_pte((pgd_t *)current->mm->pgd,
                             (unsigned long)user_addr);

    printk("%s returning efault, \n"
           "  user_addr: %p, kernel_addr: %p, size: %08lx\n"
           "  task: %s (%p) " PRINTF_L4TASK_FORM
           ", pdir: %p, ptep: %p, pte: %lx\n",
           str, user_addr, kernel_addr, size,
           current->comm, current,
           PRINTF_L4TASK_ARG(current->thread.user_thread_id),
           current->mm->pgd, ptep, ptep ? pte_val(*ptep) : 0);
#ifdef DEBUG_KDEBUG_EFAULT
    enter_kdebug("log_efault");
#endif
}