Subject: Re: port-sparc/4480: 64-bit problem
To: None <rmg@MIT.EDU>
From: Chris G. Demetriou <cgd@pa.dec.com>
List: netbsd-bugs
Date: 11/14/1997 10:25:31
> 	64-bit assignment statements tend to cause bus errors if misaligned.
>   Other OS's simply report an alignment error, generate a couple of extra
>   instructions, and get on with life. I don't know exactly what is causing
>   this behavior, but it should probably be changed to make porting easier.
>   If unintentional, then it's a bug and should be fixed :)

My little bit of religion:

Accessing data in an improperly aligned way is a bug in any normal
program.  It's a sign of incorrect assumptions or code which is
designed to behave in implementation-dependent ways.

If the architecture specification says that it should be fixed up (as
does the Alpha architecture), then the OS should fix it up, print a
warning, and, most importantly, let the user disable the fixups.

If the architecture specification does not mandate fixups, then the
kernel should by default take an action like the sparc kernel
currently does.  It might be nice to provide an option so that the
user can _enable_ fixups, but it shouldn't be mandatory.


I've yet to see a case where an unaligned access in any of the NetBSD
source tree was anything other than a programming bug.  From the
"good" developer's standoint, printing a warning tells you that
there's a bug, but gives you no opportunity to debug it.  From the
"bad" developer's standpoint, the only things that are actually bugs
are those which cause incorrect operation or which crash the program,
so unaligned accesses (which generally do indicate broken code, and
which do significantly slow down program operation if they happen
often enough) "aren't really bugs."





cgd