diff options
author | Hugh Dickins <hugh@veritas.com> | 2008-09-09 11:42:45 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-10 04:00:42 -0400 |
commit | 91030ca1e739696812242c807b112ee3981a14be (patch) | |
tree | e4aeed87ee5909f51de37b924da1b593fc599c28 /include | |
parent | adee14b2e1557d0a8559f29681732d05a89dfc35 (diff) |
x86: unsigned long pte_pfn
pte_pfn() has always been of type unsigned long, even on 32-bit PAE;
but in the current tip/next/mm tree it works out to be unsigned long
long on 64-bit, which gives an irritating warning if you try to printk
a pfn with the usual %lx.
Now use the same pte_pfn() function, moved from pgtable-3level.h
to pgtable.h, for all models: as suggested by Jeremy Fitzhardinge.
And pte_page() can well move along with it (remaining a macro to
avoid dependence on mm_types.h).
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Acked-by: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-x86/pgtable-2level.h | 2 | ||||
-rw-r--r-- | include/asm-x86/pgtable-3level.h | 7 | ||||
-rw-r--r-- | include/asm-x86/pgtable.h | 7 | ||||
-rw-r--r-- | include/asm-x86/pgtable_64.h | 2 |
4 files changed, 7 insertions, 11 deletions
diff --git a/include/asm-x86/pgtable-2level.h b/include/asm-x86/pgtable-2level.h index 46bc52c0eae1..d8c55071cebf 100644 --- a/include/asm-x86/pgtable-2level.h +++ b/include/asm-x86/pgtable-2level.h | |||
@@ -53,9 +53,7 @@ static inline pte_t native_ptep_get_and_clear(pte_t *xp) | |||
53 | #define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp) | 53 | #define native_ptep_get_and_clear(xp) native_local_ptep_get_and_clear(xp) |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | ||
57 | #define pte_none(x) (!(x).pte_low) | 56 | #define pte_none(x) (!(x).pte_low) |
58 | #define pte_pfn(x) (pte_val(x) >> PAGE_SHIFT) | ||
59 | 57 | ||
60 | /* | 58 | /* |
61 | * Bits 0, 6 and 7 are taken, split up the 29 bits of offset | 59 | * Bits 0, 6 and 7 are taken, split up the 29 bits of offset |
diff --git a/include/asm-x86/pgtable-3level.h b/include/asm-x86/pgtable-3level.h index 105057f34032..975da0dc142a 100644 --- a/include/asm-x86/pgtable-3level.h +++ b/include/asm-x86/pgtable-3level.h | |||
@@ -151,18 +151,11 @@ static inline int pte_same(pte_t a, pte_t b) | |||
151 | return a.pte_low == b.pte_low && a.pte_high == b.pte_high; | 151 | return a.pte_low == b.pte_low && a.pte_high == b.pte_high; |
152 | } | 152 | } |
153 | 153 | ||
154 | #define pte_page(x) pfn_to_page(pte_pfn(x)) | ||
155 | |||
156 | static inline int pte_none(pte_t pte) | 154 | static inline int pte_none(pte_t pte) |
157 | { | 155 | { |
158 | return !pte.pte_low && !pte.pte_high; | 156 | return !pte.pte_low && !pte.pte_high; |
159 | } | 157 | } |
160 | 158 | ||
161 | static inline unsigned long pte_pfn(pte_t pte) | ||
162 | { | ||
163 | return (pte_val(pte) & PTE_PFN_MASK) >> PAGE_SHIFT; | ||
164 | } | ||
165 | |||
166 | /* | 159 | /* |
167 | * Bits 0, 6 and 7 are taken in the low part of the pte, | 160 | * Bits 0, 6 and 7 are taken in the low part of the pte, |
168 | * put the 32 bits of offset into the high part. | 161 | * put the 32 bits of offset into the high part. |
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h index 04caa2f544df..efc329b8a717 100644 --- a/include/asm-x86/pgtable.h +++ b/include/asm-x86/pgtable.h | |||
@@ -186,6 +186,13 @@ static inline int pte_special(pte_t pte) | |||
186 | return pte_val(pte) & _PAGE_SPECIAL; | 186 | return pte_val(pte) & _PAGE_SPECIAL; |
187 | } | 187 | } |
188 | 188 | ||
189 | static inline unsigned long pte_pfn(pte_t pte) | ||
190 | { | ||
191 | return (pte_val(pte) & PTE_PFN_MASK) >> PAGE_SHIFT; | ||
192 | } | ||
193 | |||
194 | #define pte_page(pte) pfn_to_page(pte_pfn(pte)) | ||
195 | |||
189 | static inline int pmd_large(pmd_t pte) | 196 | static inline int pmd_large(pmd_t pte) |
190 | { | 197 | { |
191 | return (pmd_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) == | 198 | return (pmd_val(pte) & (_PAGE_PSE | _PAGE_PRESENT)) == |
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h index 549144d03d99..e454e4ec016d 100644 --- a/include/asm-x86/pgtable_64.h +++ b/include/asm-x86/pgtable_64.h | |||
@@ -175,8 +175,6 @@ static inline int pmd_bad(pmd_t pmd) | |||
175 | #define pte_present(x) (pte_val((x)) & (_PAGE_PRESENT | _PAGE_PROTNONE)) | 175 | #define pte_present(x) (pte_val((x)) & (_PAGE_PRESENT | _PAGE_PROTNONE)) |
176 | 176 | ||
177 | #define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) /* FIXME: is this right? */ | 177 | #define pages_to_mb(x) ((x) >> (20 - PAGE_SHIFT)) /* FIXME: is this right? */ |
178 | #define pte_page(x) pfn_to_page(pte_pfn((x))) | ||
179 | #define pte_pfn(x) ((pte_val((x)) & __PHYSICAL_MASK) >> PAGE_SHIFT) | ||
180 | 178 | ||
181 | /* | 179 | /* |
182 | * Macro to mark a page protection value as "uncacheable". | 180 | * Macro to mark a page protection value as "uncacheable". |