Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: Michal Jaegermann <michal@ellpspace.math.ualberta.ca>
To: rth@cygnus.com
Cc: axp-list@redhat.com, torvalds@transmeta.com
Subject: Re: Unaligned traps on kernel startup
Date: Mon, 31 Aug 1998 23:55:28 -0600 (MDT)	[thread overview]
Message-ID: <199809010555.XAA12491@ellpspace.math.ualberta.ca> (raw)
In-Reply-To: <19980831121049.D9512@dot.cygnus.com> from "Richard Henderson" at Aug 31, 98 12:10:49 pm

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


      reply	other threads:[~1998-09-01  5:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-31  6:01 Unaligned traps on kernel startup Michal Jaegermann
1998-08-31  7:55 ` furio ercolessi
1998-08-31 12:19 ` Uncle George
1998-08-31 17:51 ` Mike "Ford" Ditto
1998-09-01  1:49   ` Michal Jaegermann
1998-08-31 19:10 ` Richard Henderson
1998-09-01  5:55   ` Michal Jaegermann [this message]
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox