Re: block layer sg, bsg

From: Daniel Phillips
Date: Sun Aug 08 2004 - 14:19:54 EST


On Friday 06 August 2004 11:04, Andi Kleen wrote:
> > Somewhere I got the idea that if a structure is declared with attribute
> > PACKED, gcc will generate alignment-independent code (e.g., access each
> > field byte by byte) on alignment-restricted architectures. So if what I
> > imagine about gcc is true, what issues remain? These structs have to be
> > declared packed anyway and with fixed field sizes, or the layout will
> > vary across architectures.
>
> With packed things should be fine for x86-64/i386. However it may
> generate bad code for other architectures.

That's the question. From talking to gcc developers in the former Cygnus
office, it's thought that alignment-restricted architectures are supposed to
do bytewise access (or equivalent) to PACKED fields, but nobody was sure if
every architecture implements this, or even if it's the formally defined
behavior for PACKED. That's a subset of GCC developers of course.

As far as I can see, if PACKED doesn't work this way on all architectures then
it's broken and needs to be fixed.

Regards,

Daniel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/