3 ms·
It’s more than just a bit. You need a bit saying “in a delay slot” and a whole word that stores the target of the branch.
by amluto 8y ago
It’s more than just a bit. You need a bit saying “in a delay slot” and a whole word that stores the target of the branch.
- monocasa 8y agoNah, a delay slot bit is fine. Branches haven't really retired yet (that's the point of a delay slot), so when you reenter the instruction with that bit set the CPU just backs PC up and executes both of them again. You have to make sure you can map two pages at once in case the branch/delay pair straddles a TLB boundary, but you have to screw up pretty bad to not allow that.
- amluto 8y agoshudder If you try this on hardware that also supports software single stepping (which x86 does, but MIPS seems not to by default), then you have to be extra creative to guarantee forward progress. The same issue arises if you have data breakpoints. And if the branch loads from MMIO space, you have a problem.
- monocasa 8y agoI mean, it's MIPS so it's a load/store architecture anyway. Between the pair you're only going to have one memory reference at most, and it's going to be the delay slot.