I want to register a PMI handler in windows 7, to log counter data after every N instructions. As per the Intel documentation, we need to enable the counter overflow using CCCR MSR. When overflow occurs, the PMI is generated through the local APIC. The performance counter entry in the local vector table (LVT) is set up to deliver the interrupt generated by the PMI to the processor.
I want to know -- how can I register my custom function (which reads the performance counter) such that it gets called once the interrupt occurs after N intructions.