From owner-freebsd-current@FreeBSD.ORG Sun May 11 03:17:49 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 A2DD937B401; Sun, 11 May 2003 03:17:45 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 80F8643FA3; Sun, 11 May 2003 03:17:43 -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 UAA07438; Sun, 11 May 2003 20:17:39 +1000 Date: Sun, 11 May 2003 20:17:38 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Maxime Henrion In-Reply-To: <20030510221612.GT21011@elvis.mu.org> Message-ID: <20030511195402.C75054@gamplex.bde.org> References: <20030509163718.GA22231@rot13.obsecurity.org> <20030510221612.GT21011@elvis.mu.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: Sun, 11 May 2003 10:17:49 -0000 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