Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: ford@omnicron.com (Mike "Ford" Ditto)
To: axp-list@redhat.com
Subject: Re: Unaligned traps on kernel startup
Date: Mon, 31 Aug 98 10:51:22 -0700	[thread overview]
Message-ID: <35EAE29A.04A8@yoda.omnicron.com> (raw)
In-Reply-To: <199808310601.AAA10916@ellpspace.math.ualberta.ca> (message from Michal Jaegermann on Mon, 31 Aug 1998 00:01:06 -0600 (MDT))

> 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) {
>
> sizeof(struct partition) appears to be 16 so maybe I miss something
> but it seems a bit of strange that I see only two pairs of traps and
> not four.

Maybe you only have two actual partitions on that disk?

The traps occur because p points to the partition table portion of a
disk sector.  The disk sector is properly aligned, but the partition
table (at offset 0xFBE by IBM's/Microsoft's design) is not properly
aligned within the sector.

The fix for the traps is to have those marked lines use get_aligned the
way the line immediately above them does, as explained at the top of
genhd.c:

	/*
	 * Many architectures don't like unaligned accesses, which is
	 * frequently the case with the nr_sects and start_sect partition
	 * table entries.
	 */
	#include <asm/unaligned.h>

	#define SYS_IND(p)	get_unaligned(&p->sys_ind)
	#define NR_SECTS(p)	get_unaligned(&p->nr_sects)
	#define START_SECT(p)	get_unaligned(&p->start_sect)

Add two similar macros for sector and end_sector and use them.

					-=] Ford [=-

"But everybody wants a rock		(In Real Life:  Mike Ditto)
 to wind a piece of string around."	ford@omnicron.com
 - They Might be Giants,		http://www.omnicron.com/~ford/ford.html
   "We want a rock"


  parent reply	other threads:[~1998-08-31 17:57 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 [this message]
1998-09-01  1:49   ` Michal Jaegermann
1998-08-31 19:10 ` Richard Henderson
1998-09-01  5:55   ` Michal Jaegermann
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