From owner-freebsd-hackers Thu Mar 14 17:49:37 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id B6AD637B404 for ; Thu, 14 Mar 2002 17:49:33 -0800 (PST) Received: (from dillon@localhost) by apollo.backplane.com (8.11.6/8.9.1) id g2F1laf50765; Thu, 14 Mar 2002 17:47:36 -0800 (PST) (envelope-from dillon) Date: Thu, 14 Mar 2002 17:47:36 -0800 (PST) From: Matthew Dillon Message-Id: <200203150147.g2F1laf50765@apollo.backplane.com> To: Mike Silbersack Cc: Terry Lambert , "Clark C . Evans" , Subject: Re: panic: pmap_enter References: <20020314070732.H23489-100000@patrocles.silby.com> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :On Tue, 12 Mar 2002, Terry Lambert wrote: : :> #define blkmap(fs, map, loc) \ :> (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag))) :> :> looks a little suspect, doesn't it? "& 0" for 8 is probably :> correct, but "& 1" for 4 and "& 2" for 2 and "& 4" for 1 is :> probably not right... maybe: :> :> #define blkmap(fs, map, loc) \ :> (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & 0xff & ((0xff >> (NBBY - :> (fs)->fs_frag))^0xff)) :> :> Would be more right? After all, it's the high bits of the low :> bits you want to save, not the low bits of the low bits... :> :> -- Terry : :FWIW, I didn't mean to ignore this message, I was going to look it over :carefully before commenting. However, Sid Meier told me that I needed to :spend some time taking over the world, so I was unable to. : :If anyone familiar with FFS wants to check it out, please be my guest, :otherwise I'll try to get to it soon. : :Mike "Silby" Silbersack That doesn't look like '& 0' for 8 to me. NBBY is 8, fs_frag of 8, results in 0xFF >> 0 which is 0xFF, not 0. The original code looks correct. Try this: -Matt Matthew Dillon /* * BLKMAP.C * * #define blkmap(fs, map, loc) \ (((map)[(loc) / NBBY] >> ((loc) % NBBY)) & (0xff >> (NBBY - (fs)->fs_frag))) * * bno = block number (in fragment-sized blocks) * frag = fragment ratio N:1 * */ #include #define NBBY 8 int main(int ac, char **av) { int bno; for (bno = 0; bno < 32; ++bno) { int frag; if ((bno & 15) == 0) printf("BLOCK\t8:1\t\t\t4:1\t\t\t2:1\t\t\t1:1\n"); printf("%5d", bno); for (frag = 8; frag >= 1; frag >>= 1) { printf("\t([%d] >> %d) & 0x%02x", bno / NBBY, bno % NBBY, 0xFF >> (NBBY - frag) ); } printf("\n"); } return(0); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message