aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/page.h
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2005-12-05 11:24:33 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-08 22:51:54 -0500
commitb5666f70395016a55cc9d57826508b8a346398d0 (patch)
tree39d74718c2bc3f2fcba6456fdc39a6a0de3d78bd /include/asm-powerpc/page.h
parent51fae6de24da57bc6cdaa1b253595c3513ecbf2d (diff)
[PATCH] powerpc: Separate usage of KERNELBASE and PAGE_OFFSET
This patch separates usage of KERNELBASE and PAGE_OFFSET. I haven't looked at any of the PPC32 code, if we ever want to support Kdump on PPC we'll have to do another audit, ditto for iSeries. This patch makes PAGE_OFFSET the constant, it'll always be 0xC * 1 gazillion for 64-bit. To get a physical address from a virtual one you subtract PAGE_OFFSET, _not_ KERNELBASE. KERNELBASE is the virtual address of the start of the kernel, it's often the same as PAGE_OFFSET, but _might not be_. If you want to know something's offset from the start of the kernel you should subtract KERNELBASE. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc/page.h')
-rw-r--r--include/asm-powerpc/page.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/asm-powerpc/page.h b/include/asm-powerpc/page.h
index 94905ba2cf41..4696bdbcc085 100644
--- a/include/asm-powerpc/page.h
+++ b/include/asm-powerpc/page.h
@@ -37,6 +37,20 @@
37 */ 37 */
38#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1)) 38#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))
39 39
40/*
41 * KERNELBASE is the virtual address of the start of the kernel, it's often
42 * the same as PAGE_OFFSET, but _might not be_.
43 *
44 * The kdump dump kernel is one example where KERNELBASE != PAGE_OFFSET.
45 *
46 * To get a physical address from a virtual one you subtract PAGE_OFFSET,
47 * _not_ KERNELBASE.
48 *
49 * If you want to know something's offset from the start of the kernel you
50 * should subtract KERNELBASE.
51 *
52 * If you want to test if something's a kernel address, use is_kernel_addr().
53 */
40#define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START) 54#define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START)
41#define KERNELBASE PAGE_OFFSET 55#define KERNELBASE PAGE_OFFSET
42 56
@@ -56,7 +70,7 @@
56#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) 70#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
57#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT) 71#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
58 72
59#define __va(x) ((void *)((unsigned long)(x) + KERNELBASE)) 73#define __va(x) ((void *)((unsigned long)(x) + PAGE_OFFSET))
60#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET) 74#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET)
61 75
62/* 76/*