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: Timmy Brolin
Subject: Re: [lwip-users] Misalignment problems on PowerPC (little endian mode)
Date: Tue, 27 May 2008 23:01:35 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)

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
  

reply via email to

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