ia64/xen-unstable

annotate 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
rev   line source
iap10@235 1 #ifndef _I386_PGTABLE_2LEVEL_H
iap10@235 2 #define _I386_PGTABLE_2LEVEL_H
iap10@235 3
iap10@235 4 /*
iap10@235 5 * traditional i386 two-level paging structure:
iap10@235 6 */
iap10@235 7
iap10@235 8 #define PGDIR_SHIFT 22
iap10@235 9 #define PTRS_PER_PGD 1024
iap10@235 10
iap10@235 11 /*
iap10@235 12 * the i386 is two-level, so we don't really have any
iap10@235 13 * PMD directory physically.
iap10@235 14 */
iap10@235 15 #define PMD_SHIFT 22
iap10@235 16 #define PTRS_PER_PMD 1
iap10@235 17
iap10@235 18 #define PTRS_PER_PTE 1024
iap10@235 19
iap10@235 20 #define pte_ERROR(e) \
iap10@235 21 printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, (e).pte_low)
iap10@235 22 #define pmd_ERROR(e) \
iap10@235 23 printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e))
iap10@235 24 #define pgd_ERROR(e) \
iap10@235 25 printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e))
iap10@235 26
iap10@235 27 /*
iap10@235 28 * The "pgd_xxx()" functions here are trivial for a folded two-level
iap10@235 29 * setup: the pgd is never bad, and a pmd always exists (as it's folded
iap10@235 30 * into the pgd entry)
iap10@235 31 */
iap10@235 32 static inline int pgd_none(pgd_t pgd) { return 0; }
iap10@235 33 static inline int pgd_bad(pgd_t pgd) { return 0; }
iap10@235 34 static inline int pgd_present(pgd_t pgd) { return 1; }
iap10@235 35 #define pgd_clear(xp) do { } while (0)
iap10@235 36
iap10@235 37 #define set_pte(pteptr, pteval) queue_l1_entry_update(__pa(pteptr), (pteval).pte_low)
iap10@235 38 #define set_pte_atomic(pteptr, pteval) queue_l1_entry_update(__pa(pteptr), (pteval).pte_low)
iap10@235 39 #define set_pmd(pmdptr, pmdval) queue_l2_entry_update(__pa(pmdptr), (pmdval).pmd)
iap10@235 40 #define set_pgd(pgdptr, pgdval) ((void)0)
iap10@235 41
iap10@235 42 #define pgd_page(pgd) \
iap10@235 43 ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK))
iap10@235 44
iap10@235 45 static inline pmd_t * pmd_offset(pgd_t * dir, unsigned long address)
iap10@235 46 {
iap10@235 47 return (pmd_t *) dir;
iap10@235 48 }
iap10@235 49
iap10@235 50 /*
iap10@235 51 * A note on implementation of this atomic 'get-and-clear' operation.
iap10@235 52 * This is actually very simple because XenoLinux can only run on a single
iap10@235 53 * processor. Therefore, we cannot race other processors setting the 'accessed'
iap10@235 54 * or 'dirty' bits on a page-table entry.
iap10@235 55 * Even if pages are shared between domains, that is not a problem because
iap10@235 56 * each domain will have separate page tables, with their own versions of
iap10@235 57 * accessed & dirty state.
iap10@235 58 */
iap10@235 59 static inline pte_t ptep_get_and_clear(pte_t *xp)
iap10@235 60 {
iap10@235 61 pte_t pte = *xp;
iap10@235 62 queue_l1_entry_update(__pa(xp), 0);
iap10@235 63 return pte;
iap10@235 64 }
iap10@235 65
iap10@235 66 #define pte_same(a, b) ((a).pte_low == (b).pte_low)
iap10@235 67 #define pte_page(x) (mem_map+((unsigned long)((pte_val(x) >> PAGE_SHIFT))))
iap10@235 68 #define pte_none(x) (!(x).pte_low)
iap10@235 69 #define __mk_pte(page_nr,pgprot) __pte(((page_nr) << PAGE_SHIFT) | pgprot_val(pgprot))
iap10@235 70
iap10@235 71 #endif /* _I386_PGTABLE_2LEVEL_H */