|
Message-ID: <nycvar.YSQ.7.76.1709041248400.8603@knanqh.ubzr> Date: Mon, 4 Sep 2017 12:50:32 -0400 (EDT) From: Nicolas Pitre <nicolas.pitre@...aro.org> To: Ard Biesheuvel <ard.biesheuvel@...aro.org> cc: linux-arm-kernel@...ts.infradead.org, kernel-hardening@...ts.openwall.com, Arnd Bergmann <arnd@...db.de>, Russell King <linux@...linux.org.uk>, Kees Cook <keescook@...omium.org>, Thomas Garnier <thgarnie@...gle.com>, Marc Zyngier <marc.zyngier@....com>, Mark Rutland <mark.rutland@....com>, Tony Lindgren <tony@...mide.com>, Matt Fleming <matt@...eblueprint.co.uk>, Dave Martin <dave.martin@....com> Subject: Re: [PATCH v2 11/29] ARM: head.S: use PC relative insn sequence to calculate PHYS_OFFSET On Sun, 3 Sep 2017, Ard Biesheuvel wrote: > Replace the open coded arithmetic with a simple adr_l/sub pair. This > ensures these quantities are invariant under runtime relocation. > > Cc: Russell King <linux@...linux.org.uk> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@...aro.org> Of course there won't be anything to relocate in a XIP kernel. But consistency is good and this looks nicer. Acked-by: Nicolas Pitre <nico@...aro.org> > --- > arch/arm/kernel/head.S | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > > diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S > index f607e290ef4b..62c961849035 100644 > --- a/arch/arm/kernel/head.S > +++ b/arch/arm/kernel/head.S > @@ -106,10 +106,8 @@ ENTRY(stext) > #endif > > #ifndef CONFIG_XIP_KERNEL > - adr r3, 2f > - ldmia r3, {r4, r8} > - sub r4, r3, r4 @ (PHYS_OFFSET - PAGE_OFFSET) > - add r8, r8, r4 @ PHYS_OFFSET > + adr_l r8, _text @ __pa(_text) > + sub r8, r8, #TEXT_OFFSET @ PHYS_OFFSET > #else > ldr r8, =PLAT_PHYS_OFFSET @ always constant in this case > #endif > @@ -161,10 +159,6 @@ ENTRY(stext) > 1: b __enable_mmu > ENDPROC(stext) > .ltorg > -#ifndef CONFIG_XIP_KERNEL > -2: .long . > - .long PAGE_OFFSET > -#endif > > /* > * Setup the initial page tables. We only setup the barest > -- > 2.11.0 > >
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.