FreeBSD/sys/i386/i386/sys_machdep.c
/*
 * Must be called with dt_lock held.  Returns with dt_lock unheld.
 */
Must be called with dt_lock held.  Returns with dt_lock unheld.
Must be called with dt_lock held . Returns with dt_lock unheld .
void
user_ldt_free(struct thread *td)
{
	struct mdproc *mdp = &td->td_proc->p_md;
	struct proc_ldt *pldt;
	mtx_assert(&dt_lock, MA_OWNED);
	if ((pldt = mdp->md_ldt) == NULL) {
		mtx_unlock_spin(&dt_lock);
		return;
	}
	if (td == curthread) {
		lldt(_default_ldt);
		PCPU_SET(currentldt, _default_ldt);
	}
	mdp->md_ldt = NULL;
	user_ldt_deref(pldt);
}
void user_ldt_free ( struct thread * td ) { struct mdproc * mdp = & td -> td_proc -> p_md ; struct proc_ldt * pldt ; mtx_assert ( & dt_lock , MA_OWNED ) ; if ( ( pldt = mdp -> md_ldt ) == NULL ) { mtx_unlock_spin ( & dt_lock ) ; return ; } if ( td == curthread ) { lldt ( _default_ldt ) ; PCPU_SET ( currentldt , _default_ldt ) ; } mdp -> md_ldt = NULL ; user_ldt_deref ( pldt ) ; }
Must be called with dt_lock held.
Must be called with dt_lock held .