Re: privilege levels and kernel mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>Hi,
>    I am using pentium-4 processor. My operating
>system  is Linux version 2.4.22-1.2199.nptl
>
>  I want to measure performance events like number of
>memory reads, number of cache misses occured while
>running  a "C" program. For that I have to wright some
>values into "Model specific registers of pentium-4
>processor". But those registers can be written ONLY at
>privilege level of zero of pentium4 processor.
>
> We know that application programs we write (for
>example any C program)are run at privilege
>level-3(user mode).
>
>I know how to include assembly instructions in a C
>program to wtrite into "Model specific registers". But
>that program has to be run at privilege level zero.
>
>How to run a C program at privilege level zero??

The short answer: You can't.

The long answer: You have to write a kernel module to do what you need.

The best answer: Use /dev/cpu/0/msr.

>Can any one help me?
>
>Thanks in advance.
>
> 
>
>Send instant messages to your online friends http://uk.messenger.yahoo.com 
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to [email protected]
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/
>

	-`J'
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux