Re: Exception trapping from a kernel extension
Re: Exception trapping from a kernel extension
- Subject: Re: Exception trapping from a kernel extension
- From: Michael Smith <email@hidden>
- Date: Fri, 20 Jul 2007 20:32:15 -0700
On Jul 19, 2007, at 10:00 PM, Jevin Sweval wrote:
I'm writing a kext that will let me access the MSRs on my CPU using
rdmsr and wrmsr. The problem is, if you make a booboo with what
register you read or write and what you write to the register, you get
a general protection fault. Linux has methods to catch the GPFs and
not panic (rdmsr_safe and wrmsr_safe) and it appears that Mach has a
rdmsr_carefully. The Mach method seems to be accessible only from the
kernel? Regardless, in osfmk/i386/trap.c line 551, that a thread can
set its own exception handler. I would like to do that, but it seems
that the thread_t that a kext uses does not have the recover member.
How should I go about trapping these exceptions in my kext? Thanks!
You don't. MSRs are owned by the kernel and should not be touched by
extensions. Kexts are not and cannot be sufficiently well informed
about the state of the system to be trusted to generate most
exceptions (certain pagefault and other exceptions may be generated
in an invisible fashion as part of supporting the execution model).
= Mike
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden