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

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


Hi,

On maanantai 25 helmikuu 2013, Nicolas Pomarède wrote:
> Le 25/02/2013 17:43, Eero Tamminen a écrit :
> > Is JMP used for subroutines in C-compiler (e.g. gcc) generated code or
> > just in hand-coded assembly?
> > 
> > And in how many cases approximately, 1%? 50%?
> 
> it could be  ; if the last code of a subroutine is a call to another
> subroutine :
....
> Any clever compiler could do this.

Ok, I guess I still label JMPs as direct calls, not subroutine calls,
but in the post-processing phase (which does the callgraph), handle
both as subroutine calls.  User can then at least check the information
from the profile file he gave to the post-processor.


> > What about other m68k CPU models?
> 
> I don't know for sure, but I guess 10 is the max for 68000. On higher
> cpu, FPU operation could use more bytes maybe.

Laurent?  Douglas?  Do you know more about the FPU instruction sizes?


> > What about BKPT, CHK, ILLEGAL instructions?  Aren't those used at all?
> 
> 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?


> > Hatari profiler code has also access to CPU state variables,
> > like state register value.
> > 
> > Can those be used to (more) reliably detect interrupt handlers or
> > exceptions?
> 
> The SR is not enough ; you can have an exception inside an exception,
> and in that case the SR will already be in supervisor mode.
> 
> I don't think there's anything in the cpu state that tell if an
> exception just hapenned.

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).


	- Eero



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