In the following pseudo-code:
if (rdtscp supported by hardware) {
Invoke "rdtscp" instruction
} else {
Invoke "rdtsc" instruction
}
Let's say the CPU does not support the rdtscp
instruction and so we fallback to the else statement.
If CPU mispredicts the branch, is it possible for the instruction pipeline to try to execute rdtscp
and throw an Illgal Instruction
error?
It is explicitly documented for the #UD trap (Invalid Opcode Execution) in the Intel Processor Manuals, Volume 3A, chapter 6.15: