> > The OS wants the _payload_ to be aligned on a 32-bit boundary. It tries
> > to do 32-bit accesses to the IP header, and the NFS code also does 32-bit
> > accesses when trying to un-XDR NFS requests.
>
> Oh... I see... I guess you could grab an mbuf and copy just the IP
> header for that, no? (Just curious at this point :-)
That doesn't work for the NFS case: an XDR-encoded packet may contain
lots of different fields separated by 32-bit length markers.
Also, there's a religious issue, namely a violation of protocol
boundaries. This is an ethernet driver: it's not supposed to have
any really intimate knowledge of IP or TCP or UDP, so you really
don't want to go mucking about with the frame payload if you can
avoid it.
(Lastly, my goal here is to make the card work, not re-write the
innards of the networking stack or NFS. I really don't want intimate
knowledge of IP, TCP or UDP either. :)
> > But on other CPUs such as the alpha, SPARC, PPC and (I suspect) the
> > IA-64, unaligned accesses in the kernel generate a fatal trap and a
> > panic. In user space, an unaligned access may result in a bus error,
> > unless the OS is kind enough to handle the trap, which I believe
> > FreeBSD/alpha does.
>
> I don't think that is the case. I seem to remember FreeBSD Alpha 4.3
> sysinstall croaking on me once with an alignment error.
No no: an unaligned access trap in the kernel is fatal, but an unaligned
access trap in a *user-space* process is not. Once in a while you
will see messages on the console about unaligned access traps generated
by user programs, but these don't panic the system. In the case of
FreeBSD/alpha, we fake it up so know about the problem but the process
keeps running. Some OSes (e.g. Solaris) clobber the process with a
SIGBUS. Some would argue the latter behavior is better since it makes
it easier to find and fix what is probably a bug in the first place.
-Bill
--
=============================================================================
-Bill Paul (925) 691-2800 | Senior Engineer, Master of Unix-Fu
[EMAIL PROTECTED] | Wind River Systems
=============================================================================
"I like zees guys. Zey are fonny guys. Just keel one of zem." -- The 3 Amigos
=============================================================================
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message