diff options
-rw-r--r-- | arch/mips/include/asm/fixmap.h | 33 |
1 files changed, 1 insertions, 32 deletions
diff --git a/arch/mips/include/asm/fixmap.h b/arch/mips/include/asm/fixmap.h index dfaaf493e9d4..8c012af2f451 100644 --- a/arch/mips/include/asm/fixmap.h +++ b/arch/mips/include/asm/fixmap.h | |||
@@ -71,38 +71,7 @@ enum fixed_addresses { | |||
71 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) | 71 | #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) |
72 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) | 72 | #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) |
73 | 73 | ||
74 | #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) | 74 | #include <asm-generic/fixmap.h> |
75 | #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) | ||
76 | |||
77 | extern void __this_fixmap_does_not_exist(void); | ||
78 | |||
79 | /* | ||
80 | * 'index to address' translation. If anyone tries to use the idx | ||
81 | * directly without tranlation, we catch the bug with a NULL-deference | ||
82 | * kernel oops. Illegal ranges of incoming indices are caught too. | ||
83 | */ | ||
84 | static inline unsigned long fix_to_virt(const unsigned int idx) | ||
85 | { | ||
86 | /* | ||
87 | * this branch gets completely eliminated after inlining, | ||
88 | * except when someone tries to use fixaddr indices in an | ||
89 | * illegal way. (such as mixing up address types or using | ||
90 | * out-of-range indices). | ||
91 | * | ||
92 | * If it doesn't get removed, the linker will complain | ||
93 | * loudly with a reasonably clear error message.. | ||
94 | */ | ||
95 | if (idx >= __end_of_fixed_addresses) | ||
96 | __this_fixmap_does_not_exist(); | ||
97 | |||
98 | return __fix_to_virt(idx); | ||
99 | } | ||
100 | |||
101 | static inline unsigned long virt_to_fix(const unsigned long vaddr) | ||
102 | { | ||
103 | BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); | ||
104 | return __virt_to_fix(vaddr); | ||
105 | } | ||
106 | 75 | ||
107 | #define kmap_get_fixmap_pte(vaddr) \ | 76 | #define kmap_get_fixmap_pte(vaddr) \ |
108 | pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), (vaddr)) | 77 | pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), (vaddr)) |