Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 Feb 2010 10:45:37 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        brde@optusnet.com.au
Cc:        svn-src-head@FreeBSD.org, luigi@FreeBSD.org, src-committers@FreeBSD.org, svn-src-all@FreeBSD.org
Subject:   Re: svn commit: r203343 - head/sys/netinet
Message-ID:  <20100201.104537.578650865272929831.imp@bsdimp.com>
In-Reply-To: <20100202012830.B1230@besplex.bde.org>
References:  <201002011413.o11EDiPm074656@svn.freebsd.org> <20100202012830.B1230@besplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20100202012830.B1230@besplex.bde.org>
            Bruce Evans <brde@optusnet.com.au> writes:
: Rev.1.30 attempted to fix this by also adding the __aligned(4)
: attribute.
: I haven't checked that this works.  It adds additional unportability
: and
: ugliness.

__packed is necessary for ARM where the rules of the ABI we use are
such that this structure isn't properly packed otherwise.[*]

__aligned(4) tells the compiler that pointers to this structure are
4-byte aligned, which helps on many platforms generate more optimal
code.

The root cause of all this mess is that 'C' doesn't have any good,
easy ways to specify "on the wire" formats of structures.  So we have
to play these games to make the headers we snarfed off the wire match
the C structs that we're using to access the fields in those
structures.  We are necessarily in unportability land here.  It is
only by the chance alignment of the x86 ABI and the wire format that
the project was able to ignore the issue for so long...

Warner

[*] Of course, it could be argued that ARM should use a different
and/or better ABI for newer cores, and I'd agree with that...  But
until that's fixed, we have to cope.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100201.104537.578650865272929831.imp>