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

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


Hi,

(Sorry, more questions... :-))

On lauantai 16 maaliskuu 2013, Laurent Sallafranque wrote:
> Le 15/03/2013 23:13, Eero Tamminen a écrit :
> > Does DSP have also this kind of interrupts?
> 
> Yes, you can program interrupts in the DSP for HOST transfers or SSI
> transfers for example.
> The 68030 can also interrupt the DSP (via the host port) and let him
> interrupt to execute some specific code  before returning to the main
> routine.

Is there some way with DSP to know that DSP is running interrupt/exception
handler code instead of "normal" code i.e. can switches to interrupt
context be identified, or are heuristics based on caller instruction
type required like with m68k side?


And are there specific instructions (like TRAP on m68k) to invoke exception
handlers, and (more importantly for the heuristics) to return from them 
(like RTE on m68k)?


> > Btw. I've thought of counting cycles, i-cache misses etc for a subset
> > of the tracked calls.  It can be done for subroutine calls, by saving
> > the values when the call is done, and storing difference to current
> > values when the call returns.
> > 
> > For this to work also for DSP, I need to know what are DSP subroutine
> > call instructions, subroutine call return instruction(s) and their
> > opcodes.
> 
> For the DSP subroutines, instructions are :
> 
> rts : as on the 68030.
> 
> JSCC : jump to subroutine under a condition
> JSCLR : Jump to Subroutine if Bit Clear
> JSSET : Jump to Subroutine if Bit Set
> JSR : jump to subroutine
> 
> 
> For the opcodes, there are many opcodes for each of these instructions :
> 
> The easiest : RTS
> 
> 00000000 00000000 00001100
....
> Hope this helps,

Yes, thanks!

(Attached is a script for converting given DSP
opcode pattern to a mask & value to match.)


What about branch and jump instructions,
are there several of those also?

And what's the maximum DSP instruction length?


	- Eero
#!/usr/bin/env python

import sys, os

# remove spaces and upper 8-bits if they're zero
pattern = sys.argv[1].replace(" ", "")
if len(pattern) == 32 and pattern.startswith("0000"):
    pattern = pattern[4:]

mask = ""
value = ""
for char in pattern:
    if char in "01":
        value += char
        mask += '1'
    else:
        value += '0'
        mask += '0'
print "PATTERN: '%s'" % pattern
print "MASK:"
print "- '%s'" % mask
print "- 0x%X" % int(mask, 2)
print "VALUE:"
print "- '%s'" % value
print "- 0x%X" % int(value, 2)


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