diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2008-03-17 19:37:11 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-24 17:57:31 -0400 |
commit | 9666e9d44b83755c53615fb89c0787b6846786a1 (patch) | |
tree | 2b0186c3a71f1e49a52e84221bdfdad9eb110c4a /include | |
parent | 3b4724b0e60cdfdc2679ee7135f3a234c74c2b83 (diff) |
xen: unify pte operations on machine frames
Xen's pte operations on mfns can be unified like the kernel's pfn operations.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/xen/page.h | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/include/xen/page.h b/include/xen/page.h index 1742f60828f3..01799305f02a 100644 --- a/include/xen/page.h +++ b/include/xen/page.h | |||
@@ -125,37 +125,37 @@ static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn) | |||
125 | #define virt_to_mfn(v) (pfn_to_mfn(PFN_DOWN(__pa(v)))) | 125 | #define virt_to_mfn(v) (pfn_to_mfn(PFN_DOWN(__pa(v)))) |
126 | #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) | 126 | #define mfn_to_virt(m) (__va(mfn_to_pfn(m) << PAGE_SHIFT)) |
127 | 127 | ||
128 | #ifdef CONFIG_X86_PAE | 128 | static inline unsigned long pte_mfn(pte_t pte) |
129 | #define pte_mfn(_pte) (((_pte).pte_low >> PAGE_SHIFT) | \ | 129 | { |
130 | (((_pte).pte_high & 0xfff) << (32-PAGE_SHIFT))) | 130 | return (pte.pte & ~_PAGE_NX) >> PAGE_SHIFT; |
131 | } | ||
131 | 132 | ||
132 | static inline pte_t mfn_pte(unsigned long page_nr, pgprot_t pgprot) | 133 | static inline pte_t mfn_pte(unsigned long page_nr, pgprot_t pgprot) |
133 | { | 134 | { |
134 | pte_t pte; | 135 | pte_t pte; |
135 | 136 | ||
136 | pte.pte_high = (page_nr >> (32 - PAGE_SHIFT)) | | 137 | pte.pte = ((phys_addr_t)page_nr << PAGE_SHIFT) | |
137 | (pgprot_val(pgprot) >> 32); | 138 | (pgprot_val(pgprot) & __supported_pte_mask); |
138 | pte.pte_high &= (__supported_pte_mask >> 32); | ||
139 | pte.pte_low = ((page_nr << PAGE_SHIFT) | pgprot_val(pgprot)); | ||
140 | pte.pte_low &= __supported_pte_mask; | ||
141 | 139 | ||
142 | return pte; | 140 | return pte; |
143 | } | 141 | } |
144 | 142 | ||
145 | static inline unsigned long long pte_val_ma(pte_t x) | 143 | static inline pteval_t pte_val_ma(pte_t pte) |
144 | { | ||
145 | return pte.pte; | ||
146 | } | ||
147 | |||
148 | static inline pte_t __pte_ma(pteval_t x) | ||
146 | { | 149 | { |
147 | return x.pte; | 150 | return (pte_t) { .pte = x }; |
148 | } | 151 | } |
152 | |||
153 | #ifdef CONFIG_X86_PAE | ||
149 | #define pmd_val_ma(v) ((v).pmd) | 154 | #define pmd_val_ma(v) ((v).pmd) |
150 | #define pud_val_ma(v) ((v).pgd.pgd) | 155 | #define pud_val_ma(v) ((v).pgd.pgd) |
151 | #define __pte_ma(x) ((pte_t) { .pte = (x) }) | ||
152 | #define __pmd_ma(x) ((pmd_t) { (x) } ) | 156 | #define __pmd_ma(x) ((pmd_t) { (x) } ) |
153 | #else /* !X86_PAE */ | 157 | #else /* !X86_PAE */ |
154 | #define pte_mfn(_pte) ((_pte).pte_low >> PAGE_SHIFT) | ||
155 | #define mfn_pte(pfn, prot) __pte_ma(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) | ||
156 | #define pte_val_ma(x) ((x).pte) | ||
157 | #define pmd_val_ma(v) ((v).pud.pgd.pgd) | 158 | #define pmd_val_ma(v) ((v).pud.pgd.pgd) |
158 | #define __pte_ma(x) ((pte_t) { (x) } ) | ||
159 | #endif /* CONFIG_X86_PAE */ | 159 | #endif /* CONFIG_X86_PAE */ |
160 | 160 | ||
161 | #define pgd_val_ma(x) ((x).pgd) | 161 | #define pgd_val_ma(x) ((x).pgd) |