www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1996/12/19/10:34:10

Date: Thu, 19 Dec 1996 17:27:21 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Robert Hoehne <robert DOT hoehne AT mathematik DOT tu-chemnitz DOT de>
cc: DJGPP workers <djgpp-workers AT delorie DOT com>
Subject: Re: Question about exceptions
In-Reply-To: <Pine.HPP.3.95.961219113421.7752D-100000@newton.mathematik.tu-chemnitz.de>
Message-ID: <Pine.SUN.3.91.961219170457.25806B-100000@is>
MIME-Version: 1.0

On Thu, 19 Dec 1996, Robert Hoehne wrote:

> But now I found, that this works ONLY, if the debuggee writes
> direct using it's _dos_ds to the video-memory and NOT when
> using functions like 'printf' (they write to video-mem in
> real mode).

Since RHIDE will only debug DJGPP programs, I think the only cases you 
should be concerned about are screen writes using one of the following:

	- DOS I/O functions (e.g., printf)
	- BIOS screen writes (e.g., int86(0x10,...)
	- direct screen writes using _dos_ds
	- direct screen writes which don't use _dos_ds (they might set up 
their own selector to access video RAM)
	- direct video RAM acces using nearptr

Hope I didn't forget anything.

> Now my question: Is it possible in general also to generate an
> exeption, when the real mode code (mostly the bios) accesses
> the video-memory and if it is possibly how or is the above
> whish from too hard?

I don't know if there is any general solution.  But I can suggest a
solution for the DOS and BIOS cases.  For the DOS case, you can install a
real-mode callback for Int 29h.  This is the interrupt called by Int 21h
when it sees a write function which writes to the CON device.  Int 29h
gets called for each character which is written to the screen.  Beware: 
when Int 29h is called, the InDOS flag is always set, since it is called
by a DOS function.  So you cannot do anything that involves DOS calls,
including VM paging.  I would suggest that the handler is only installed
when you are about to run the debuggee, then uninstalled immediately upon
seeing the first character to be written (after you set a flag which tell
RHIDE it should switch the screen at the first possible moment).  The
handler needs to be locked, of course, since it will be called in the
middle of a DOS call.

For the BIOS case, you can install a real-mode callback for Int 10h.  The 
same caveats as above apply here too.  In fact, you might just install a 
single hook for Int 10h which will catch both cases, since Int 29h 
eventually just calls the write-teletype function of Int 10h.

I don't know what can you do about the two last cases.

- Raw text -


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