FreeBSD/sys/i386/i386/pmap.c
/*
 * Determine the appropriate bits to set in a PTE or PDE for a specified
 * caching mode.
 */
Determine the appropriate bits to set in a PTE or PDE for a specified
caching mode.
Determine the appropriate bits to set in a PTE or PDE for a specified caching mode .
int
pmap_cache_bits(int mode, boolean_t is_pde)
{
	int cache_bits, pat_flag, pat_idx;
	if (mode < 0 || mode >= PAT_INDEX_SIZE || pat_index[mode] < 0)
		panic("Unknown caching mode %d\n", mode);
	pat_flag = is_pde ? PG_PDE_PAT : PG_PTE_PAT;
	pat_idx = pat_index[mode];
	cache_bits = 0;
	if (pat_idx & 0x4)
		cache_bits |= pat_flag;
	if (pat_idx & 0x2)
		cache_bits |= PG_NC_PCD;
	if (pat_idx & 0x1)
		cache_bits |= PG_NC_PWT;
	return (cache_bits);
}
int pmap_cache_bits ( int mode , boolean_t is_pde ) { int cache_bits , pat_flag , pat_idx ; if ( mode < 0 || mode >= PAT_INDEX_SIZE || pat_index [ mode ] < 0 ) panic ( " \n " , mode ) ; pat_flag = is_pde ? PG_PDE_PAT : PG_PTE_PAT ; pat_idx = pat_index [ mode ] ; cache_bits = 0 ; if ( pat_idx & 0x4 ) cache_bits |= pat_flag ; if ( pat_idx & 0x2 ) cache_bits |= PG_NC_PCD ; if ( pat_idx & 0x1 ) cache_bits |= PG_NC_PWT ; return ( cache_bits ) ; }
Determine the appropriate bits to set in a PTE or PDE for a specified
 caching mode.
Determine the appropriate bits to set in a PTE or PDE for a specified caching mode .
/* The PAT bit is different for PTE's and PDE's. */ /* Map the caching mode to a PAT index. */ /* Map the 3-bit index value into the PAT, PCD, and PWT bits. */