🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #457

Re: which timer interrupt?

#457
From: William Lewis
Date: Wed, 09 May 1990 20:20
28 lines
1688 bytes
In article <1371.26461650@miavx1.acs.muohio.edu> rjlewis@miavx1.acs.muohio.edu writes:
>  I understand why you hook INT 8h, but how do you call the Original Int 8h
>handler, and have it RETURN to your code?  If you call the original int 8h 
>handler, it'll end with a IRET, and won't it bounce back to the currently 
>executing program (and NOT your handler). 

   No, although you have to call the old handler in a "special" way.
An INT xx instruction does several things:
   Pushes the flags (PUSHF)
   Pushes the program counter (CS:IP)
   Fiddles with the flags a little bit (interrupt mask, etc.)
   Jumps to the handler routine

     All an IRET has to do is pop the old flags and the old CS:IP
(and maybe reset an interrupt mask, I forget).  So you can simulate
an interrupt to any address by doing

 PUSHF
 CALL FAR addr

  and the IRET will return control to right after the CALL FAR instruction,
as expected.



-- 
JESUS SAVES   |  wiml@blake.acs.washington.edu       Seattle, Washington
but Clones 'R' Us makes backups!  |  47 41' 15" N   122 42' 58" W
Technical Details
Message-ID: <6938@blake.acs.washington.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!samsung!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!blake!wiml
References: <484@wjh12.harvard.edu> <j45cvma7f@tmsoft.uucp> <1371.26461650@miavx1.acs.muohio.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!samsung!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!blake!wiml
From: wiml@blake.acs.washington.edu (William Lewis)
Newsgroups: comp.sys.ibm.pc.programmer,alt.msdos.programmer
Subject: Re: which timer interrupt?
Summary: IRET, CALL FAR, PUSHF
Message-ID: <6938@blake.acs.washington.edu>
Date: 9 May 90 20:20:01 GMT
References: <484@wjh12.harvard.edu> <j45cvma7f@tmsoft.uucp> <1371.26461650@miavx1.acs.muohio.edu>
Reply-To: wiml@blake.acs.washington.edu (William Lewis)
Distribution: na
Organization: Clones `R' Us
Lines: 28