提交 8431fd09 编写于 作者: F Franck Bui-Huu 提交者: Ralf Baechle

[MIPS] Introduce __pa_symbol()

This patch introduces __pa_symbol() macro which should be used to
calculate the physical address of kernel symbols. It also relies
on RELOC_HIDE() to avoid any compiler's oddities when doing
arithmetics on symbols.
Signed-off-by: NFranck Bui-Huu <fbuihuu@gmail.com>
Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
上级 d4df6d4e
...@@ -142,6 +142,7 @@ typedef struct { unsigned long pgprot; } pgprot_t; ...@@ -142,6 +142,7 @@ typedef struct { unsigned long pgprot; } pgprot_t;
#define __pa_page_offset(x) PAGE_OFFSET #define __pa_page_offset(x) PAGE_OFFSET
#endif #endif
#define __pa(x) ((unsigned long)(x) - __pa_page_offset(x)) #define __pa(x) ((unsigned long)(x) - __pa_page_offset(x))
#define __pa_symbol(x) __pa(RELOC_HIDE((unsigned long)(x),0))
#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET)) #define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) #define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册