[vox-tech] what is a bus error
Matt Roper
vox-tech@lists.lugod.org
Mon, 7 Jan 2002 19:41:43 -0800
In my experience, a bus error is caused by the same type of problem as a
segmentation fault (i.e. out of bounds memory access). I once had an
out of bounds memory access in a program I wrote and found that
depending on how far out of bounds my access was, the error message
would change between "segmentation fault" and "bus error" (this program
was running under Solaris on a Sun machine).
I'm not certain why one message appears sometimes and the other at other
times, but one possibility (a wild guess) is that since some
architectures use part of the address space to represent IO devices
instead of memory locations, the "Bus Error" message will occur if the
illegal memory location falls in the IO device address range and a
"Segmentation Fault" will occur if the illegal memory location falls in
the memory range. FWIW, I've never seen a bus error message on x86
Linux, so maybe it doesn't happen on the x86 architecture or maybe it's
just triggered differently.
Matt
On Mon, Jan 07, 2002 at 04:18:57PM -0800, Peter Jay Salzman wrote:
> i did a google search, and found alot of conflicting answers. some of
> them seemed to indicate that the precise definition of bus error is
> architecture dependent, but i find that hard to believe.
>
> i know what a segmentation violation is.
>
> but what exactly is a bus error?
>
> can anyone write a hello world type program that demonstrates barfing
> from a bus error? i found some code that purported to produce a bus
> error on a sparc, but it didn't barf under linux.
>
> pete
>
> --
> PGP Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D
> PGP Public Key: finger p@dirac.org
> _______________________________________________
> vox-tech mailing list
> vox-tech@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech
--
*************************************************
* Matt Roper <matt@mattrope.com> *
* http://www.mattrope.com *
* PGP Key: http://www.mattrope.com/mattrope.asc *
*************************************************