Any one have a simple assembly "illegal instruction" exception handler that allows the program to continue after skipping over the illegal instruction? Here is what I have so far (it executes the routine but the routine doesn't work):
DEBUG_EXC_HANDLER:
move.l #0x00000001,%D0 || put 1 in D0
add.l %D0,%D3 || add D0 to D3 and put the result in D3
||(simple counter so I can see what's happening)
nop
nop
move.l (%A7)+,%D7 || pop status off stack
move.l (%A7)+,%D7 || pop pc off stack
move.l #0x00000002,%D1
move.l %D7,%D0
add.l %D1,%D0 || add D1 to D0 and put the result in D0
move.l %D0,-(%A7) || set top of stack to be error pc+2
nop
nop
rte
nop
nop
|| end
With this handler, I get a "format error" exception (different exception) right after the rte. Clearly I am not manipulating the stack correctly. Any ideas? Is it even possible to recover?
Thanks,
Niel
Hi Niel,
since you try to return with a RTE the processor expects to find
a format field on the stack. You probably intended to return with
a RTS instruction. Take a look into the documentation about
"Exception Stack Frame Definition".
Regards, Georg
Ok that seemed to fix it. I had read the section about the two entries on the stack but it was not clear to me that the rte read back that info and used it.
Thanks,
Niel