Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Aug 2006 13:17:57 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Stanislav Sedov <ssedov@mbsd.msk.ru>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: exception handling in kernel code
Message-ID:  <200608141317.58034.jhb@freebsd.org>
In-Reply-To: <20060814194729.436fc453@localhost>
References:  <20060814124658.1d416cbe@localhost> <200608140932.57875.jhb@freebsd.org> <20060814194729.436fc453@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 14 August 2006 09:47, Stanislav Sedov wrote:
> On Mon, 14 Aug 2006 09:32:57 -0400
> John Baldwin <jhb@freebsd.org> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608141317.58034.jhb>