www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/02/26/15:00:22

From: richardson AT evansville DOT edu (Tony Richardson)
Newsgroups: comp.os.msdos.djgpp
Subject: Hooking Interrupts
Date: 26 Feb 2003 11:48:42 -0800
Organization: http://groups.google.com/
Lines: 48
Message-ID: <2f64dfca.0302261148.4ac4fb9d@posting.google.com>
NNTP-Posting-Host: 192.195.225.6
X-Trace: posting.google.com 1046288922 30058 127.0.0.1 (26 Feb 2003 19:48:42 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: 26 Feb 2003 19:48:42 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

This is probably a stupid question ...

I'm trying to get a better understanding of protected mode
and real mode interrupts.

I've written my own interrupt routine to replace the
protected mode timer ISR.  I don't want to chain into
the original ISR because I want to double the timer
rate and then call the original ISR every other time
my ISR is run.  I installed the old ISR as protected
mode interrupt 0x81.  How do invoke this interrupt?
Do I use int86()?  The reference manual seems to imply
that this would invoke the real mode ISR.  _dpmi_int()
also seems to run the real mode ISR.

I've included relevant code below.  I would appreciate
constructive criticism.

Thanks,
Tony Richardson
richardson AT evansville DOT edu


================= main() code ======================
 //load the address of the old timer ISR into the OldISR structure
 _go32_dpmi_get_protected_mode_interrupt_vector(0x08, &OldISR);
 _go32_dpmi_set_protected_mode_interrupt_vector(0X81, &OldISR);

 //point NewISR to the proper selector:offset for handler function
 NewISR.pm_offset = (int)TickHandler;
 NewISR.pm_selector = _go32_my_cs();

 // Double the tick rate
 count = 32768;
 disable();
 outportb(TICK_T0_8254_CWR,  TICK_T0_8254_CTR0_MODE3);
 outportb(TICK_T0_8254_CTR0, count & 0xFF);
 outportb(TICK_T0_8254_CTR0, (count >> 8) & 0xFF);
 _go32_dpmi_set_protected_mode_interrupt_vector(0x08, &NewISR);
 enable();

================= TickHandler() code ======================
 TickCtr++;
 // every other tick we want to call the old ISR
 if(TickCtr >= 2) {
  TickCtr = 0;
  int86(0x81, &regs, &regs);   /* What do I use here? */
 }

- Raw text -


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