[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] [bug #26134] Insert a dummy u16_t field to prevent alig
Re: [lwip-devel] [bug #26134] Insert a dummy u16_t field to prevent alignment exceptions
Wed, 15 Apr 2009 21:11:39 +0100
Pluto/2.04e (RISC-OS/4.02) POPstar/2.05
In article <address@hidden>,
Srinivas Gollakota <address@hidden> wrote:
> Follow-up Comment #5, bug #26134 (project lwip):
> Yes. ETH_PAD_SIZE is much flexible.It just got overlooked in the migration.
> It's good enough for eth_hdr.
> With etharp_hdr there will be an issue for us. The crux of the issue is
> certain architectures word accesses has to be aligned to 4 byte boundary.
> Are there any other ports that has similar changes with regards to
But just because the architechture doesn't allow non word aligned word loads
doesn't mean words can't be loaded.
That's what all the structure packing macros are for - you just need to tell
the compiler to pack as instructed. Those without the packing macros can be
packed optimally for your architechture (ie. word aligned words with padding
auto inserted by the compiler).
It'll make the code fatter, because it'll probably get expanded to something
LOAD_BYTE tempreg0 from byte
LOAD_BYTE tempreg1 from byte
LOAD_BYTE tempreg2 from byte
LOAD_BYTE tempreg3 from byte
wordreg4 = (tempreg3 <<24) | (tempreg2 <<16) | (tempreg1 <<8) | tempreg0
LOAD_WORD wordreg4 from word
or the equivalent,