delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/23/22:51:49

Date: Thu, 23 Aug 2001 22:50:25 -0400
Message-Id: <200108240250.WAA05713@envy.delorie.com>
X-Authentication-Warning: envy.delorie.com: dj set sender to dj AT envy DOT delorie DOT com using -f
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
In-reply-to: <Pine.GSO.4.21.0108231249060.5876-100000@neptune.calstatela.edu>
(lsantil AT calstatela DOT edu)
Subject: Re: TSR/ISR Interaction
References: <Pine DOT GSO DOT 4 DOT 21 DOT 0108231249060 DOT 5876-100000 AT neptune DOT calstatela DOT edu>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> How does one get register arguments from cwsdpmi or otherwise?  I have gcc
> inline asm macros that I wrote that can put these into global vars but is
> there a better way?

Make inline functions with inline asms that have register constraints.
See <inlines/pc.h> for examples.  Or, use __dpmi_int() or int86().  Or
assembler.

> Can selectors and offsets be temporarily "mapped" into the ISR's data
> space?  I know one can do this with selectors that are created by the app
> itself but I'm not sure if this might work when the selector and offset
> are passed thru a interrupt call.

Like any ISR, the only selector you *know* you have is the one in %cs.
Given that (at least with a DJGPP program) you can get a working %ds
(there are two selectors here - one that is always valid, and one that
is invalidated for Ctrl-C and other interrupts.  Use the always valid
one).  Selectors are selectors; you can load any of them into a
segment register.  The only difference in protected mode is that you
must make sure the value *is* a selector, and not just random data.
The fact that you're in an ISR doesn't change the validity of
selectors.

If you mean real-mode segment values, those you must convert to linear
addresses (seg*16+ofs) and either use the <sys/farptr.h> type
functions to access them or load the _dos_ds selector (which maps to
physical 0-1M) into a segment register.

> Also, what is the most proper way to implement TSRs in djgpp these
> days?  I noticed in the LibC docs that there are DPMI which seem to
> simplify the process.  I also have Charles Sandmann's djgpptsr.c from
> simtel.

I don't know if anyone has done a TSR with the most recent djgpp.  The
djgpp tsr kit (v2tk/djgpptsr.zip) is the most recent working code, but
I don't know if it works with the latest djgpp.

LibC provides hooks for all the DPMI calls.  That doesn't mean it's
easy to use them ;-)

- Raw text -


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