www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/04/24/17:08:16

Date: Mon, 24 Apr 1995 17:04:12 +0300
From: eliz AT is DOT elta DOT co DOT il (Eli Zaretskii)
To: bdavidson AT ra DOT isisnet DOT com
Subject: Re: Chaining real-mode interrupts
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

> I am having a problem chaining real-mode hardware interrupt vectors.

Check out the following gotchas:

	1) Did you call _go32_dpmi_allocate_real_mode_callback_iret()
before _go32_dpmi_set_real_mode_interrupt_vector(), as the FAQ tells you?
The following fragment of your message seems to imply that you didn't
call _bla-bla-allocate_real_mode_callback_iret():

> 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. 

	2) Do you set SS and SP to zero before calling
_go32_dpmi_simulate_fcall_iret() in your RM handler to chain to the previous
handler in the chain?  I think you might have to also zero-out FLAGS, but I'm
not sure.

	3) If your handlers do not always chain to the previous ISRs, you
should send EOI (end-of-interrupt) to the interrupt controller when they
don't chain.

	4) Is your program sufficiently large (larger than the available free
PHYSICAL RAM) so that it pages to the disk?  If so, then under current version
of DJGPP some memory that your interrupt handler touches might be paged out,
and when that happen AND the interrupt arrives, your system will surely crash.
There is no general way to fix this in DJGPP v1.x, because go32 doesn't support
page locking.  But if your program doesn't page (you can check it by putting
``topline'' into your GO32 environment variable and watching memory usage), then
this is not your problem.

If all of the above doesn't help, download PCTIME12.ZIP from SimTel/msdos/c.  It
has a working example of hooking the timer interrupt, which you can use as
starting point.  (E.g., it includes a blurb about a bug in gcc 2.6.0 and gives a
solution for it.)

> 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.

In non-DPMI mode, if you only hook the PM interrupt, you will lose interrupts
when your machine is in real mode.

> I have read (many times) the relevant portions of Eli's FAQ (wonderful), 

Thanks for the compliment.  If you find any subtle points which need to be added
to that chapter of the FAQ, please let me know.  A new revision of the FAQ is in
the works and should be available in a week or so.

- Raw text -


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