Subject: Re: Porting netbsd networking code to alignment-strict processors
To: Randy Turner <rturner@2WIRE.com>
From: Chris G. Demetriou <cgd@netbsd.org>
List: tech-net
Date: 06/17/1999 21:37:13
Randy Turner <rturner@2WIRE.com> writes:
> I was looking at the bsd4.4 networking code and it looks like that in some
> cases, structures are mapped directly over the top of memory pointed to by
> mbufs. It seems as if this would cause problems on CPU architectures that
> are sensitive to alignment issues, due to the fact that a particular
> longword (32-bit) item in a structure might fall onto an arbitrary byte
> boundary if an arbitrary byte offset in an mbuf is cast to a structure
> pointer.

Indeed there would be problems if an arbitrary byte offset were cast
to a structure pointer.

The drivers go out of their way to make sure properly-aligned data is
passed to the networking code.

NetBSD does run on several alignment-strict processors (my favorite
being alpha 8-).



cgd
-- 
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.