Subject: Re: CVS commit: src/sys/dev/ic
To: Christian Biere <christianbiere@gmx.de>
From: David Laight <david@l8s.co.uk>
List: source-changes
Date: 10/29/2006 17:33:47
On Sun, Oct 29, 2006 at 03:51:17PM +0100, Christian Biere wrote:
> Izumi Tsutsui wrote:
> 
> Then I understood. A struct cannot be used reliably to represent any offsets
> of "raw" memory without additional compiler-specific extension to C like
> __attribute__((__packed__). Well, never mind. 

And that doesn't DTRT either, since the compiler then has to generate
code to allow for the structure itself being misaligned - so on systems
which cannot do misaligned transfers (eg ARM) the compiler has to read
each byte of a 32bit value separately and then shift and 'or' them together.

I wonder what the guys at ARM were on when they decided on that structure
padding rule! (I'm presuming that gcc is following some ARM ABI).

	David

-- 
David Laight: david@l8s.co.uk