From: BonBon on
Hello~

I used MFC to get some MSR of CPU, I included "intrin.h" and used
"__readmsr()",

but it had error messages that "Privileged instrction".

I think OS maybe has protected it.

So, how to do that I can access MSR of CPU?

or where has some relative information of this? such as DDK, WDK or others.

Please someone can kindly tell me!

Thank you!

Best regards.

From: Pavel A. on
Correct. You can't do privileged instructions from user mode (even with MFC :)

--PA

"BonBon" <BonBon(a)discussions.microsoft.com> wrote in message news:C88EB1E2-A79A-47C1-80EA-024C61052C50(a)microsoft.com...
> Hello~
>
> I used MFC to get some MSR of CPU, I included "intrin.h" and used
> "__readmsr()",
>
> but it had error messages that "Privileged instrction".
>
> I think OS maybe has protected it.
>
> So, how to do that I can access MSR of CPU?
>
> or where has some relative information of this? such as DDK, WDK or others.
>
> Please someone can kindly tell me!
>
> Thank you!
>
> Best regards.
>


From: Ben Voigt on

"Pavel A." <pavel_a(a)NOwritemeNO.com> wrote in message
news:%23YR06KGIHHA.924(a)TK2MSFTNGP02.phx.gbl...
> Correct. You can't do privileged instructions from user mode (even with
> MFC :)
>
> --PA

The usual solution is to find a driver that already exposes what you're
looking for. A common driver providing user-mode access to protected I/O
resources is giveio, there is probably something similar for MSRs. But
isn't all that information exposed via API calls already?

>
> "BonBon" <BonBon(a)discussions.microsoft.com> wrote in message
> news:C88EB1E2-A79A-47C1-80EA-024C61052C50(a)microsoft.com...
>> Hello~
>>
>> I used MFC to get some MSR of CPU, I included "intrin.h" and used
>> "__readmsr()",
>>
>> but it had error messages that "Privileged instrction".
>>
>> I think OS maybe has protected it.
>>
>> So, how to do that I can access MSR of CPU?
>>
>> or where has some relative information of this? such as DDK, WDK or
>> others.
>>
>> Please someone can kindly tell me!
>>
>> Thank you!
>>
>> Best regards.
>>
>
>