Re: Fetching a value of control registers from user space

MOLNAR Ingo (mingo@chiara.csoma.elte.hu)
Tue, 5 Jan 1999 14:49:28 +0100 (CET)


On 4 Jan 1999, Josip Gracin wrote:

> When I try to use the following program I get a SEGV fault. Why is this?
> I thought reading a value from control registers isn't supposed to
> generate an exception.

> asm ("movl %%cr2, %0": "=r" (fa));

it is, cr2 could still contain the value of an kernel-internal pagefault,
which address we have no business to access. x86 Linux saves the last
user-generated pagefault address on the signal stackframe for you, see cr2
in 'struct sigcontext' in include/asm-i386/sigcontext.h.

-- mingo

-
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/