Skip to content

Commit b78f63f

Browse files
linuswRussell King (Oracle)
authored andcommitted
ARM: 9088/1: Split KERNEL_OFFSET from PAGE_OFFSET
We want to be able to compile the kernel into an address different from PAGE_OFFSET (start of lowmem) + TEXT_OFFSET, so start to pry apart the address of where the kernel is located from the address where the lowmem is located by defining and using KERNEL_OFFSET in a few key places. Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent 8b95a7d commit b78f63f

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

arch/arm/include/asm/memory.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,14 @@
2020
#endif
2121
#include <asm/kasan_def.h>
2222

23-
/* PAGE_OFFSET - the virtual address of the start of the kernel image */
23+
/*
24+
* PAGE_OFFSET: the virtual address of the start of lowmem, memory above
25+
* the virtual address range for userspace.
26+
* KERNEL_OFFSET: the virtual address of the start of the kernel image.
27+
* we may further offset this with TEXT_OFFSET in practice.
28+
*/
2429
#define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET)
30+
#define KERNEL_OFFSET (PAGE_OFFSET)
2531

2632
#ifdef CONFIG_MMU
2733

arch/arm/kernel/head.S

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,14 @@
2323
#if defined(CONFIG_DEBUG_LL) && !defined(CONFIG_DEBUG_SEMIHOSTING)
2424
#include CONFIG_DEBUG_LL_INCLUDE
2525
#endif
26-
2726
/*
2827
* swapper_pg_dir is the virtual address of the initial page table.
2928
* We place the page tables 16K below KERNEL_RAM_VADDR. Therefore, we must
3029
* make sure that KERNEL_RAM_VADDR is correctly set. Currently, we expect
3130
* the least significant 16 bits to be 0x8000, but we could probably
3231
* relax this restriction to KERNEL_RAM_VADDR >= PAGE_OFFSET + 0x4000.
3332
*/
34-
#define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET)
33+
#define KERNEL_RAM_VADDR (KERNEL_OFFSET + TEXT_OFFSET)
3534
#if (KERNEL_RAM_VADDR & 0xffff) != 0x8000
3635
#error KERNEL_RAM_VADDR must start at 0xXXXX8000
3736
#endif

arch/arm/kernel/vmlinux.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ SECTIONS
4747
#endif
4848
}
4949

50-
. = PAGE_OFFSET + TEXT_OFFSET;
50+
. = KERNEL_OFFSET + TEXT_OFFSET;
5151
.head.text : {
5252
_text = .;
5353
HEAD_TEXT

0 commit comments

Comments
 (0)