diff options
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r-- | include/asm-powerpc/page.h | 16 |
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 | /* |