Re: x86 MSRs - example program

Stephan Meyer (
Fri, 28 Feb 1997 16:49:51 +0100 (MET)

On Fri, 28 Feb 1997, Philippe Strauss wrote:
> Reading some doco about RDTSC and RDMSR, I just learn that RDTSC is only
> available in ring 0.. (At least Therje Matiesen wrote that in his Byte
> article). I'm using RDTSC from user space since a while in a FFT
> benchmarking software, i just wonder how it is possible ?
> my software can be found here:
> Needless to say that i own an intel pentium.

This is from an Intel manual:
In the special register "cr4" bit number 3 decides over this.
If the bit is set (orl $4,%%cr4), executing RDTSC in any cpl!=0 gives a
GPF. IMHO this should be done in ./arch/i386/kernel/head.S or setup.c .
Maybe I'm being paranoid here, but this could be a security hole of some

Cheers, Stephan