Re: Fetching a value of control registers from user space

Josip Gracin (grac@fly.cc.fer.hr)
05 Jan 1999 20:11:25 +0100


Thanks everybody who responsed to my question.

Richard B. Johnson (root@chaos.analogic.com) wrote:
> Quote: (Intel 26-212)
> MOV to/from Special Registers.
> #GP(0) if current privilege level is not 0.
> This is a general protection violation. No user-mode program would
> (should) ever use these instructions.

Oh, I see.

I thought otherwise because of the following paragraph in the Intel
Programmer's Manual for i486 which I've downloaded perhaps a year ago from
Intel's site:

Chapter 2, System Architecture Overview

2.5. CONTROL REGISTERS
...
In protected mode, the move-to-or-from-control-registers forms of the MOV
instruction allow the control registers to be read (at any privilege
level) or loaded (at privilege level 0 only). This restriction means that
application programs (running at privilege levels 1, 2, or 3) are
prevented from loading the control registers; however, application
programs can read these registers. For example, an application might need
to read register CR0 to determine if an FPU is present.
...

Regards,

-- 
| Josip Gracin
| Zagreb, Croatia

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/