All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] R: Re: Strange arm9 behaviour reading long(s) not aligned to 4 bytes boundary
@ 2009-01-25 18:52 dibacco at libero.it
  2009-01-25 19:31 ` Wolfgang Denk
  2009-01-25 19:33 ` Måns Rullgård
  0 siblings, 2 replies; 3+ messages in thread
From: dibacco at libero.it @ 2009-01-25 18:52 UTC (permalink / raw)
  To: u-boot

>> I have something like this on a 32 bit little endian arm9 board (SAM9 
>> 
L9260):
>>
>> char buffer[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
>>
>> long A = * ( 
(long*) 
>> buffer );
>> long B = * ( (long*) (buffer + 2) );
>>
>> printf("A: %
08x  B: %08x", A, 
>> B);
>>
>> I would expect that A = 0x03020100 and B = 
0x05040302
>> instead I get the 
>> right value for A but  B is 0x01000302 or 
something like this but anyway not 
>> what I expect. 
>> Is there something 
wrong on the board? It seems that only 4 
>> bytes aligned long are read 
correctly.
>
>ARM9 does not support unaligned load/store.  Yours is apparently

>configured in the round-and-rotate mode.
>e
Then my code is simply wrong, that 
is, not allowed? If I have to port code from a PPC (that handles unaligned 
accesses)
to an ARM9 it is painful operation..., isn't it?

Bye,
Antonio.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] R: Re: Strange arm9 behaviour reading long(s) not aligned to 4 bytes boundary
  2009-01-25 18:52 [U-Boot] R: Re: Strange arm9 behaviour reading long(s) not aligned to 4 bytes boundary dibacco at libero.it
@ 2009-01-25 19:31 ` Wolfgang Denk
  2009-01-25 19:33 ` Måns Rullgård
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Denk @ 2009-01-25 19:31 UTC (permalink / raw)
  To: u-boot

Dear Antonio,

In message <10799135.81041232909531093.JavaMail.defaultUser@defaultHost> you wrote:
>
> Then my code is simply wrong, that 

Basicly, yes.

> is, not allowed? If I have to port code from a PPC (that handles unaligned 
> accesses)

...then you should fix the PPC code as well.

> to an ARM9 it is painful operation..., isn't it?

This has nothing to do with ARM.

Porting broken code is always a pain, though.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The use of Microsoft crippleware systems is a sin that  carries  with
it its own punishment.
         -- Tom Christiansen in <6bo3fr$pj8$5@csnews.cs.colorado.edu>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] R: Re: Strange arm9 behaviour reading long(s) not aligned to 4 bytes boundary
  2009-01-25 18:52 [U-Boot] R: Re: Strange arm9 behaviour reading long(s) not aligned to 4 bytes boundary dibacco at libero.it
  2009-01-25 19:31 ` Wolfgang Denk
@ 2009-01-25 19:33 ` Måns Rullgård
  1 sibling, 0 replies; 3+ messages in thread
From: Måns Rullgård @ 2009-01-25 19:33 UTC (permalink / raw)
  To: u-boot

"dibacco at libero.it" <dibacco@libero.it> writes:

>>> I have something like this on a 32 bit little endian arm9 board (SAM9L9260):
>>>
>>> char buffer[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
>>>
>>> long A = * ( (long*)  buffer );
>>> long B = * ( (long*) (buffer + 2) );
>>>
>>> printf("A: %08x  B: %08x", A, B);
>>>
>>> I would expect that A = 0x03020100 and B = 0x05040302
>>> instead I get the  right value for A but  B is 0x01000302 or 
>>> something like this but anyway not  what I expect. 
>>> Is there something  wrong on the board? It seems that only 4 
>>> bytes aligned long are read  correctly.
>>
>>ARM9 does not support unaligned load/store.  Yours is apparently
>
>>configured in the round-and-rotate mode.
>>
> Then my code is simply wrong, that is, not allowed? If I have to
> port code from a PPC (that handles unaligned accesses) to an ARM9 it
> is painful operation..., isn't it?

If your code relies on unaligned memory accesses, then yes, making it
run on an ARM9 might not be much fun.  I would suggest you set the
processor to trap on unaligned accesses (the manual will tell you how).
That should make it easier to find them all.

-- 
M?ns Rullg?rd
mans at mansr.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-25 19:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-25 18:52 [U-Boot] R: Re: Strange arm9 behaviour reading long(s) not aligned to 4 bytes boundary dibacco at libero.it
2009-01-25 19:31 ` Wolfgang Denk
2009-01-25 19:33 ` Måns Rullgård

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.