CVSROOT: /cvs
Module name: src
Changes by: [email protected] 2010/10/18 10:18:48
Modified files:
sys/dev/ic : ar5008reg.h ar9003reg.h
Log message:
Add __attribute__((aligned(4))) to __packed Tx/Rx descriptors.
This makes gcc generate much more efficient code on architectures
with strong alignment constraints (like sparc64).
We use __packed to tell the compiler to not insert padding between
fields but the start of the descriptors is always 32-bit aligned.
When __packed is used, gcc assumes worst case scenario and generates
complicated code to prevent unaligned accesses.
Inspired by a similar change to ath9k.
Tested on sparc64.
For the record, example to set a field to 1 on a sparc64:
without __attribute__((aligned(4))):
ldub [%g2], %g1
and %g1, 0, %g1
stb %g1, [%g2]
ldub [%g2+1], %g1
and %g1, 0, %g1
stb %g1, [%g2+1]
ldub [%g2+2], %g1
and %g1, 0, %g1
stb %g1, [%g2+2]
ldub [%g2+3], %g1
and %g1, 0, %g1
or %g1, 1, %g1
stb %g1, [%g2+3]
with __attribute__((aligned(4))):
mov 1, %g1
st %g1, [%g2]