ia64/xen-unstable

diff xenolinux-2.4.21-pre4-sparse/include/asm-xeno/pgtable-2level.h @ 235:d7d0a23b2e07

bitkeeper revision 1.93 (3e5a4e6bkPheUp3x1uufN2MS3LAB7A)

Latest and Greatest version of XenoLinux based on the Linux-2.4.21-pre4
kernel.
author iap10@labyrinth.cl.cam.ac.uk
date Mon Feb 24 16:55:07 2003 +0000 (2003-02-24)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xenolinux-2.4.21-pre4-sparse/include/asm-xeno/pgtable-2level.h	Mon Feb 24 16:55:07 2003 +0000
     1.3 @@ -0,0 +1,71 @@
     1.4 +#ifndef _I386_PGTABLE_2LEVEL_H
     1.5 +#define _I386_PGTABLE_2LEVEL_H
     1.6 +
     1.7 +/*
     1.8 + * traditional i386 two-level paging structure:
     1.9 + */
    1.10 +
    1.11 +#define PGDIR_SHIFT	22
    1.12 +#define PTRS_PER_PGD	1024
    1.13 +
    1.14 +/*
    1.15 + * the i386 is two-level, so we don't really have any
    1.16 + * PMD directory physically.
    1.17 + */
    1.18 +#define PMD_SHIFT	22
    1.19 +#define PTRS_PER_PMD	1
    1.20 +
    1.21 +#define PTRS_PER_PTE	1024
    1.22 +
    1.23 +#define pte_ERROR(e) \
    1.24 +	printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte_low)
    1.25 +#define pmd_ERROR(e) \
    1.26 +	printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
    1.27 +#define pgd_ERROR(e) \
    1.28 +	printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
    1.29 +
    1.30 +/*
    1.31 + * The "pgd_xxx()" functions here are trivial for a folded two-level
    1.32 + * setup: the pgd is never bad, and a pmd always exists (as it's folded
    1.33 + * into the pgd entry)
    1.34 + */
    1.35 +static inline int pgd_none(pgd_t pgd)		{ return 0; }
    1.36 +static inline int pgd_bad(pgd_t pgd)		{ return 0; }
    1.37 +static inline int pgd_present(pgd_t pgd)	{ return 1; }
    1.38 +#define pgd_clear(xp)				do { } while (0)
    1.39 +
    1.40 +#define set_pte(pteptr, pteval) queue_l1_entry_update(__pa(pteptr), (pteval).pte_low)
    1.41 +#define set_pte_atomic(pteptr, pteval) queue_l1_entry_update(__pa(pteptr), (pteval).pte_low)
    1.42 +#define set_pmd(pmdptr, pmdval) queue_l2_entry_update(__pa(pmdptr), (pmdval).pmd)
    1.43 +#define set_pgd(pgdptr, pgdval) ((void)0)
    1.44 +
    1.45 +#define pgd_page(pgd) \
    1.46 +((unsigned long) __va(pgd_val(pgd) & PAGE_MASK))
    1.47 +
    1.48 +static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
    1.49 +{
    1.50 +	return (pmd_t *) dir;
    1.51 +}
    1.52 +
    1.53 +/*
    1.54 + * A note on implementation of this atomic 'get-and-clear' operation.
    1.55 + * This is actually very simple because XenoLinux can only run on a single
    1.56 + * processor. Therefore, we cannot race other processors setting the 'accessed'
    1.57 + * or 'dirty' bits on a page-table entry.
    1.58 + * Even if pages are shared between domains, that is not a problem because
    1.59 + * each domain will have separate page tables, with their own versions of
    1.60 + * accessed & dirty state.
    1.61 + */
    1.62 +static inline pte_t ptep_get_and_clear(pte_t *xp)
    1.63 +{
    1.64 +    pte_t pte = *xp;
    1.65 +    queue_l1_entry_update(__pa(xp), 0);
    1.66 +    return pte;
    1.67 +}
    1.68 +
    1.69 +#define pte_same(a, b)		((a).pte_low == (b).pte_low)
    1.70 +#define pte_page(x)		(mem_map+((unsigned long)((pte_val(x) >> PAGE_SHIFT))))
    1.71 +#define pte_none(x)		(!(x).pte_low)
    1.72 +#define __mk_pte(page_nr,pgprot) __pte(((page_nr) << PAGE_SHIFT) | pgprot_val(pgprot))
    1.73 +
    1.74 +#endif /* _I386_PGTABLE_2LEVEL_H */