I'm trying to read the MPERF and APERF MSRs. However, when I do so, the machine reboots, probably because of a GP exception.
Here is the code I use:
; Read MPERF register
mov ecx, 0xe7
rdmsr
The code breaks on rdmsr. I have an Intel Haswell processor. I'm running in long mode.
I'm pretty sure I'm running in Ring 0, as I'm running my own operating system. Moreover, if I do:
; Read PAT register
mov ecx, 0x277
rdmsr
it works without exception.
What are the other conditions to read this specific register (MPERF) ?