Re: Real mode int from protected mode and back



"gerotica" <spamtrap@xxxxxxxxxx> wrote in message
news:53bfea38-02ab-4b18-8b8a-259d1490c3e2@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

But, with PM mode set in the system, wouldnt some pointer operation
in the file routines crash it? Because the processor is in PM and will
not allow those RM operations..

As I said, your TSR will be called with the processor in real mode (or V86
mode which is pseudo real-mode). This is what will happen:

(1) App is running in PM.

(2) App executes one of your patches.

(3) Your patch sets [E]AX and [E]DX as appropriate, then executes int 61h.

(4) The DPMI host executes its PM int 61h ISR.

(5) Because neither the DPMI host nor the application has hooked PM int 61h,
the default int 61h DPMI ISR sets regs EAX..EDI and Flags, *switches the CPU
to real-mode* and executes an int 61h. That is, it *reflects* the interrupt
to the real-mode int 61h ISR.

(6) Your TSR now gets control and does its thing. Notice here that the CPU
is in *real mode*. Finally your TSR executes an RTI.

(7) The DPMI Host saves the values of EAX..EDX and Flags, *switches back to
PM*, restores the register values into the real CPU registers and executes
an RTI.

(8) The application continues at the next instruction after the int 61h,
with EAX..EDX and Flags set to the values they had when your TSR executed
its RTI instruction.

It's a little more complicated than that (stacks are swapped and other
things are done behind the scenes by the DPMI host), but that's essentially
what takes place.

--
Jay

Jason Burgon - author of Graphic Vision
http://homepage.ntlworld.com/gvision

.



Relevant Pages

  • Re: Need to hook INT 21h from a DJGPP TSR
    ... be too many problems with implementing int 0x21. ... A)Your TSR needs to return to DOS, but you can't use DOS's TSR ... DPMI 1.0 hosts implement this call, ...
    (comp.os.msdos.djgpp)
  • Re: Using C functions in a TSR program
    ... and it is things like this that *might* be breaking your TSR. ... also the entry for Int 21h/AX=5d06h. ... places that errorFlag is ever 1 byte before the InDOS flag... ... the file, and run the TSR and the application, the system hangs. ...
    (comp.os.msdos.programmer)
  • Interrupt verbiegen
    ... Begin: jmp Install;TSR installieren ... int 20h ... Tsr PROC FAR ... word ptr indos;lese indos byte aus ...
    (de.comp.lang.assembler.x86)
  • Need to hook INT 21h from a DJGPP TSR
    ... I'm developing a DJGPP TSR which will be a installable FS to access Ext2 partitions from DOS. ... I want to hook INT 21h, to provide LFN support and some more functions. ...
    (comp.os.msdos.djgpp)
  • Re: TSR issues (with code)
    ... make it lock ... ... I thought my PC lost two minutes by running your TSR, ... another DPMI host, i.e., you've loaded your TSR and run an PM OW ... I believe that CWSDPMI, CWSDPR0, and PMODETSR ...
    (comp.os.msdos.djgpp)