Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Dec 2006 01:59:23 -0800 (PST)
From:      ranjith kumar <ranjith_kumar_b4u@yahoo.com>
To:        freebsd-ia32@freebsd.org
Subject:   writing to performance event select registers
Message-ID:  <75870.6526.qm@web58615.mail.re3.yahoo.com>

next in thread | raw e-mail | index | archive | help
Hi,
    I want to measure number of last level cache
misses in Pentium 4 processor. In IA-32 programmers
manuals it was given that there are (architectural=
same across all IA-32 processors)perfomance monitoring
counters starting at address   0c1H and
performance_event_select registers starting at address
186H. 

1) When I tried to run a kernel module to write some
value in performance event select register (with
address 186H) by wrmsr instruction, the system is
hanging.Why?
The program is :
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */
//#include<xmmintrin.h>
int i,j,k=0;
unsigned int xx,yy,xx1,yy1,xx2,yy2;
unsigned int t1,t2,t3,t4,BIG=0xffffffff;
int init_module(void)
{

asm volatile (" movl $0x186, %%ecx;"
	      " movl $0x0,   %%edx;"
	      " movl $0x0009412E, %%eax;"
	      " wrmsr;"
		:
		:
		:"%eax","%edx","%ecx"); 


printk(KERN_INFO " Initially %u=t1 %u=t2 %u=t3 %u=t4
\n",t1,t2,t3,t4);
 return 0;
}


void cleanup_module(void)
{
printk(KERN_INFO "Goodbye world \n");
}
-------------------------------------------------------


Thanks in advane.





 
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?75870.6526.qm>