delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/03/06/20:24:29

Sender: nate AT cartsys DOT com
Message-ID: <36E1D56E.ABB127DE@cartsys.com>
Date: Sat, 06 Mar 1999 17:25:02 -0800
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.1 i586)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Getting cr2 in exception handler
Reply-To: djgpp AT delorie DOT com

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).  But:

* mov cr2 is a privileged instruction.
* There is a DPMI 1.0 exception handling function that passes it, but it
will be tricky to make it interoperate with DJGPP's exception handlers,
and anyway CWSDPMI doesn't support it.

I could, I suppose, use CWSDPR0 and read cr2 directly, but that's
difficult, since virtual memory will probably be required.  (It's a
malloc debugger whose memory usage is extremely inefficient, and I want
it to run on small boxes if possible.)

So: Does anyone know of another way to find the value of cr2?  I don't
care about it working in anything but CWSDPMI.

TIA
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019