From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 14 18:49:43 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 24B6D16A4DF for ; Mon, 14 Aug 2006 18:49:43 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8EAFC43D46 for ; Mon, 14 Aug 2006 18:49:42 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from localhost.corp.yahoo.com (john@localhost [127.0.0.1]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id k7EInZ09016552; Mon, 14 Aug 2006 14:49:38 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: Stanislav Sedov Date: Mon, 14 Aug 2006 13:17:57 -0400 User-Agent: KMail/1.9.1 References: <20060814124658.1d416cbe@localhost> <200608140932.57875.jhb@freebsd.org> <20060814194729.436fc453@localhost> In-Reply-To: <20060814194729.436fc453@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200608141317.58034.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [127.0.0.1]); Mon, 14 Aug 2006 14:49:38 -0400 (EDT) X-Virus-Scanned: ClamAV 0.88.3/1660/Mon Aug 14 11:42:28 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on server.baldwin.cx Cc: freebsd-hackers@freebsd.org Subject: Re: exception handling in kernel code X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Aug 2006 18:49:43 -0000 On Monday 14 August 2006 09:47, Stanislav Sedov wrote: > On Mon, 14 Aug 2006 09:32:57 -0400 > John Baldwin mentioned: > > > > You can make use of pcb_onfault to recover from a page fault, but that's > > about it. Kernel code is expected to not generate exceptions. :) > > > > Thanks a lot! I'll try it. > > To clarify: > > I've implemented driver to allow user-level code to read MSRs (Model > specific registers) (like linux's /dev/cpu/msr). It's required for > some programs like x86info. > > As long as not all MSRs documented and reading/writing unexistent MSR > leads to GP fault, I need to recover in that case. Hmm pcb_onfault won't help with this (it does PF#, not GP#). You will have to hack trap() to provide some sort of fallback for your case. -- John Baldwin