www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/11/03/01:15:00

Xref: news-dnh.mv.net comp.os.msdos.djgpp:3007
Newsgroups: comp.os.msdos.djgpp
Path: news-dnh.mv.net!mv!news.sprintlink.net!europa.chnt.gtegsc.com!news.kreonet.re.kr!news.dacom.co.kr!newsfeed.internetmci.com!in1.uu.net!psinntp!psinntp!psinntp!psinntp!netrixgw.netrix.com!news
From: ld AT jasmine DOT netrix DOT com (Long Doan)
Subject: Re: Interrupt chaining question / lint
Lines: 74
Sender: news AT netrix DOT com
Organization: Netrix Corporation
References: <DH84z0 DOT Aqs AT jade DOT mv DOT net>
Date: Wed, 1 Nov 1995 22:17:05 GMT
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

In article <DH84z0 DOT Aqs AT jade DOT mv DOT net> "George C. Moschovitis" <gmoscho AT cc DOT ece DOT ntua DOT gr> writes:

[snip]
>   I have the following problem an wonder if anyone can help me:
>   I 've written an interrupt handler in C plus code to install it etc,etc
>   and it all works fine. But now i want to chain the old handler to my
>   handler. I have saved the old vector in 
>   
>        void (*old_vec)();
>        
>   how can I call the handler that old_vec points to from C as gcc does not
>   support the interrupt keyword found in other pc compilers ?
>   I tried something like:
>    
>        asm ("
>          pushf
> 	 call (_old09)
>        ");
>        
>   but it just crashed... However I am not sure I 've written the above asm
[snip]

You can:
1. Use the _dpmi_..._chain_...() function to chain interrupts.
2. Try something like this:

void call_old_int (void);
void call_old_int_offset (void);
void call_old_int_selector (void);
asm ("
        .text
        .global _call_old_int
_call_old_int:
        pushf
        .byte  0x9a
        .global _call_old_int_offset
_call_old_int_offset:
        .byte  0x00
        .byte  0x00
        .byte  0x00
        .byte  0x00
        .global _call_old_int_selector
_call_old_int_selector:
        .byte  0x00
        .byte  0x00
        ret
");

static int
install_intterupt
(
void
)
{
  /* dpmi_seginfo ... here  */

  disable ();
  /* get old vector here    */

  *(unsigned short *)call_old_int_selector = old_si.pm_selector;
  *(unsigned int   *)call_old_int_offset   = old_si.pm_offset;

  /* set new interrupt here */
  enable ();
  return (1);
}

-- 
==============================================================
Long Doan                                        ld AT netrix DOT com     
Netrix Corporation                         ldoan1 AT osf1 DOT gmu DOT edu
13595 Dulles Technology Drive                               
Herndon Va 22071
==============================================================

- Raw text -


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