What does the unimplemented trap bomb error message mean?
ethan.dicks at gmail.com
Wed Feb 7 00:17:01 CST 2007
On 2/6/07, Hex Star <hexstar at gmail.com> wrote:
> well what's a software trap? something that traps data?
Nope. Something that traps program execution. If you dig into the
Motorola documentation for the 68000 processor, there's a number of
pages (a whole chapter?) dedicated to how the trap architecture works.
To attempt to summarize, in a simple architecture like the 6502, you
have 3 fixed vector addresses in memory - all up at the top of the
65536-byte address space - I don't recall what order they come in, but
one is the reset vector, one is the IRQ vector, and one is the NMI
vector. In this context, a vector is an address to some code, not the
code itself. So... when the reset pin is asserted or the interrupt
request is asserted or the NMI (non-maskable interrupt) pin is
asserted, the processor grabs 16 bits from a specific place at the top
of memory and (leaving out a few details) stuffs that value in the
program counter and starts executing at the address based on what was
stored at the top of memory. With the 68000, it's *much* more
complex. In addition to hardware interrupts doing something similar
(but pulling from _low_ memory), events such as trying to execute from
an odd address (it's OK to jump to $10000 but not $10001) or divide by
zero or a variety of other pre-defined events, will cause unique
vectors to be invoked, allowing all of these events to be handled in
software, not just crashing the processor and forcing a reset. In
addition, there are officially defined "trap" instructions as part of
the 68000's instruction set - when the processor hits a TRAP
instruction, a similar chain of events is set into motion - in other
words, the processor acts like some hardware event happened, but
_really_, it was a software event - the OS or application programmer
_wanted_ the program flow to drop what it was doing and, using a fixed
location in memory as a reference, jump to some routine elsewhere in
memory. If you don't stuff the right 24-bit number (for a 68000) into
your software trap vector addresses in low memory, the processor is
going to end up going to some default routine that means, essentally,
that code flow jumped to something that hasn't been defined yet.
Rather than do nothing, the MacOS throws up a graphic and tells you
that you ended up somewhere that was never changed from some catch-all
default. It wasn't a hardware event, so the term "software trap" is
> I don't think it has
> to do with the normal meaning of trap which is kind of confusing...IMO it
> would've been better if they didn't use trap for these errors...
The word "trap" here is being used in a jargonistic sense, not a
conversational English sense. For someone that knows how the 68000
works, the term is clear and completely correct. To someone who isn't
technically savvy with processors at a very low level, it probably
does look like gibberish.
More information about the cctalk