Skip to content

Commit 3bcf906

Browse files
committed
ARM: head.S: use PC relative insn sequence to calculate PHYS_OFFSET
Replace the open coded arithmetic with a simple adr_l/sub pair. This removes some open coded arithmetic involving virtual addresses, avoids literal pools on v7+, and slightly reduces the footprint of the code. Reviewed-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent d74d2b2 commit 3bcf906

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

‎arch/arm/kernel/head.S‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,8 @@ ENTRY(stext)
103103
#endif
104104

105105
#ifndef CONFIG_XIP_KERNEL
106-
adr r3, 2f
107-
ldmia r3, {r4, r8}
108-
sub r4, r3, r4 @ (PHYS_OFFSET - PAGE_OFFSET)
109-
add r8, r8, r4 @ PHYS_OFFSET
106+
adr_l r8, _text @ __pa(_text)
107+
sub r8, r8, #TEXT_OFFSET @ PHYS_OFFSET
110108
#else
111109
ldr r8, =PLAT_PHYS_OFFSET @ always constant in this case
112110
#endif
@@ -158,10 +156,6 @@ ENTRY(stext)
158156
1: b __enable_mmu
159157
ENDPROC(stext)
160158
.ltorg
161-
#ifndef CONFIG_XIP_KERNEL
162-
2: .long .
163-
.long PAGE_OFFSET
164-
#endif
165159

166160
/*
167161
* Setup the initial page tables. We only setup the barest

0 commit comments

Comments
 (0)