diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-m32r/pgtable-2level.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/asm-m32r/pgtable-2level.h')
-rw-r--r-- | include/asm-m32r/pgtable-2level.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/include/asm-m32r/pgtable-2level.h b/include/asm-m32r/pgtable-2level.h new file mode 100644 index 000000000000..861727c20e8f --- /dev/null +++ b/include/asm-m32r/pgtable-2level.h | |||
@@ -0,0 +1,78 @@ | |||
1 | #ifndef _ASM_M32R_PGTABLE_2LEVEL_H | ||
2 | #define _ASM_M32R_PGTABLE_2LEVEL_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #include <linux/config.h> | ||
7 | |||
8 | /* | ||
9 | * traditional M32R two-level paging structure: | ||
10 | */ | ||
11 | |||
12 | #define PGDIR_SHIFT 22 | ||
13 | #define PTRS_PER_PGD 1024 | ||
14 | |||
15 | /* | ||
16 | * the M32R is two-level, so we don't really have any | ||
17 | * PMD directory physically. | ||
18 | */ | ||
19 | #define PMD_SHIFT 22 | ||
20 | #define PTRS_PER_PMD 1 | ||
21 | |||
22 | #define PTRS_PER_PTE 1024 | ||
23 | |||
24 | #define pte_ERROR(e) \ | ||
25 | printk("%s:%d: bad pte %08lx.\n", __FILE__, __LINE__, pte_val(e)) | ||
26 | #define pmd_ERROR(e) \ | ||
27 | printk("%s:%d: bad pmd %08lx.\n", __FILE__, __LINE__, pmd_val(e)) | ||
28 | #define pgd_ERROR(e) \ | ||
29 | printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, pgd_val(e)) | ||
30 | |||
31 | /* | ||
32 | * The "pgd_xxx()" functions here are trivial for a folded two-level | ||
33 | * setup: the pgd is never bad, and a pmd always exists (as it's folded | ||
34 | * into the pgd entry) | ||
35 | */ | ||
36 | static inline int pgd_none(pgd_t pgd) { return 0; } | ||
37 | static inline int pgd_bad(pgd_t pgd) { return 0; } | ||
38 | static inline int pgd_present(pgd_t pgd) { return 1; } | ||
39 | #define pgd_clear(xp) do { } while (0) | ||
40 | |||
41 | /* | ||
42 | * Certain architectures need to do special things when PTEs | ||
43 | * within a page table are directly modified. Thus, the following | ||
44 | * hook is made available. | ||
45 | */ | ||
46 | #define set_pte(pteptr, pteval) (*(pteptr) = pteval) | ||
47 | #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval) | ||
48 | #define set_pte_atomic(pteptr, pteval) set_pte(pteptr, pteval) | ||
49 | /* | ||
50 | * (pmds are folded into pgds so this doesnt get actually called, | ||
51 | * but the define is needed for a generic inline function.) | ||
52 | */ | ||
53 | #define set_pmd(pmdptr, pmdval) (*(pmdptr) = pmdval) | ||
54 | #define set_pgd(pgdptr, pgdval) (*(pgdptr) = pgdval) | ||
55 | |||
56 | #define pgd_page(pgd) \ | ||
57 | ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) | ||
58 | |||
59 | static inline pmd_t *pmd_offset(pgd_t * dir, unsigned long address) | ||
60 | { | ||
61 | return (pmd_t *) dir; | ||
62 | } | ||
63 | |||
64 | #define ptep_get_and_clear(mm,addr,xp) __pte(xchg(&(xp)->pte, 0)) | ||
65 | #define pte_same(a, b) (pte_val(a) == pte_val(b)) | ||
66 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | ||
67 | #define pte_none(x) (!pte_val(x)) | ||
68 | #define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) | ||
69 | #define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) | ||
70 | #define pfn_pmd(pfn, prot) __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) | ||
71 | |||
72 | #define PTE_FILE_MAX_BITS 29 | ||
73 | #define pte_to_pgoff(pte) (((pte_val(pte) >> 2) & 0xef) | (((pte_val(pte) >> 10)) << 7)) | ||
74 | #define pgoff_to_pte(off) ((pte_t) { (((off) & 0xef) << 2) | (((off) >> 7) << 10) | _PAGE_FILE }) | ||
75 | |||
76 | #endif /* __KERNEL__ */ | ||
77 | |||
78 | #endif /* _ASM_M32R_PGTABLE_2LEVEL_H */ | ||