how to reset general purpose performance counter of intel

527 Views Asked by At

I know we can use wrmsr and rdmsr instruction to set the performance counter and read the general purpose performance counter register.

However, my question is:

Do we need to reset the general purpose performance counter register before we issue the wrmsr?

In other words, for the following code, do we need to reset the performance counter before the following code? If we have to, how can we reset it?

    mov $0x0001010E, %eax                # Write selector value to EAX
    xor %edx, %edx                       # Zero EDX
    mov $0x187, %ecx                     # Write logical register id to ECX (IA32_PERFEVTSEL1)
    wrmsr
0

There are 0 best solutions below