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, keramida@FreeBSD.org, current@FreeBSD.org 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>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
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:
>
> /*
> * 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;
> };
>
> to be
>
> struct ether_header {
> u_char ether_dhost[ETHER_ADDR_LEN];
> u_char ether_shost[ETHER_ADDR_LEN];
> u_short ether_type;
> } __packed;
>
> since that would fit.
>
"fit" == 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
===================================================================
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_
+#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;
#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.
>
We don't have a lot of packed structs yet, and we should certainly
have more of them. :-)
Cheers,
--
Ruslan Ermilov
ru@FreeBSD.org
FreeBSD committer
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)
iD8DBQFFV642qRfpzJluFF4RAvxsAJsHxNw7Xu078RVRV7gZUGmpWnvSaACfbZ5G
psteO64afQgekuYrzw6kJu8=
=MhYA
-----END PGP SIGNATURE-----
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061112232854.GC45238>
