Sender: nate AT cartsys DOT com Message-ID: <36E330B3.50D22056@cartsys.com> Date: Sun, 07 Mar 1999 18:06:43 -0800 From: Nate Eldredge X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.1 i586) MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: Getting cr2 in exception handler References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > On Sat, 6 Mar 1999, Nate Eldredge wrote: > > > I have an application where I need to set up an exception handler for > > page faults and have access to the value of cr2 (linear address to which > > access faulted). > > Why couldn't you look at the instruction that faulted and use some > heuristics to find out the address, without accessing cr2? > > For example, if the faulting instruction is "movl (%edx), %eax", then > the offending address is in EDX. I could, but I'd much rather not bloat my project by writing a disassembler into it. Especially with Intel's infinitely hairy addressing modes :-\ Using CWSDPR0 is starting to look better. The cr2 read is not critical, just a very nice feature, and so I can enable it only when CWSDPR0 is in use. This will of course require that the user has enough memory, and is okay with their buggy program (since my project is for debugging) running in ring 0... :) Still open to other suggestions of course. -- Nate Eldredge nate AT cartsys DOT com