Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: leif.lindholm@linaro.org (Leif Lindholm)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC] arm: section split in boot/compressed/head.S
Date: Tue, 22 Jul 2014 15:42:47 +0100	[thread overview]
Message-ID: <20140722144247.GC4179@bivouac.eciton.net> (raw)
In-Reply-To: <CAKv+Gu8k=1M9Y7mjYVYYqe94YNFAkG-MRw_GipvN7ORxo4CAMA@mail.gmail.com>

On Mon, Jul 21, 2014 at 08:29:54PM +0200, Ard Biesheuvel wrote:
> On 21 July 2014 19:54, Leif Lindholm <leif.lindholm@linaro.org> wrote:
> > Reported-by: Roy Franz <roy.franz@linaro.org>
> >
> > The current code in boot/compressed/head.S executes pretty much
> > sequentially from "start", all the way until the end of
> > "dtb_check_done". However, shortly after the "not_angel" symbol, there
> > is a section change, in the form of a ".text" directive.
> >
> > This means any literal pools in .start end up getting inserted into
> > the middle of the instruction stream.
> >
> > Would something like the below (pardon the semantic silliness) be an
> > acceptable fix?
> >
> > diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
> > index 3a8b32d..8ee05e9 100644
> > --- a/arch/arm/boot/compressed/head.S
> > +++ b/arch/arm/boot/compressed/head.S
> > @@ -149,6 +149,10 @@ start:
> >                 mov     r0, #0x17               @ angel_SWIreason_EnterSVC
> >   ARM(          swi     0x123456        )       @ angel_SWI_ARM
> >   THUMB(                svc     0xab            )       @ angel_SWI_THUMB
> > +               b       angel
> 
> 
> The idea appears to be that code in .start sections from other
> platform specific object files gets put there, so it gets executed
> extremely early.
> Jumping over it kind of defeats the purpose here.

Ah, I got the impression something magic was going on, but failed to
spot that bit...

> Instead, adding an explicit .ltorg and jumping over /that/ should do
> the trick, I think, but perhaps it's better just to open code the
> literal pool in this case.

The current state seems fragile, so:

diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 3a8b32d..8fded53 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -149,6 +149,11 @@ start:
 		mov	r0, #0x17		@ angel_SWIreason_EnterSVC
  ARM(		swi	0x123456	)	@ angel_SWI_ARM
  THUMB(		svc	0xab		)	@ angel_SWI_THUMB
+		b	angel
+
+		.ltorg
+
+angel:
 not_angel:
 		safe_svcmode_maskall r0
 		msr	spsr_cxsf, r9		@ Save the CPU boot mode in

?

/
    Leif

      reply	other threads:[~2014-07-22 14:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-21 17:54 [RFC] arm: section split in boot/compressed/head.S Leif Lindholm
2014-07-21 18:29 ` Ard Biesheuvel
2014-07-22 14:42   ` Leif Lindholm [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140722144247.GC4179@bivouac.eciton.net \
    --to=leif.lindholm@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox