/* * cpu_lwp_free is called from exit() to let machine-dependent * code free machine-dependent resources. Note that this routine * must not block. */ void cpu_lwp_free(struct lwp *l, int proc) { /* If we were using the FPU, forget about it. */ fpusave_lwp(l, false); #ifdef MTRR if (proc && l->l_proc->p_md.md_flags & MDP_USEDMTRR) mtrr_clean(l->l_proc); #endif }
/* * cpu_lwp_free is called from exit() to let machine-dependent * code free machine-dependent resources. Note that this routine * must not block. */ void cpu_lwp_free(struct lwp *l, int proc) { struct pcb *pcb = lwp_getpcb(l); /* If we were using the FPU, forget about it. */ if (pcb->pcb_fpcpu != NULL) { fpusave_lwp(l, false); } #ifdef MTRR if (proc && l->l_proc->p_md.md_flags & MDP_USEDMTRR) mtrr_clean(l->l_proc); #endif }
/* * cpu_exit is called as the last action during exit. * * We clean up a little and then call sched_exit() with the old proc as an * argument. */ void cpu_exit(struct proc *p) { /* If we were using the FPU, forget about it. */ if (p->p_addr->u_pcb.pcb_fpcpu != NULL) fpusave_proc(p, 0); if (p->p_md.md_flags & MDP_USEDMTRR) mtrr_clean(p); pmap_deactivate(p); tss_free(p->p_md.md_tss_sel); sched_exit(p); }
/* * cpu_exit is called as the last action during exit. * * We clean up a little and then call switch_exit() with the old proc as an * argument. switch_exit() first switches to proc0's context, and finally * jumps into switch() to wait for another process to wake up. */ void cpu_exit(struct proc *p) { /* If we were using the FPU, forget about it. */ if (p->p_addr->u_pcb.pcb_fpcpu != NULL) fpusave_proc(p, 0); if (p->p_md.md_flags & MDP_USEDMTRR) mtrr_clean(p); /* * No need to do user LDT cleanup here; it's handled in * pmap_destroy(). */ uvmexp.swtch++; switch_exit(p, exit2); }