Re: pte_val(*pte) as lvalue

Timur Tabi (ttabi@interactivesi.com)
Tue, 03 Jul 2001 13:50:05 -0500


Russell King wrote:

>Can I ask what the nature of the PTE modification is, and where you
>are making this modification?
>
I've written a hack which enables PAT (Page Address Translation) for a
particular page:

void set_pte_pat(pte_t *pte, unsigned long pat_index)
{
unsigned long p = pte_val(*pte);

p &= ~(_PAGE_PROTNONE | _PAGE_PCD | _PAGE_PWT); // zero-out the
relevant bits

if (pat_index & 4)
p |= _PAGE_PROTNONE;

if (pat_index & 2)
p |= _PAGE_PCD;

if (pat_index & 1)
p |= _PAGE_PWT;

#if CONFIG_X86_PAE
pte->pte_high = 0;
pte->pte_low = p;
#else
pte_val(*pte) = p;
#endif

-- 
Timur Tabi
Interactive Silicon

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/