From owner-p4-projects@FreeBSD.ORG Tue Aug 22 00:13:36 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4541B16A4E6; Tue, 22 Aug 2006 00:13:36 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 20DAB16A4EC for ; Tue, 22 Aug 2006 00:13:36 +0000 (UTC) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id DF73843D49 for ; Tue, 22 Aug 2006 00:13:35 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k7M0DZBB063763 for ; Tue, 22 Aug 2006 00:13:35 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k7M0DZbi063760 for perforce@freebsd.org; Tue, 22 Aug 2006 00:13:35 GMT (envelope-from imp@freebsd.org) Date: Tue, 22 Aug 2006 00:13:35 GMT Message-Id: <200608220013.k7M0DZbi063760@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 104742 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Aug 2006 00:13:36 -0000 http://perforce.freebsd.org/chv.cgi?CH=104742 Change 104742 by imp@imp_lighthouse on 2006/08/22 00:13:06 DOSPARTOFF is 446. This is 2 % 4, which means that attempts to access uint32_t elements will fail with an alignment trap. Cope by using memcpy and add a comment to this effect. Affected files ... .. //depot/projects/arm/src/sys/boot/arm/at91/boot2/boot2.c#9 edit Differences ... ==== //depot/projects/arm/src/sys/boot/arm/at91/boot2/boot2.c#9 (text+ko) ==== @@ -342,6 +342,9 @@ printf("No BSD partition found\r\n"); return -1; } + // Although dp_start is aligned within the disk partition structure, + // DOSPARTOFF is 446, which is only word (2) aligned, not longword (4) + // aligned. Cope by using memcpy to fetch the start of this partition. memcpy(&dsk_start, &dp[i].dp_start, 4); if (drvread(sec, dsk_start + LABELSECTOR, 1)) return -1;