Re: Accessing Pentium MSRs

Theodore Ts'o (tytso@mit.edu)
Thu, 11 Apr 1996 12:36:25 -0400


Date: Thu, 11 Apr 1996 11:59:41 +0200 (MET DST)
From: Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>

Okay, here is the promised patch. It adds the syscalls "rdmsr" and "wrmsr",
which are wrappers around the instructions with the same names. Write access
is provided for MSRs 0x11, 0x12 and 0x13, which control the event counters,
and read access is provided for the same three plus the time stamp counter
(0x10), although the last one isn't exactly useful if you can't rely on being
the only running task.

If I remember correctly, there's some way of enabling r/o access the
time stamp counter from user mode. If that's true, then we don't have
to use the syscall method at all. This would be a big win, since the
syscall processing adds quite a large number of extra cycles to the time
stamp counter. :-)

- Ted