]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/x86/include/asm/pgtable_types.h
x86: move pte types into pgtable*.h
[linux-2.6-omap-h63xx.git] / arch / x86 / include / asm / pgtable_types.h
index e5d5a8d3577c313aed1511a77a416d38c5dc3229..a7452f10930e3df15a4148c911c125992fb2224a 100644 (file)
 #define PGD_IDENT_ATTR  0x001          /* PRESENT (no other attributes) */
 #endif
 
+#ifdef CONFIG_X86_32
+# include "pgtable_32_types.h"
+#else
+# include "pgtable_64_types.h"
+#endif
+
 #ifndef __ASSEMBLY__
 
+#include <linux/types.h>
+
+typedef struct pgprot { pgprotval_t pgprot; } pgprot_t;
+
+typedef struct { pgdval_t pgd; } pgd_t;
+
+static inline pgd_t native_make_pgd(pgdval_t val)
+{
+       return (pgd_t) { val };
+}
+
+static inline pgdval_t native_pgd_val(pgd_t pgd)
+{
+       return pgd.pgd;
+}
+
+static inline pgdval_t pgd_flags(pgd_t pgd)
+{
+       return native_pgd_val(pgd) & PTE_FLAGS_MASK;
+}
+
+#if PAGETABLE_LEVELS > 3
+typedef struct { pudval_t pud; } pud_t;
+
+static inline pud_t native_make_pud(pmdval_t val)
+{
+       return (pud_t) { val };
+}
+
+static inline pudval_t native_pud_val(pud_t pud)
+{
+       return pud.pud;
+}
+#else
+#include <asm-generic/pgtable-nopud.h>
+
+static inline pudval_t native_pud_val(pud_t pud)
+{
+       return native_pgd_val(pud.pgd);
+}
+#endif
+
+#if PAGETABLE_LEVELS > 2
+typedef struct { pmdval_t pmd; } pmd_t;
+
+static inline pmd_t native_make_pmd(pmdval_t val)
+{
+       return (pmd_t) { val };
+}
+
+static inline pmdval_t native_pmd_val(pmd_t pmd)
+{
+       return pmd.pmd;
+}
+#else
+#include <asm-generic/pgtable-nopmd.h>
+
+static inline pmdval_t native_pmd_val(pmd_t pmd)
+{
+       return native_pgd_val(pmd.pud.pgd);
+}
+#endif
+
+static inline pudval_t pud_flags(pud_t pud)
+{
+       return native_pud_val(pud) & PTE_FLAGS_MASK;
+}
+
+static inline pmdval_t pmd_flags(pmd_t pmd)
+{
+       return native_pmd_val(pmd) & PTE_FLAGS_MASK;
+}
+
+static inline pte_t native_make_pte(pteval_t val)
+{
+       return (pte_t) { .pte = val };
+}
+
+static inline pteval_t native_pte_val(pte_t pte)
+{
+       return pte.pte;
+}
+
+static inline pteval_t pte_flags(pte_t pte)
+{
+       return native_pte_val(pte) & PTE_FLAGS_MASK;
+}
+
+#define pgprot_val(x)  ((x).pgprot)
+#define __pgprot(x)    ((pgprot_t) { (x) } )
+
+
+typedef struct page *pgtable_t;
+
 extern pteval_t __supported_pte_mask;
+extern int nx_enabled;
 
 #define pgprot_writecombine    pgprot_writecombine
 extern pgprot_t pgprot_writecombine(pgprot_t prot);
@@ -217,10 +318,4 @@ extern pte_t *lookup_address(unsigned long address, unsigned int *level);
 
 #endif /* !__ASSEMBLY__ */
 
-#ifdef CONFIG_X86_32
-# include "pgtable_32_types.h"
-#else
-# include "pgtable_64_types.h"
-#endif
-
 #endif /* _ASM_X86_PGTABLE_DEFS_H */