Mail Archives: djgpp/2000/10/04/20:00:26
From: | "Peter Remmers" <Peter DOT Remmers AT t-online DOT de>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | strange interrupt chaining problem with keyboard interrupt
|
Date: | Thu, 5 Oct 2000 01:00:35 +0200
|
Organization: | T-Online
|
Lines: | 60
|
Message-ID: | <8rgcqk$rdi$16$1@news.t-online.com>
|
Mime-Version: | 1.0
|
X-Trace: | news.t-online.com 970700436 16 28082 320094726121-0001 001004 23:00:36
|
X-Complaints-To: | abuse AT t-online DOT de
|
X-Sender: | 320094726121-0001 AT t-dialin DOT net
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 5.00.2615.200
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2615.200
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi!
I'm trying to hook the keyboard interrupt IRQ1
to filter some keys, and just calling the original handler
conditionally, i.e. not always. That means I can't use
_go32_dpmi_chain_protected_mode_interrupt_vector().
So I try to call the original ISR with a far call.
I use __dpmi_get_p_m_i_v() so the address I get can be called
with lcall, and I use _go32_set_p_m_i_v() so I can use
the wrapper.
I have to do a lcall instead of a ljmp, because the compiler
generates a stack frame for my inthandler, and the wrapper
pushes registers before calling it.
The problem is, I can't get the chaining to work even without
doing anything myself.
All keys work just fine, EXCEPT for num-lock, caps-lock,
scroll-lock and both of the shift keys! In which case the
program locks up.
I simply don't understand why! What makes those keys so special
above all the other keys?!?
I have tested it with IRQ0, the timer interrupt, and the counter
counted up without any problems...
I have two calls which print the intcounter before and after
the lcall to see if the machine hangs in the lcall or after.
Well, it hangs after the call to the original ISR.
Oh, and it makes no difference if I run it in a DOS window or
on pure DOS - exactly the same result.
My code looks like this (I left out the unimportant parts):
_go32_dpmi_seginfo irq1;
__dpmi_paddr oldirq1;
int count = 0;
void irq1handler()
{
++count;
textput(0,0, "before: %d ", count); // pokes into video memory
asm volatile("pushfl");
asm volatile("lcall *_oldirq1");
textput(20,0, "after: %d ", count);
}
int main()
{
irq1.pm_offset = (int)irq1handler;
_go32_dpmi_allocate_iret_wrapper(&irq1);
__dpmi_get_protected_mode_interrupt_vector(0x09, &oldirq1);
_go32_dpmi_set_protected_mode_interrupt_vector(0x09, &irq1);
keytest(); // calls bioskey(0x10) in a loop and prints the codes
__dpmi_set_protected_mode_interrupt_vector(0x09, &oldirq1);
_go32_dpmi_free_iret_wrapper(&irq1);
}
Peter
- Raw text -