Mail Archives: djgpp/1995/08/20/07:23:01
On 20 Aug 1995, Mats Grahm wrote:
> This works, but to be able to restore normal keyboard handling, I want to save
> the old handler. Should I use the protected or real mode version of
> _go32_dpmi_get_???_mode_interrupt_vector() ?
>
> I have tried both ways. As long as I only restore the keyboard at the end of
> the program, it doesn't seam to matter, I suppose go32 does some cleanup.
>
> But when I temporarily restore to the old handler to allow libgrx GetMouseEvent()
> to handle simultaneous keyboard and mouse events, I get a segmentation fault.
This is explained in the DJGPP FAQ list (available as faq102.zip from the
same place you get DJGPP):
18.8 Q: I did all the above, but my program occasionally still hangs...
A: Unfortunately, hardware interrupt handling in DJGPP v1.1x has a
few subtle bugs.
One cause of your problems might be that your interrupt handler
or some memory location it uses get paged out because of the
virtual memory mechanism, or because your program spawned a child
program. In that case, the interrupt might cause a call to a
non-existent service routine, with the obvious results.
Another cause of problems is that you hook one of the 3
interrupts which get special treatment from DJGPP: the timer
interrupt (Int 8), the keyboard interrupt (Int 9) and the mouse
interrupt (Int 33h). Go32 doesn't support restoring these
interrupt vectors, unless you run in DPMI mode, so if you try to
put the old handler back, your program will crash. If you really
need to restore it before program's exit in non-DPMI mode, you
can try to manipulate the IDT (Interrupt Descriptor Table)
directly. You can see an example of how this should be done in
the LadyBug debugger (look in the ldbgNNN.zip file at the same
place you get DJGPP).
- Raw text -