--
You received this message because you are subscribed to the Google Groups "RISC-V ISA Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isa-dev+u...@groups.riscv.org.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/isa-dev/33730570-cb8e-4a3c-aa14-5a7703f784c3n%40groups.riscv.org.
By the nature of this tracking bit software cannot observe the 1 setting of this bit in hardware. So, malware clearing it is not a concern since to clear it you would need to use an instruction that is not the special no-op and when this tracking bit is 1 any instruction but the no-op causes a fault. Setting this bit will require the next instruction that is fetched to be the special no-op – so again there is either a fault or if the next instruction is the special no-op the bit is defused and software in that mode cannot observe the 1-setting of this bit. The state of the tracking bit itself would be reported as a “prevIBT” state in mstatus and sstatus. For VS mode it would be in the hsstatus. So, it’s not a concern to enable in m-mode – the stateen for s-mode would enable it for S and for M-mode would enable it for M mode execution. The enable may not be appropriate in mstatus, this is better to be in the “stateen” register that we are discussing for extended ISA.
Ved
Good morning Allen. Sorry if I was not clear. I will try again.
There are two bits we are discussing – IBT-enable, IBT-tracker.
IBT-enable – enable branch tracking for termination using the branch-terminating noop.
The IBT-tracker – tracks the current state of the branch tracker.
So, on the trap itself an illegal op trap would be appropriate. The prevIBT provides an indication about why it was illegal.
On the IBT-tracker itself, you would have a decode copy of the tracker in the machine and a retirement copy of the tracker in the machine – both being in the in-order part of the machine. The retirement copy being used to recover the decode copy on mispredictions so the timing for this does not look onerous. The decoder will since it just decoded a jump instruction moves its copy to 1 and proceeds to decode the predicted target of the jump and if it is not the noop marks that instruction to fault (if it retired). If the prediction was wrong the decode copy will be recovered from the retirement copy. The machine can also stop allocation if at the predicted target of the jump it did not find the noop so it could prevent even speculative execution of code if the branch somehow got trained to non-branch target sites in the program.
There should not be a compressed version of the no op. An uncompressed instruction could have up to 20 bits of immediate and that may lead to an alias with the no op encoding and that would be unfortunate.
Reporting tracker state would need 2 bits:
Vedvyas