Memory alignment on i386
jtm-list-rtems at smoothsmoothie.com
Fri Aug 27 18:26:50 UTC 2004
On Fri, Aug 27, 2004 at 12:28:08PM -0400, CamiloAlejo at netscape.net wrote:
> I'm using rtems 4.6 with pc486 BSP. As far as I can see, the memory is byte-aligned, but I would like to change it to dword-aligned.
What exactly do you want aligned? You don't really mean you want
_every_ variable 32-bit aligned, do you?
You can specify the alignment of particular variables using gcc's
int i __attribute__(( aligned(4) ));
struct foo __attribute__(( aligned(4) ));
You can pass -malign-double on gcc's command line. Here's what the
documention says about it:
Control whether GCC aligns `double', `long double', and `long
long' variables on a two word boundary or a one word boundary.
Aligning `double' variables on a two word boundary will produce
code that runs somewhat faster on a `Pentium' at the expense of
*Warning:* if you use the `-malign-double' switch, structures
containing the above types will be aligned differently than the
published application binary interface specifications for the 386
and will not be binary compatible with structures in code
compiled without that switch.
-malign-double is x86 specific.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 189 bytes
Desc: Digital signature
More information about the users