This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: structure size
> > > Also, when the compiler inserts padding it usually does so for
> > > a good reason: manipulating packed structures can involve a
> > > significant performance penalty.
> >
> > Not only that, on many systems (ARM, SPARC, H8, ...)
> > manipulating packed structures can cause bus faults (if you're
> > lucky) or silently produce incorrect results.
>
> You'd better believe it. ARM in particular seems to just
> quietly rotate data when you make non-aligned accesses,
That's certainly what an ARM7 does. I don't remember for sure
what XScale does, but I have vague memories that it's
different. I know A SPARC generates a bus fault. I haven't
found out what an H8 does yet, but I imagine I'll find out the
hard way in the next few months.
> which is one very effective way to go insane.
The trick is to figure it out faster the next it happens. ;)
Porting x86 code (which allows unaligned accesses) to other
processors always seems to wake up alignment bugs.
--
Grant Edwards
grante@visi.com
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss