Re: [hatari-devel] Code execution discontinuities and detecting them?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Le 25/02/2013 18:16, Eero Tamminen a écrit :
BKPT and CHK are very rare in common programs.
ILLEGAL is often used in debuger to create breakpoints, so that's kinda
rare too.

Do they cause PC for the next instruction to be something else than
the next address in memory?

Yes, it's like a trap or an exception, the PC will be set to the vector defined in the lower ram for each exception.


I don't think detecting swithes between exception handlers to be
a problem, but can I somehow detect when the code is inside *some*
exception handler, and when in "user-mode" code?

The main thing with this is to get rid of strange jumps from normal
code to exception handler code.  Strange jumps between exception
handlers are OK because user isn't going to have dozens of exception
handlers (i.e. there will be only few connections and they will
be in isolated place on the graph, not all over it).

No, you can't detect when the code is inside an exception handler. The exception handler is free to change SR, stack pointer, ... in any way it likes (for example, change A7 and SR in a way where RTS will be used instead of RTE).

Unless you have the information when Exception() is called, there's nothing after in the cpu context that can tell in which state you are.

Nicolas



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/