www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/04/24/05:35:19

Date: Mon, 24 Apr 1995 04:54:06 -0300 (ADT)
From: Bill Davidson <bdavidson AT ra DOT isisnet DOT com>
Subject: Chaining real-mode interrupts
To: djgpp AT sun DOT soe DOT clarkson DOT edu

Hi:
I am having a problem chaining real-mode hardware interrupt vectors.
I have read (many times) the relevant portions of Eli's FAQ (wonderful), 
I have read the _go32_dpmi_* docs, and I even did a search on dj's 
archive (searching on "interrupt").  I read sb.zip and the parts of the 
ladybug source that deal with interrupts.

I am porting a DOS application that hooks the keyboard (INT 9) and timer 
(INT 8, but I changed it to 0x1c, the user hook) interrupts.  The old 
code called the old IV's to chain to them; the actual interrupt handler 
code installed is minimal (kbd: read a port; timer: increment a counter).

Based on my reading of the docs I installed both protected mode and real 
mode interrupts; the PM handlers are installed via 
_go32_dpmi_chain_protected_mode_interrupt().  The real mode handlers are 
installed via _go32_dpmi_set_real_mode_interrupt(), and my real mode 
handlers call _go32_dpmi_simulate_fcall_iret(), passing the regs.x.cs and 
regs.x.ip information as outlined in Eli's FAQ.

If I install only the (chained) PM handlers, everything seems to work 
great.  But when I install the RM handlers, the machine either hangs 
(timer) or segfaults (or GPFs; exception 13??) when a key is pressed 
(kbd).  Does anyone have experience chaining to these real-mode 
interrupts?  What _exactly_ needs to be passed to 
_go32_dpmi_simulate_fcall_iret()?  Am I using the right function?  And 
yes, I am filling in the _go32_dpmi_registers structure (.x.cs and .x.ip) 
with values returned from the ..._get_real_mode_interrupt() function via 
a pointer to a _go32_dpmi_seginfo structure. 
(regs.x.cs=rm_kbd.rm_segment, etc).

Finally, as I said, everything seems to work OK with just the PM handlers 
chained (no DPMI server present).  At least, the keyboard seems fine and 
nothing hangs; no idea how the timer is doing.  The application program 
is, at this point, pretty minimal; it's really just a test for a library 
I'm porting (DFLAT).  Everything else works great, it's just these cursed 
real mode interrupt handlers that are breaking.  Do I really need them?

Please, any ideas/feedback would be much appreciated.  I had hoped to 
make the ported library available on the 'Net, but if the interrupt 
handling is suspect then I dare not do so.
Thanks in advance.
Bill Davidson
bdavidson AT ra DOT isisnet DOT com

- Raw text -


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