Delay slots

[email protected] Sat, 11 Jun 2016 17:23:13 +0000
Newsgroups gmane.os.netbsd.ports.mips.devel,gmane.os.netbsd.ports.pmax
Message-ID <[email protected]>
Hi,

I've heard port-pmax has trouble with mfc0 instruction needing a delay
slot after it, and the generic MIPS code being modified and tested
against newer machines which do not need this.

Delay slots are a generic MIPS problem, so I wanted to share a script I
am using to detect these cases with ease:

cd src/sys/arch/mips/mips
for i in  * ; do   unifdef -UPARANOIA  $i >  $i.UPARANOIA ; done
grep -A 1 -n mfc0 *.UPARANOIA

(I have used the unifdef -UPARANOIA to get code which doesn't have
PARANOIA defined, there are more problems with such code.

Some false negatives occur from using -A 1 rather than say, -A 3, if the
next line is not visible)

This has already allowed me to spot one problematic case of use
immediately after mfc0 call:
locore.S.UPARANOIA:189: mfc0    v0, MIPS_COP_0_STATUS
locore.S.UPARANOIA-190- or      v0, MIPS_SR_INT_IE

It is hard for me to inspect this code because I don't know immediately
which files are MIPS-I, whether MIPS-III needs the same, etc., what
other instructions need attention.

If someone could provide a useful list of problematic instructions and
mention architectures suffering problems, this could be a good tool.

Thanks.