lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Misalignment problems on PowerPC (little endian mode)


From: Simon Goldschmidt
Subject: Re: [lwip-users] Misalignment problems on PowerPC (little endian mode)
Date: Wed, 28 May 2008 12:47:13 +0200

Keep in mind that many MACs with DMA support cannot receive to unaligned 
addresses! In that case, the two-byte-padding before the ethernet frame does 
not work!

Simon

> It would work just fine since there are no unaligned accesses in lwip, 
> assuming the two byte pad at the beginning of the 14byte ethernet frame 
> has been enabled.
> The structure packing in lwip is really only there to prevent the 
> compiler from inserting unnecessary padding. By "unnecessary padding" I 
> mean padding which is not required in order to guarantee aligned accesses.
> 
> I have used lwip on a processor which _will_ crash if there is a single 
> unaligned access.
> 
> Regards,
> Timmy Brolin
> 
> Simon Goldschmidt wrote:
> 
> >>#define FIELD1(A) (*((short int*)&A[0]))
> >>#define FIELD2(A) (*((long*)&A[2]))
> >>x=FIELD1(data); /* using field1 */
> >>    
> >>
> >
> >I don't know how this should help: say A starts at 0x03, then accessing
> FIELD2 would still result in a long-pointer being accessed at 0x03+2 = 0x05.
> This is what will not work on most platforms.
> >
> >Simon
> >  
> >

-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger




reply via email to

[Prev in Thread] Current Thread [Next in Thread]