diff options
| -rw-r--r-- | arch/x86/include/asm/page.h | 78 | ||||
| -rw-r--r-- | arch/x86/include/asm/page_32_types.h | 2 | ||||
| -rw-r--r-- | arch/x86/include/asm/page_types.h | 74 | ||||
| -rw-r--r-- | arch/x86/include/asm/paravirt.h | 2 |
4 files changed, 77 insertions, 79 deletions
diff --git a/arch/x86/include/asm/page.h b/arch/x86/include/asm/page.h index da54f6c48a7f..28423609b00e 100644 --- a/arch/x86/include/asm/page.h +++ b/arch/x86/include/asm/page.h | |||
| @@ -31,84 +31,6 @@ static inline void copy_user_page(void *to, void *from, unsigned long vaddr, | |||
| 31 | alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) | 31 | alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO | movableflags, vma, vaddr) |
| 32 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE | 32 | #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE |
| 33 | 33 | ||
| 34 | static inline pgd_t native_make_pgd(pgdval_t val) | ||
| 35 | { | ||
| 36 | return (pgd_t) { val }; | ||
| 37 | } | ||
| 38 | |||
| 39 | static inline pgdval_t native_pgd_val(pgd_t pgd) | ||
| 40 | { | ||
| 41 | return pgd.pgd; | ||
| 42 | } | ||
| 43 | |||
| 44 | static inline pgdval_t pgd_flags(pgd_t pgd) | ||
| 45 | { | ||
| 46 | return native_pgd_val(pgd) & PTE_FLAGS_MASK; | ||
| 47 | } | ||
| 48 | |||
| 49 | #if PAGETABLE_LEVELS >= 3 | ||
| 50 | #if PAGETABLE_LEVELS == 4 | ||
| 51 | static inline pud_t native_make_pud(pmdval_t val) | ||
| 52 | { | ||
| 53 | return (pud_t) { val }; | ||
| 54 | } | ||
| 55 | |||
| 56 | static inline pudval_t native_pud_val(pud_t pud) | ||
| 57 | { | ||
| 58 | return pud.pud; | ||
| 59 | } | ||
| 60 | #else /* PAGETABLE_LEVELS == 3 */ | ||
| 61 | static inline pudval_t native_pud_val(pud_t pud) | ||
| 62 | { | ||
| 63 | return native_pgd_val(pud.pgd); | ||
| 64 | } | ||
| 65 | #endif /* PAGETABLE_LEVELS == 4 */ | ||
| 66 | |||
| 67 | static inline pudval_t pud_flags(pud_t pud) | ||
| 68 | { | ||
| 69 | return native_pud_val(pud) & PTE_FLAGS_MASK; | ||
| 70 | } | ||
| 71 | |||
| 72 | static inline pmd_t native_make_pmd(pmdval_t val) | ||
| 73 | { | ||
| 74 | return (pmd_t) { val }; | ||
| 75 | } | ||
| 76 | |||
| 77 | static inline pmdval_t native_pmd_val(pmd_t pmd) | ||
| 78 | { | ||
| 79 | return pmd.pmd; | ||
| 80 | } | ||
| 81 | |||
| 82 | #else /* PAGETABLE_LEVELS == 2 */ | ||
| 83 | static inline pmdval_t native_pmd_val(pmd_t pmd) | ||
| 84 | { | ||
| 85 | return native_pgd_val(pmd.pud.pgd); | ||
| 86 | } | ||
| 87 | #endif /* PAGETABLE_LEVELS >= 3 */ | ||
| 88 | |||
| 89 | static inline pmdval_t pmd_flags(pmd_t pmd) | ||
| 90 | { | ||
| 91 | return native_pmd_val(pmd) & PTE_FLAGS_MASK; | ||
| 92 | } | ||
| 93 | |||
| 94 | static inline pte_t native_make_pte(pteval_t val) | ||
| 95 | { | ||
| 96 | return (pte_t) { .pte = val }; | ||
| 97 | } | ||
| 98 | |||
| 99 | static inline pteval_t native_pte_val(pte_t pte) | ||
| 100 | { | ||
| 101 | return pte.pte; | ||
| 102 | } | ||
| 103 | |||
| 104 | static inline pteval_t pte_flags(pte_t pte) | ||
| 105 | { | ||
| 106 | return native_pte_val(pte) & PTE_FLAGS_MASK; | ||
| 107 | } | ||
| 108 | |||
| 109 | #define pgprot_val(x) ((x).pgprot) | ||
| 110 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
| 111 | |||
| 112 | #ifdef CONFIG_PARAVIRT | 34 | #ifdef CONFIG_PARAVIRT |
| 113 | #include <asm/paravirt.h> | 35 | #include <asm/paravirt.h> |
| 114 | #else /* !CONFIG_PARAVIRT */ | 36 | #else /* !CONFIG_PARAVIRT */ |
diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h index b7b5402d7ab7..83f820a2b108 100644 --- a/arch/x86/include/asm/page_32_types.h +++ b/arch/x86/include/asm/page_32_types.h | |||
| @@ -43,6 +43,8 @@ | |||
| 43 | 43 | ||
| 44 | #ifndef __ASSEMBLY__ | 44 | #ifndef __ASSEMBLY__ |
| 45 | 45 | ||
| 46 | #include <linux/types.h> | ||
| 47 | |||
| 46 | #ifdef CONFIG_X86_PAE | 48 | #ifdef CONFIG_X86_PAE |
| 47 | typedef u64 pteval_t; | 49 | typedef u64 pteval_t; |
| 48 | typedef u64 pmdval_t; | 50 | typedef u64 pmdval_t; |
diff --git a/arch/x86/include/asm/page_types.h b/arch/x86/include/asm/page_types.h index 92dfd251a659..c41e3e8f2271 100644 --- a/arch/x86/include/asm/page_types.h +++ b/arch/x86/include/asm/page_types.h | |||
| @@ -51,18 +51,92 @@ | |||
| 51 | typedef struct { pgdval_t pgd; } pgd_t; | 51 | typedef struct { pgdval_t pgd; } pgd_t; |
| 52 | typedef struct { pgprotval_t pgprot; } pgprot_t; | 52 | typedef struct { pgprotval_t pgprot; } pgprot_t; |
| 53 | 53 | ||
| 54 | static inline pgd_t native_make_pgd(pgdval_t val) | ||
| 55 | { | ||
| 56 | return (pgd_t) { val }; | ||
| 57 | } | ||
| 58 | |||
| 59 | static inline pgdval_t native_pgd_val(pgd_t pgd) | ||
| 60 | { | ||
| 61 | return pgd.pgd; | ||
| 62 | } | ||
| 63 | |||
| 64 | static inline pgdval_t pgd_flags(pgd_t pgd) | ||
| 65 | { | ||
| 66 | return native_pgd_val(pgd) & PTE_FLAGS_MASK; | ||
| 67 | } | ||
| 68 | |||
| 54 | #if PAGETABLE_LEVELS > 3 | 69 | #if PAGETABLE_LEVELS > 3 |
| 55 | typedef struct { pudval_t pud; } pud_t; | 70 | typedef struct { pudval_t pud; } pud_t; |
| 71 | |||
| 72 | static inline pud_t native_make_pud(pmdval_t val) | ||
| 73 | { | ||
| 74 | return (pud_t) { val }; | ||
| 75 | } | ||
| 76 | |||
| 77 | static inline pudval_t native_pud_val(pud_t pud) | ||
| 78 | { | ||
| 79 | return pud.pud; | ||
| 80 | } | ||
| 56 | #else | 81 | #else |
| 57 | #include <asm-generic/pgtable-nopud.h> | 82 | #include <asm-generic/pgtable-nopud.h> |
| 83 | |||
| 84 | static inline pudval_t native_pud_val(pud_t pud) | ||
| 85 | { | ||
| 86 | return native_pgd_val(pud.pgd); | ||
| 87 | } | ||
| 58 | #endif | 88 | #endif |
| 59 | 89 | ||
| 60 | #if PAGETABLE_LEVELS > 2 | 90 | #if PAGETABLE_LEVELS > 2 |
| 61 | typedef struct { pmdval_t pmd; } pmd_t; | 91 | typedef struct { pmdval_t pmd; } pmd_t; |
| 92 | |||
| 93 | static inline pudval_t pud_flags(pud_t pud) | ||
| 94 | { | ||
| 95 | return native_pud_val(pud) & PTE_FLAGS_MASK; | ||
| 96 | } | ||
| 97 | |||
| 98 | static inline pmd_t native_make_pmd(pmdval_t val) | ||
| 99 | { | ||
| 100 | return (pmd_t) { val }; | ||
| 101 | } | ||
| 102 | |||
| 103 | static inline pmdval_t native_pmd_val(pmd_t pmd) | ||
| 104 | { | ||
| 105 | return pmd.pmd; | ||
| 106 | } | ||
| 62 | #else | 107 | #else |
| 63 | #include <asm-generic/pgtable-nopmd.h> | 108 | #include <asm-generic/pgtable-nopmd.h> |
| 109 | |||
| 110 | static inline pmdval_t native_pmd_val(pmd_t pmd) | ||
| 111 | { | ||
| 112 | return native_pgd_val(pmd.pud.pgd); | ||
| 113 | } | ||
| 64 | #endif | 114 | #endif |
| 65 | 115 | ||
| 116 | static inline pmdval_t pmd_flags(pmd_t pmd) | ||
| 117 | { | ||
| 118 | return native_pmd_val(pmd) & PTE_FLAGS_MASK; | ||
| 119 | } | ||
| 120 | |||
| 121 | static inline pte_t native_make_pte(pteval_t val) | ||
| 122 | { | ||
| 123 | return (pte_t) { .pte = val }; | ||
| 124 | } | ||
| 125 | |||
| 126 | static inline pteval_t native_pte_val(pte_t pte) | ||
| 127 | { | ||
| 128 | return pte.pte; | ||
| 129 | } | ||
| 130 | |||
| 131 | static inline pteval_t pte_flags(pte_t pte) | ||
| 132 | { | ||
| 133 | return native_pte_val(pte) & PTE_FLAGS_MASK; | ||
| 134 | } | ||
| 135 | |||
| 136 | #define pgprot_val(x) ((x).pgprot) | ||
| 137 | #define __pgprot(x) ((pgprot_t) { (x) } ) | ||
| 138 | |||
| 139 | |||
| 66 | typedef struct page *pgtable_t; | 140 | typedef struct page *pgtable_t; |
| 67 | 141 | ||
| 68 | extern int page_is_ram(unsigned long pagenr); | 142 | extern int page_is_ram(unsigned long pagenr); |
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h index c85e7475e171..db570f23b228 100644 --- a/arch/x86/include/asm/paravirt.h +++ b/arch/x86/include/asm/paravirt.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | * para-virtualization: those hooks are defined here. */ | 4 | * para-virtualization: those hooks are defined here. */ |
| 5 | 5 | ||
| 6 | #ifdef CONFIG_PARAVIRT | 6 | #ifdef CONFIG_PARAVIRT |
| 7 | #include <asm/page.h> | 7 | #include <asm/page_types.h> |
| 8 | #include <asm/asm.h> | 8 | #include <asm/asm.h> |
| 9 | 9 | ||
| 10 | /* Bitmask of what can be clobbered: usually at least eax. */ | 10 | /* Bitmask of what can be clobbered: usually at least eax. */ |
