From owner-freebsd-questions@FreeBSD.ORG Tue Sep 30 06:47:03 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 777CA16A4B3 for ; Tue, 30 Sep 2003 06:47:03 -0700 (PDT) Received: from mx.tele-kom.ru (mx.tele-kom.ru [213.80.148.6]) by mx1.FreeBSD.org (Postfix) with SMTP id 1FBA243FFB for ; Tue, 30 Sep 2003 06:47:01 -0700 (PDT) (envelope-from doublef@tele-kom.ru) Received: (qmail 74322 invoked by uid 555); 30 Sep 2003 17:46:59 +0400 Received: from hal.localdomain (213.80.149.144) by t-k.ru with TeleMail/2 id 1064929618-74302 for devnull@kma.eu.org; Tue, 30 Sep 17:46:58 2003 +0400 (MSD) Date: Tue, 30 Sep 2003 17:47:06 +0000 From: Sergey "DoubleF" Zaharchenko To: Shill Message-Id: <20030930174706.7d221d56.doublef@tele-kom.ru> In-Reply-To: <3F78AFAB.40806@kma.eu.org> References: <3F78AFAB.40806@kma.eu.org> X-Mailer: Sylpheed version 0.9.3claws (GTK+ 1.2.10; i386-portbld-freebsd4.8) Mime-Version: 1.0 Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha1"; boundary="aV(=.m/AdMSH4k1E" cc: freebsd-ia32@freebsd.org cc: freebsd-questions@freebsd.org Subject: Re: Why is PCE not set in CR4? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2003 13:47:03 -0000 --aV(=.m/AdMSH4k1E Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 30 Sep 2003 00:18:19 +0200 Shill probably wrote: > Hello all, > > I've been playing with my Athlon's timestamp counter for a while, > and I would like to experiment with the performance-monitoring > counters now. > > I can execute the RDTSC instruction from ring 3 because the TSD > (TimeStamp Disable) bit in CR4 (Control Register 4) is cleared. > > However, I am not allowed to use the RDPMC instruction from ring 3 > because the PCE (Performance-monitoring Counters Enable) bit is not set. You can do it with /dev/perfmon. man 4 perfmon. > Is there a reason (security? performance? other?) why FreeBSD does > not set PCE at boot time? > > On a related subject, is there a way for a kernel module to catch a > general-protection fault caused by an application trying to execute > RDMSR or WRMSR, and have the kernel module execute the instruction > for the application? Or is it cleaner to register two new system > calls to achieve the same thing? That would (probably) require adding superuser-configurable permissions to read/write to a specific MSR, as some of them are critical. I doubt it's worth creating extra device nodes, and I wonder if there's a "cleaner" way to do that. -- DoubleF The simpler the instruction, e.g. "press here", the more difficult it will be to open the package. --aV(=.m/AdMSH4k1E Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/ecGpwo7hT/9lVdwRAvcFAJwPdjioS+oR6wdSyB+fY+v63rb1iwCfe/eR q60GRfli1FzQwx2E1ufS4ls= =zHDs -----END PGP SIGNATURE----- --aV(=.m/AdMSH4k1E--