[comp.sys.mac] Bus and Address Error insights

macman@ethz.UUCP (Danny Schwendener) (09/27/88)

> Okay, now that I've got a Mac II, my most common error
> is "Bus Error" instead of "Address Error". But exactly what is a
> Bus Error?

Jim,
Exceptions can be generated by either internal or external means. 
The internal exceptions come from special instructions (Axxx and Fxxx 
Traps), an Address Error or the internal tracing mode (advanced users only), 
while the external Exceptions come from interrupts, a reset or a bus 
error from an external device.

Bus Errors are  generated by external devices like a parity checker,
a Watchdog timer or, in the case of the Macintosh,  the Memory 
Management Unit (MMU) and the NuBus.

The MMU will generate a Bus Error request if you access an invalid 
memory address. When you have an Address Error caused by a dangling 
handle, it might happen that you access an invalid memory adress. The
MMU then generates a Bus Error.

And since the priority of a Bus Error is always higher than the one of
an Address Error, you'll get the Bus Error message.

While we're on the topic, here's another reason for the Bus Error
waves: The 68020 allows you to read data on an odd address. The
68000 doesn't: a Mac plus will crash with an Address Error if you
try to access an odd address (by a dangling pointer, or some
chaotic program code). The Mac II will probably crash too, sooner
or later, when the program goes completely nuts and tries to access/
run/write/execute code on an address that doesn't physically exist.
Or when it tries to WRITE on an odd address boundary. (reading
is allowed, writing not. Another mysterious feature of the 68020).

Hope this helps.

-- Gil

+-----------------------------------------------------------------------+
| Mail   :   Gil Widmer, ETH Macintosh Support Center                   |
|            Swiss Federal Institute of Technology, CH-8092 Zuerich     |
| Bitnet :   macman@czheth5a      UUCP   :   {cernvax,mcvax}ethz!macman |
| Ean    :   macman@ifi.ethz.ch   Voice  :   +3dB at least              |
+-----------------------------------------------------------------------+

darin@Apple.COM (Darin Adler) (10/01/88)

In article <630@ethz.UUCP> macman@ethz.UUCP (Danny Schwendener) writes:

[a discussion of bus and address errors here]

> While we're on the topic, here's another reason for the Bus Error
> waves: The 68020 allows you to read data on an odd address. The
> 68000 doesn't: a Mac Plus will crash with an Address Error if you
> try to access an odd address (by a dangling pointer, or some
> chaotic program code). The Mac II will probably crash too, sooner
> or later, when the program goes completely nuts and tries to access/
> run/write/execute code on an address that doesn't physically exist.
> Or when it tries to WRITE on an odd address boundary. (reading
> is allowed, writing not. Another mysterious feature of the 68020).

Both reading and writing of non-aligned (odd) addresses is allowed.
However, if you jump to an odd address, you will get a bus error. In
other words, code to be executed must be word-aligned.
--
Darin Adler					       AppleLink: Adler4
UUCP: {sun,voder,nsc,mtxinu,dual}!apple!darin	  CSNET: darin@Apple.com

thomas@uplog.se (Thomas Hameenaho) (10/03/88)

In article <630@ethz.UUCP> macman@ethz.UUCP (Danny Schwendener) writes:

>The MMU will generate a Bus Error request if you access an invalid 
>memory address. When you have an Address Error caused by a dangling 
>handle, it might happen that you access an invalid memory adress. The
>MMU then generates a Bus Error.

example deleted

>Or when it tries to WRITE on an odd address boundary. (reading
>is allowed, writing not. Another mysterious feature of the 68020).
>

Crap!

The 68020 can both read AND write words and long-words on odd addresses.
What it can't do is to fetch instructions from odd byte addresses.

The 68020 also checks the address BEFORE it is put out on the pins so
it should be impossible to get both address and bus error for the same cycle.
-- 
Real life:	Thomas Hameenaho		Email:	thomas@uplog.{se,uucp}
Snail mail:	TeleLOGIC Uppsala AB		Phone:	+46 18 189406
		Box 1218			Fax:	+46 18 132039
		S - 751 42 Uppsala, Sweden