www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/04/24/07:43:52

Date: Mon, 24 Apr 1995 11:22:11 +0100 (BST)
From: Neville B Dastur <nbd54 AT miranda DOT umds DOT ac DOT uk>
To: Bill Davidson <bdavidson AT ra DOT isisnet DOT com>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Chaining real-mode interrupts

On Mon, 24 Apr 1995, Bill Davidson wrote:

> 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

Just an idea, but it might not be a problem with GCC, but rather that you 
are not clearing the interupt on the controller, I think its some writes 
to port 20h that might be need, I found this to be the problem when 
trying to hook int 9h myself, but at that time I was using TurboC.

Hope this helps. 

- Raw text -


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