From owner-freebsd-questions@FreeBSD.ORG Mon Sep 29 15:18:22 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 3A12016A4B3; Mon, 29 Sep 2003 15:18:22 -0700 (PDT) Received: from postfix3-2.free.fr (postfix3-2.free.fr [213.228.0.169]) by mx1.FreeBSD.org (Postfix) with ESMTP id C1B3244003; Mon, 29 Sep 2003 15:18:20 -0700 (PDT) (envelope-from devnull@kma.eu.org) Received: from kma.eu.org (bobillot-3-82-67-146-167.fbx.proxad.net [82.67.146.167]) by postfix3-2.free.fr (Postfix) with ESMTP id 81CD2C6F2; Tue, 30 Sep 2003 00:18:19 +0200 (CEST) Message-ID: <3F78AFAB.40806@kma.eu.org> Date: Tue, 30 Sep 2003 00:18:19 +0200 From: Shill User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: freebsd-ia32@freebsd.org Subject: 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: Mon, 29 Sep 2003 22:18:22 -0000 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. 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? Thank you for reading me.