From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 3187 invoked from network); 31 Aug 1998 17:57:20 -0000 Received: from mail.redhat.com (199.183.24.239) by mail2.redhat.com with SMTP; 31 Aug 1998 17:57:20 -0000 Received: from yoda.omnicron.com (postmaster@yoda.omnicron.com [206.14.225.215]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id NAA10507 for ; Mon, 31 Aug 1998 13:58:01 -0400 Received: from ford@omnicron.com by yoda.omnicron.com (ds9mail 1.5) with "/bin/mail" id 90188; Mon, 31 Aug 98 10:51:22 -0700 From: ford@omnicron.com (Mike "Ford" Ditto) Date: Mon, 31 Aug 98 10:51:22 -0700 Message-ID: <35EAE29A.04A8@yoda.omnicron.com> To: axp-list@redhat.com In-reply-to: <199808310601.AAA10916@ellpspace.math.ualberta.ca> (message from Michal Jaegermann on Mon, 31 Aug 1998 00:01:06 -0600 (MDT)) Subject: Re: Unaligned traps on kernel startup Content-Type: text > 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 #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"