Date: Tue, 22 Aug 2006 12:36:40 +0200 From: "Attilio Rao" <attilio@freebsd.org> To: "Stanislav Sedov" <ssedov@mbsd.msk.ru> Cc: freebsd-hackers@freebsd.org Subject: Re: exception handling in kernel code Message-ID: <3bbf2fe10608220336s24968560i8565040a2d7eb9c7@mail.gmail.com> 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
2006/8/14, Stanislav Sedov <ssedov@mbsd.msk.ru>: > 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. Mmm, I think that a better approach would be refering to different MSRs tables for pentium, p6 and Pentium 4 (if I remind correctly they are which show differences). It is more extensible, portable and possibly cleaner (I.E: you could port automatically to openbsd/netbsd, adding new table and make minimum modifies, etc.) You could find differences in the tables in the Intel manual (vol. 3) and for undocumented MSRs (if I remind correctly) you could find informations here: http://www.x86.org/articles/p5msr/pentiummsrs.htm or similar sites. Attilio -- Peace can only be achieved by understanding - A. Einstein
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3bbf2fe10608220336s24968560i8565040a2d7eb9c7>