Home
Support

Knowledge Base

BSPs and drivers
Community resources
Product documentation
Questions?
Contact us

msr - read or write x86 CPU MSRs
 
________________________________________________________________________

Applicable Environment
________________________________________________________________________
  • Topic: msr - read/write x86 CPU MSRs
  • SDP: 6.5.0 SP1
  • Target: x86 targets
________________________________________________________________________

Recommendation
________________________________________________________________________

msr [ number [ new_value ] ]

If no <number> is given, the TSC is read.
If no <new_value> is provided, the MSR is only read.
If both <number> and <new_value> are given, the MSR is read and set.

--------------------------------------------------------------------

What happens?

MSRs (aside from the TSC) are only accessible in RING0, i.e., in
kernel space. Regular processes, even with I/O privileges, will
get you no further than RING1.

So to access MSRs, you need to operate in a kernel context - but
how to get there?

One -rather obvious- way is to attach an interrupt handler.
Since it is called from within the kernel, it will have the required
privileges and can perform the necessary operations for us.
*/

See attachment msr.c

________________________________________________________________________
NOTE: This entry has been validated against the SDP version listed above. Use caution when considering this advice for any other SDP version. For supported releases, please reach out to QNX Technical Support if you have any questions/concerns.
________________________________________________________________________


Related Attachments
 Attachment Name Size Last Modified
 msr.c 6KB 8/23/2012 3:51 PM





Please contact us with your questions or concerns.