[PATCH v2 3/8] ARM: add macro to perform far branches (b/bl)
Ard Biesheuvel
ard.biesheuvel at linaro.org
Tue Mar 17 13:35:56 PDT 2015
On 13 March 2015 at 17:40, Russell King - ARM Linux
<linux at arm.linux.org.uk> wrote:
> On Fri, Mar 13, 2015 at 01:07:27PM +0100, Ard Biesheuvel wrote:
>> + .macro bl_abs, target, c=
>> +#if defined(CONFIG_CPU_32v7) || defined(CONFIG_CPU_32v7M)
>> + movt\c lr, #:upper16:\target
>> + movw\c lr, #:lower16:\target
>> + blx\c lr
>
> So I've looked this up, and it's valid, which is surprising because BLX
> itself writes to LR - the read from LR must happen before BLX itself
> writes to LR. Thankfully, because of the pipelining, this is probably
> guaranteed.
>
I hadn't given it another thought, to be honest, as arithmetic
instructions can also use the same register as input and output.
But I suppose branch instructions don't go through all the ordinary
pipeline stages
> I wonder whether there will be any errata on this... maybe on non-ARM
> CPUs? It'll be interesting to find out what happens once we merge
> this... :)
>
More information about the linux-arm-kernel
mailing list