Skip to content

Commit d781145

Browse files
Nicolas PitreRussell King
authored andcommitted
ARM: 8512/1: proc-v7.S: Adjust stack address when XIP_KERNEL
When XIP_KERNEL is enabled, the virt to phys address translation for RAM is not the same as the virt to phys address translation for .text. The only way to know where physical RAM is located is to use PLAT_PHYS_OFFSET. The MACRO will be useful for other places where there is a similar problem. Signed-off-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Chris Brandt <chris.brandt@renesas.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent db57f88 commit d781145

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎arch/arm/include/asm/memory.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@
134134
*/
135135
#define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET)
136136

137+
#ifdef CONFIG_XIP_KERNEL
138+
#define PHYS_OFFSET_FIXUP \
139+
( XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) - PAGE_OFFSET + \
140+
PLAT_PHYS_OFFSET - CONFIG_XIP_PHYS_ADDR )
141+
#else
142+
#define PHYS_OFFSET_FIXUP 0
143+
#endif
144+
137145
#ifndef __ASSEMBLY__
138146

139147
/*

‎arch/arm/mm/proc-v7.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ __errata_finish:
487487

488488
.align 2
489489
__v7_setup_stack_ptr:
490-
.word __v7_setup_stack - .
490+
.word __v7_setup_stack - . + PHYS_OFFSET_FIXUP
491491
ENDPROC(__v7_setup)
492492

493493
.bss

0 commit comments

Comments
 (0)