From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 15 12:16:35 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 EAA3B16A61F for ; Tue, 15 Aug 2006 12:16:35 +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 5BEE843D90 for ; Tue, 15 Aug 2006 12:16:06 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) (authenticated bits=0) by server.baldwin.cx (8.13.6/8.13.6) with ESMTP id k7FCFxWn026881; Tue, 15 Aug 2006 08:16:03 -0400 (EDT) (envelope-from jhb@freebsd.org) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Tue, 15 Aug 2006 08:00:43 -0400 User-Agent: KMail/1.9.1 References: <20060814124658.1d416cbe@localhost> <20060814231223.3c7f1930@localhost> <20060815074308.GN25753@deviant.kiev.zoral.com.ua> In-Reply-To: <20060815074308.GN25753@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200608150800.44403.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (server.baldwin.cx [192.168.0.1]); Tue, 15 Aug 2006 08:16:05 -0400 (EDT) X-Virus-Scanned: ClamAV 0.88.3/1662/Tue Aug 15 04:29:25 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: Kostik Belousov , John-Mark Gurney , Stanislav Sedov 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: Tue, 15 Aug 2006 12:16:36 -0000 On Tuesday 15 August 2006 03:43, Kostik Belousov wrote: > On Mon, Aug 14, 2006 at 11:12:23PM +0600, Stanislav Sedov wrote: > > On Mon, 14 Aug 2006 11:15:22 -0700 > > John-Mark Gurney mentioned: > > > > > > You should make a MD API for reading these out (if one doesn't already > > > exist) that handle the faulting for you, and then have your driver hook > > > into this api... > > > > > > I had to do something similar for accessing PCI config registers > > > that don't exist and cause a fault... > > > > > > > Do you know some examples to look at? The problem is that i can't make > > modifications in trap.c or anywhere else in src tree as such driver > > isn't likely to become a part of FreeBSD kernel. > > Hmm, I think that jhb@ somewhat misguided your. For kernel-mode faults > on i386, GPF and Segment not Present faults both results in calling > of pcb_onfault handler. This is true for both STABLE and CURRENT. > > And this is true for amd64 as well. > > Look at the code at the //trap.c, for arch in i386, amd64. Hmm, well that's handy then. Learn something new everyday. :) You can see how to use pcb_onfault in some of the routines in i386/i386/support.s. -- John Baldwin