From owner-freebsd-current@FreeBSD.ORG Mon May 12 22:26:27 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9C9B837B401; Mon, 12 May 2003 22:26:27 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 15E6943F75; Mon, 12 May 2003 22:26:26 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from katana.zip.com.au (katana.zip.com.au [61.8.7.246]) by mailman.zeta.org.au (8.9.3p2/8.8.7) with ESMTP id PAA11829; Tue, 13 May 2003 15:26:18 +1000 Date: Tue, 13 May 2003 15:26:17 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Maxime Henrion In-Reply-To: <20030511195402.C75054@gamplex.bde.org> Message-ID: <20030513152535.H81955@gamplex.bde.org> References: <20030509163718.GA22231@rot13.obsecurity.org> <20030510221612.GT21011@elvis.mu.org> <20030511195402.C75054@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Kris Kennaway cc: alpha@freebsd.org cc: Andrew Gallatin cc: current@freebsd.org Subject: Re: Unaligned access fault in fxp on alpha X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 May 2003 05:26:28 -0000 [Resending after bounce] On Sun, 11 May 2003, Maxime Henrion wrote: > I removed them because they were just looking bogus. I wanted to ask > people to test a patch adding a __packed in the struct definition to see > if it fixed things. If it works with a __packed keyword, I'd like > it better than going back to having an array of four u_int8_t. > Otherwise I'll put the u_int8_t back. __packed looks very bogus to me. It is a syntax error for non-gcc compilers. The code was apparently originally carefully written to not depend on gccisms. I think __packed is also a pessimization here on some arches. The struct also has some u_int16_t's which are aligned, but __packed says that everything may be misaligned (unless you also use __aligned(mumble)). On some arches, the compiler will have to access everything as bytes and reassemble, or more complicated things if byte accesses are impossible. Since the accesses are for machine registers, the accesses with unusual widths and/or alignments for this may even be bugs. I just noticed that gcc now has some warnings -Wpacked and -Wpadded to help detect gratuitous use of __packed and errors in explicit packing/ padding. Bruce