delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/10/06/18:30:55

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Rod Pemberton <donthave AT noreply DOT bit>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Need to hook INT 21h from a DJGPP TSR
Date: Thu, 6 Oct 2005 22:17:16 +0000 (UTC)
Organization: cyberjustice.org
Lines: 59
Message-ID: <di47pc$lfa$1@sadr.dfn.de>
References: <cone DOT 1128591471 DOT 368325 DOT 13774 DOT 0 AT digisoft>
NNTP-Posting-Host: 66.28.207.11
Mime-Version: 1.0
X-Trace: sadr.dfn.de 1128637036 21994 66.28.207.11 (6 Oct 2005 22:17:16 GMT)
X-Complaints-To: usenet AT sadr DOT dfn DOT de
NNTP-Posting-Date: Thu, 6 Oct 2005 22:17:16 +0000 (UTC)
X-User-Real-E-Mail: nobody AT no DOT where DOT com
User-Agent: http://www.cyberjustice.org
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

This is your mistake -> PM TSR <-
I STRONGLY suggest a RM TSR(16-bit) by using OpenWATCOM or BorlandC
or assembly. If you were just writing an application there wouldn't
be too many problems with implementing int 0x21.  But, you are
wanting a TSR.

You are aware of two (out of many) problems:
1)reentrancy, INDOS flag, Critical Error flag, INT 28 "Dos IDLE
interrupt", timer interrupt
2)locking DPMI memory

You are not aware of these:
A)Your TSR needs to return to DOS, but you can't use DOS's TSR
function. Your PM TSR is in memory above 1Mb.  DOS's TSR function,
int 0x21,ax=0x3100 only works for RM memory, below <1Mb.

B)You need DPMI 1.0 call int 0x31, ax=0x0c01 "Terminate and Stay
Resident".  But no DPMI 0.9 hosts implement this call.  And, no
DPMI 1.0 hosts implement this call, either.

C)If you can't use a "Terminate and Stay Resident" call, how do you
keep your program in memory?  You get to create your own "Terminate
and Stay Resident" call.  Int 0x21, ah-0x4c is DOS-Exit in RM and
DPMI-Unload in PM.  You could chain this int before your TSR is
called, installing code between the two, allowing DPMI-Unlodad to
be called and preventing DOS-Exit from being called.  But, that of
course would require another RM assembly language TSR...

D)If you succeed on step C), you now have the problem of saving and
restoring DOS's internal structures using the poorly documented
calls:
"Get address of DOS swappable data area"  int 0x21, ax=5d06
"Get DOS swappable data areas" int 0x21, ax=05d0b

Why? Because you need to restore DOS to the state it was in before
your TSR ran. You may also need to tweak these:
int 0x21, ah=0x1a "Set Disk Transfer address"
int 0x21, ah=0x50 "Set PSP address"

And, then you need to figure out how to restart DOS execution...
The only place this is documented is "Undocumented DOS", by Andrew
Schulman which I believe is out of print...

E)If you manage all that, you could still create a conflict with
other DPMI/DOS extender hosts when they are loaded.  Most DPMI
hosts are passive.  That is if another one is installed, they won't
install.  What happens if you attempt to run an OpenWATCOM program
under the a DJGPP host such as CWSDPMI?  CWSDPMI is a paging DPMI
host where all memory must be mapped or allocated before use.
DOS4G/W and PMODEW are physically mapped and have a number of
Extended DOS interrupts.  The application could crash for lack of
functions or invalid memory accesses.  This is why some people
liked horrible but basic design of VCPI.  It allowed multiple PM
DPMI hosts and DOS extenders to coexist.


Rod Pemberton
--
Posted via: http://www.cyberjustice.org

- Raw text -


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