public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Luca Ellero <luca.ellero@brickedbrain.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: fix exception vectors
Date: Mon, 19 Jan 2015 11:11:34 +0100	[thread overview]
Message-ID: <54BCD856.1020607@brickedbrain.com> (raw)
In-Reply-To: <20150117074001.5ae2abd4@lilith>

Hi Albert,

On 17/01/2015 07:40, Albert ARIBAUD wrote:
> Hello Luca,
>
> On Mon, 29 Dec 2014 16:10:53 +0100, Luca Ellero
> <luca.ellero@brickedbrain.com> wrote:
>> After relocation, exception vectors still point to the old code (not relocated).
>> This patch fixes them.
>>
>> Signed-off-by: Luca Ellero <luca.ellero@brickedbrain.com>
>> ---
>>   arch/arm/lib/relocate.S |   15 +++++++++++++++
>>   1 file changed, 15 insertions(+)
>>
>> diff --git a/arch/arm/lib/relocate.S b/arch/arm/lib/relocate.S
>> index 92f5314..4186344 100644
>> --- a/arch/arm/lib/relocate.S
>> +++ b/arch/arm/lib/relocate.S
>> @@ -76,6 +76,21 @@ copy_loop:
>>   	blo	copy_loop
>>
>>   	/*
>> +	 * fix exception vectors
>> +	 */
>> +	ldr r2, =_undefined_instruction
>> +	ldr r3, =_fiq
>> +	add	r2, r2, r4
>> +	add	r3, r3, r4
>> +fix_exceptions:
>> +	ldr r0, [r2]
>> +	add	r0, r0, r4
>> +	str	r0, [r2]
>> +	cmp r2,r3
>> +	add r2, #4
>> +	blo fix_exceptions
>> +
>> +	/*
>>   	 * fix .rel.dyn relocations
>>   	 */
>>   	ldr	r2, =__rel_dyn_start	/* r2 <- SRC &__rel_dyn_start */
>> --
>> 1.7.10.4
>>
>
> There is already a mechanism to relocate vectors (do a git grep for
> 'relocate_vectors' which takes into account various ISA and SoC cases.
>
> Can you describe the use case which you are encountering?

As far as I can see the mechanism to relocate vectors is implemented 
only on iMX25/27 and involves high vectors address (0xFFFFxxxx).

The problem is that, after relocation, U-Boot doesn't fix the vector 
table addresses, they still point to the old addresses (before relocation).
This is wrong and this patch fixes them to point to the new addresses.

I had to use this patch trying to implement IRQ support for a Freescale 
iMX6 board. iMX6 does not provide RAM at the high vectors address and 
trying to access them leads to errors, so I couldn't use them.

Regards

-- 
Luca Ellero

E-mail: luca.ellero at brickedbrain.com
Internet: www.brickedbrain.com

  reply	other threads:[~2015-01-19 10:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-29 15:10 [U-Boot] [PATCH] arm: fix exception vectors Luca Ellero
2015-01-17  6:40 ` Albert ARIBAUD
2015-01-19 10:11   ` Luca Ellero [this message]
2015-01-19 10:28     ` Albert ARIBAUD
2015-01-19 15:28       ` Luca Ellero
2015-01-19 15:40       ` Bill Pringlemeir
2015-01-20  6:55         ` Albert ARIBAUD

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=54BCD856.1020607@brickedbrain.com \
    --to=luca.ellero@brickedbrain.com \
    --cc=u-boot@lists.denx.de \
    /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