FreeBSD/sys/i386/i386/vm_machdep.c
/*
 * Get an sf_buf from the freelist.  May block if none are available.
 */
Get an sf_buf from the freelist.  May block if none are available.
Get an sf_buf from the freelist . May block if none are available .
void
sf_buf_map(struct sf_buf *sf, int flags)
{
	pt_entry_t opte, *ptep;
	ptep = vtopte(sf->kva);
	opte = *ptep;
	*ptep = VM_PAGE_TO_PHYS(sf->m) | pgeflag | PG_RW | PG_V |
	    pmap_cache_bits(sf->m->md.pat_mode, 0);
#ifdef SMP
	if ((opte & (PG_V | PG_A)) ==  (PG_V | PG_A))
		CPU_ZERO(&sf->cpumask);
	sf_buf_shootdown(sf, flags);
#else
	if ((opte & (PG_V | PG_A)) ==  (PG_V | PG_A))
		pmap_invalidate_page(kernel_pmap, sf->kva);
#endif
}
void sf_buf_map ( struct sf_buf * sf , int flags ) { pt_entry_t opte , * ptep ; ptep = vtopte ( sf -> kva ) ; opte = * ptep ; * ptep = VM_PAGE_TO_PHYS ( sf -> m ) | pgeflag | PG_RW | PG_V | pmap_cache_bits ( sf -> m -> md . pat_mode , 0 ) ; #ifdef SMP if ( ( opte & ( PG_V | PG_A ) ) == ( PG_V | PG_A ) ) CPU_ZERO ( & sf -> cpumask ) ; sf_buf_shootdown ( sf , flags ) ; #else if ( ( opte & ( PG_V | PG_A ) ) == ( PG_V | PG_A ) ) pmap_invalidate_page ( kernel_pmap , sf -> kva ) ; #endif }
Get an sf_buf from the freelist.
Get an sf_buf from the freelist .
/*
	 * Update the sf_buf's virtual-to-physical mapping, flushing the
	 * virtual address from the TLB.  Since the reference count for 
	 * the sf_buf's old mapping was zero, that mapping is not 
	 * currently in use.  Consequently, there is no need to exchange 
	 * the old and new PTEs atomically, even under PAE.
	 */ /*
	 * Avoid unnecessary TLB invalidations: If the sf_buf's old
	 * virtual-to-physical mapping was not used, then any processor
	 * that has invalidated the sf_buf's virtual address from its TLB
	 * since the last used mapping need not invalidate again.
	 */