Date: Tue, 15 Aug 2006 08:00:43 -0400 From: John Baldwin <jhb@freebsd.org> To: freebsd-hackers@freebsd.org Cc: Kostik Belousov <kostikbel@gmail.com>, John-Mark Gurney <gurney_j@resnet.uoregon.edu>, Stanislav Sedov <ssedov@mbsd.msk.ru> Subject: Re: exception handling in kernel code Message-ID: <200608150800.44403.jhb@freebsd.org> In-Reply-To: <20060815074308.GN25753@deviant.kiev.zoral.com.ua> References: <20060814124658.1d416cbe@localhost> <20060814231223.3c7f1930@localhost> <20060815074308.GN25753@deviant.kiev.zoral.com.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <gurney_j@resnet.uoregon.edu> 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 <arch>/<arch>/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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608150800.44403.jhb>