From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 9867 invoked from network); 1 Sep 1998 05:55:35 -0000 Received: from mail.redhat.com (199.183.24.239) by mail2.redhat.com with SMTP; 1 Sep 1998 05:55:35 -0000 Received: from ellpspace.math.ualberta.ca (michal@ellpspace.math.ualberta.ca [129.128.88.19]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id BAA32751 for ; Tue, 1 Sep 1998 01:56:22 -0400 Received: (from michal@localhost) by ellpspace.math.ualberta.ca (8.8.8/8.8.8) id XAA12491; Mon, 31 Aug 1998 23:55:29 -0600 From: Michal Jaegermann Message-Id: <199809010555.XAA12491@ellpspace.math.ualberta.ca> Subject: Re: Unaligned traps on kernel startup To: rth@cygnus.com Date: Mon, 31 Aug 1998 23:55:28 -0600 (MDT) Cc: axp-list@redhat.com, torvalds@transmeta.com In-Reply-To: <19980831121049.D9512@dot.cygnus.com> from "Richard Henderson" at Aug 31, 98 12:10:49 pm Content-Type: text Richard Henderson wrote: > > On Mon, Aug 31, 1998 at 12:01:06AM -0600, Michal Jaegermann wrote: ..... > > It is from linux/drivers/block/genhd.c and traps happen on lines > > marked with '---->': > > > > 329 for (i = 0; i < 4 ; i++) { > > 330 struct partition *q = &p[i]; > > 331 if (NR_SECTS(q) > > 332 -----> && (q->sector & 63) == 1 > > 333 -----> && (q->end_sector & 63) == 63) { > > Linus, the compiler has gotten smart. It sees that those two character > loads are contained in a structure with known alignment, and optimizes. > > I don't see a solution at the moment less gross than just marking the > structure as packed. Alternately, I suppose we could turn off the > unaligned access message in the kernel for the 2.2 release. Actually a suggestion from Mike "Ford" Ditto seems to work pretty well. I replaced the lines in question with: && (get_unaligned(&q->sector) & 63) == 1 && (get_unaligned(&q->end_sector) & 63) == 63) { and now everything seems to be happy. A macro "get_unaligned" is defined for all architectures. Michal