|
@@ -194,3 +194,135 @@ extern struct page *empty_zero_page;
|
|
* Undefined behaviour if not..
|
|
* Undefined behaviour if not..
|
|
*/
|
|
*/
|
|
static inline int pte_write(pte_t pte)
|
|
static inline int pte_write(pte_t pte)
|
|
|
|
+{
|
|
|
|
+ return pte_val(pte) & _PAGE_RW;
|
|
|
|
+}
|
|
|
|
+static inline int pte_dirty(pte_t pte)
|
|
|
|
+{
|
|
|
|
+ return pte_val(pte) & _PAGE_DIRTY;
|
|
|
|
+}
|
|
|
|
+static inline int pte_young(pte_t pte)
|
|
|
|
+{
|
|
|
|
+ return pte_val(pte) & _PAGE_ACCESSED;
|
|
|
|
+}
|
|
|
|
+static inline int pte_special(pte_t pte)
|
|
|
|
+{
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * The following only work if pte_present() is not true.
|
|
|
|
+ */
|
|
|
|
+static inline int pte_file(pte_t pte)
|
|
|
|
+{
|
|
|
|
+ return pte_val(pte) & _PAGE_FILE;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/* Mutator functions for PTE bits */
|
|
|
|
+static inline pte_t pte_wrprotect(pte_t pte)
|
|
|
|
+{
|
|
|
|
+ set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_RW));
|
|
|
|
+ return pte;
|
|
|
|
+}
|
|
|
|
+static inline pte_t pte_mkclean(pte_t pte)
|
|
|
|
+{
|
|
|
|
+ set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY));
|
|
|
|
+ return pte;
|
|
|
|
+}
|
|
|
|
+static inline pte_t pte_mkold(pte_t pte)
|
|
|
|
+{
|
|
|
|
+ set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_ACCESSED));
|
|
|
|
+ return pte;
|
|
|
|
+}
|
|
|
|
+static inline pte_t pte_mkwrite(pte_t pte)
|
|
|
|
+{
|
|
|
|
+ set_pte(&pte, __pte(pte_val(pte) | _PAGE_RW));
|
|
|
|
+ return pte;
|
|
|
|
+}
|
|
|
|
+static inline pte_t pte_mkdirty(pte_t pte)
|
|
|
|
+{
|
|
|
|
+ set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY));
|
|
|
|
+ return pte;
|
|
|
|
+}
|
|
|
|
+static inline pte_t pte_mkyoung(pte_t pte)
|
|
|
|
+{
|
|
|
|
+ set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED));
|
|
|
|
+ return pte;
|
|
|
|
+}
|
|
|
|
+static inline pte_t pte_mkspecial(pte_t pte)
|
|
|
|
+{
|
|
|
|
+ return pte;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#define pmd_none(x) (!pmd_val(x))
|
|
|
|
+#define pmd_present(x) (pmd_val(x))
|
|
|
|
+
|
|
|
|
+static inline void pmd_clear(pmd_t *pmdp)
|
|
|
|
+{
|
|
|
|
+ set_pmd(pmdp, __pmd(0));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#define pmd_bad(x) (pmd_val(x) & ~PAGE_MASK)
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * Permanent address of a page. We don't support highmem, so this is
|
|
|
|
+ * trivial.
|
|
|
|
+ */
|
|
|
|
+#define pages_to_mb(x) ((x) >> (20-PAGE_SHIFT))
|
|
|
|
+#define pte_page(x) (pfn_to_page(pte_pfn(x)))
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * Mark the prot value as uncacheable and unbufferable
|
|
|
|
+ */
|
|
|
|
+#define pgprot_noncached(prot) \
|
|
|
|
+ __pgprot(pgprot_val(prot) & ~(_PAGE_BUFFER | _PAGE_CACHABLE))
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * Mark the prot value as uncacheable but bufferable
|
|
|
|
+ */
|
|
|
|
+#define pgprot_writecombine(prot) \
|
|
|
|
+ __pgprot((pgprot_val(prot) & ~_PAGE_CACHABLE) | _PAGE_BUFFER)
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * Conversion functions: convert a page and protection to a page entry,
|
|
|
|
+ * and a page entry and page directory to the page they refer to.
|
|
|
|
+ *
|
|
|
|
+ * extern pte_t mk_pte(struct page *page, pgprot_t pgprot)
|
|
|
|
+ */
|
|
|
|
+#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
|
|
|
|
+
|
|
|
|
+static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
|
|
|
|
+{
|
|
|
|
+ set_pte(&pte, __pte((pte_val(pte) & _PAGE_CHG_MASK)
|
|
|
|
+ | pgprot_val(newprot)));
|
|
|
|
+ return pte;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#define page_pte(page) page_pte_prot(page, __pgprot(0))
|
|
|
|
+
|
|
|
|
+#define pmd_page_vaddr(pmd) pmd_val(pmd)
|
|
|
|
+#define pmd_page(pmd) (virt_to_page(pmd_val(pmd)))
|
|
|
|
+
|
|
|
|
+/* to find an entry in a page-table-directory. */
|
|
|
|
+#define pgd_index(address) (((address) >> PGDIR_SHIFT) \
|
|
|
|
+ & (PTRS_PER_PGD - 1))
|
|
|
|
+#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
|
|
|
|
+
|
|
|
|
+/* to find an entry in a kernel page-table-directory */
|
|
|
|
+#define pgd_offset_k(address) pgd_offset(&init_mm, address)
|
|
|
|
+
|
|
|
|
+/* Find an entry in the third-level page table.. */
|
|
|
|
+#define pte_index(address) \
|
|
|
|
+ ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
|
|
|
|
+#define pte_offset(dir, address) \
|
|
|
|
+ ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
|
|
|
|
+#define pte_offset_kernel(dir, address) \
|
|
|
|
+ ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
|
|
|
|
+#define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
|
|
|
|
+#define pte_unmap(pte) do { } while (0)
|
|
|
|
+
|
|
|
|
+struct vm_area_struct;
|
|
|
|
+extern void update_mmu_cache(struct vm_area_struct * vma,
|
|
|
|
+ unsigned long address, pte_t *ptep);
|
|
|
|
+
|
|
|
|
+/*
|