www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/15/11:30:41

Xref: news2.mv.net comp.os.msdos.djgpp:5003
From: malcolm AT manawatu DOT gen DOT nz (Malcolm Taylor)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Getting pre-interrupt register values in a DPMI hw_interrupt?
Date: Fri, 14 Jun 1996 23:39:50 GMT
Organization: Grafik Software
Lines: 47
Message-ID: <4pt12t$n2e@news.manawatu.gen.nz>
References: <4pnecj$669 AT news1 DOT goodnet DOT com>
Reply-To: malcolm AT manawatu DOT gen DOT nz
NNTP-Posting-Host: malcolm.manawatu.gen.nz
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

snarfy AT goodguy DOT goodnet DOT com (Snarfy AT GoodNet DOT Com) wrote:


>Hello.  It's been about a month since I asked this question without any 
>responses so I thought I would post again.

I'm sure I answered before :)

>I need to get and save the register values inside a DPMI hw_interrupt.
>The values I need though are the values that were there 'before' the 
>interrupt occured.  Under DPMI, some of the registers change and the
>stack gets switched (4k locked stack?) and I have no idea how to get 
>and save the old stack register values or the old cs:eip as well as 
>any other registers that get changed.  I need to do this in a timer
>interrupt, btw.  I have the interrupt working correctly, I just don't
>know how to get these values.

This problem was solved ages ago by the v2 development team to handle
exceptions (ie divide by zero segmentation violations ...). There is a
function called ___djgpp_hw_exception which invalidates ss and ds so
that there is a fault when you leave your HW int handler. This
generated fault is then interpreted by the exception handling code and
a signal is raised. You must call the function with a number in %al
which is converted by code in dpmiexcp.c Have a look in the function
except_to_sig to see the used numbers, all other numbers are mapped to
SIGILL which you can catch with the signal function. Inside your
signal handler you should check the exception structure to make sure
you are handling your signal (again look in dpmiexcp.c for examples).

So the process is:
Hook the interrupt,
Register a signal handler for SIGILL
In the interrupt call the ___djgp_hw_exception with a number
end the interrupt (EOI the PIC)
In your signal handler you can now get access to all your registers
etc. The easiest way is with setjmp library call.

Hope this helps,
Malcolm


>Thanks!

>Josh
>snarfy AT goodnet DOT com


- Raw text -


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