PERFORCE change 104742 for review

Warner Losh imp at FreeBSD.org
Tue Aug 22 00:13:36 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=104742

Change 104742 by imp at 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;


More information about the p4-projects mailing list