Пример #1
0
void
thread_release(struct proc_tcb *thread)
{
    assert(thread);
    assert(thread->vspaceRef);
    cspacepath_t path;
    vka_cspace_make_path(&procServ.vka, thread_tcb_obj(thread), &path);
    vka_cnode_revoke(&path);
    sel4utils_clean_up_thread(&procServ.vka, &thread->vspaceRef->vspace, &thread->sel4utilsThread);
    vs_unref(thread->vspaceRef);
    memset(thread, 0, sizeof(struct proc_tcb));
}
Пример #2
0
/**
 * Clean up after a thrd has finished
 */
void thrd_cleanup(thrd_env_t *env, thrd_t *thread) {

    vka_free_object(&env->vka, &thread->local_endpoint);

    if (thread->is_process) {
        /* free the regions (no need to unmap, as the
        * entry address space / cspace is being destroyed */
        for (int i = 0; i < thread->num_regions; i++) {
            vspace_free_reservation(&thread->process.vspace, thread->regions[i].reservation);
        }

        thread->process.fault_endpoint.cptr = 0;
        sel4utils_destroy_process(&thread->process, &env->vka);
    } else {
        sel4utils_clean_up_thread(&env->vka, &env->vspace, &thread->thread);
    }
}