Date: Mon, 13 Nov 2006 02:28:54 +0300 From: Ruslan Ermilov <ru@FreeBSD.org> To: "M. Warner Losh" <imp@bsdimp.com>, Joseph Koshy <jkoshy@FreeBSD.org> Cc: arm@FreeBSD.org, sam@errno.com, keramida@FreeBSD.org, current@FreeBSD.org, kabaev@gmail.com Subject: Re: [head tinderbox] failure on arm/arm Message-ID: <20061112232854.GC45238@rambler-co.ru> In-Reply-To: <20061112.160539.-1350496508.imp@bsdimp.com> References: <20061112132105.6bac38d6@kan.dnsalias.net> <20061112192810.GC1173@rambler-co.ru> <4557825E.3070009@errno.com> <20061112.160539.-1350496508.imp@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--MW5yreqqjyrRcusr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 12, 2006 at 04:05:39PM -0700, M. Warner Losh wrote: > Yea, that's clearly bogus of it. It does this because it thinks that > eh is going to be 4-byte aligned, which it isn't in this case. I > think that we may need to change: >=20 > /* > * Structure of a 10Mb/s Ethernet header. > */ > struct ether_header { > u_char ether_dhost[ETHER_ADDR_LEN]; > u_char ether_shost[ETHER_ADDR_LEN]; > u_short ether_type; > }; >=20 > to be >=20 > struct ether_header { > u_char ether_dhost[ETHER_ADDR_LEN]; > u_char ether_shost[ETHER_ADDR_LEN]; > u_short ether_type; > } __packed; >=20 > since that would fit. >=20 "fit" =3D=3D avoid 32-bit loads (I've similarly checked adding __packed to "struct ar_hdr" here, and it indeed stops using 32-bit loads instructions now): %%% Index: ar.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/ncvs/src/include/ar.h,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 ar.h --- ar.h 24 May 1994 09:57:26 -0000 1.1.1.1 +++ ar.h 12 Nov 2006 23:26:38 -0000 @@ -44,6 +44,8 @@ #ifndef _AR_H_ #define _AR_H_ =20 +#include <sys/cdefs.h> + /* Pre-4BSD archives had these magic numbers in them. */ #define OARMAG1 0177555 #define OARMAG2 0177545 @@ -62,6 +64,6 @@ struct ar_hdr { char ar_size[10]; /* size in bytes */ #define ARFMAG "`\n" char ar_fmag[2]; /* consistency check */ -}; +} __packed; =20 #endif /* !_AR_H_ */ %%% > There's one caveat that I'd caution people about. NetBSD had lots of > issues with gcc4 and packed when the struct doesn't need to be packed. >=20 We don't have a lot of packed structs yet, and we should certainly have more of them. :-) Cheers, --=20 Ruslan Ermilov ru@FreeBSD.org FreeBSD committer --MW5yreqqjyrRcusr Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFV642qRfpzJluFF4RAvxsAJsHxNw7Xu078RVRV7gZUGmpWnvSaACfbZ5G psteO64afQgekuYrzw6kJu8= =MhYA -----END PGP SIGNATURE----- --MW5yreqqjyrRcusr--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061112232854.GC45238>