Mail Archives: djgpp/1996/06/10/06:31:10
Hi all,
I'm in the middle of writing some c++ code which intercepts interrupt vectors
and replaces the routines with my own.
I've now hit the classic problem of telling the interrupt function where the
function's class is.
This is the mechanism that I am using.
Firstly I define a new structure which is a combination of the registers
and a pointer to the class such as _MyRegs below. i.e.
class VectorIntercept
{
// class blurb etc.
virtual void InterruptRoutine(_go32_dpmi_regs *r);
struct _MyRegs
{
_go32_dpmi_regs *regs; // processor registers
VectorIntercept *me; // tag my own stuff at the end of the block.
} Regs;
private:
static void globInterrupt(struct _MyRegs *r);
};
I then use this instance of _MyRegs as my register block when I set
up my.real mode callback. i.e.
_go32_dpmi_allocate_real_mode_callback_iret(
&newvect,
(_go32_dpmi_regs *) &Regs);
My global interrupt routine is then written as follows:-
void VectorIntercept::globInterrupt(struct _MyRegs *r)
{
r->me->InterruptRoutine(r->regs);
}
and hey presto my virtual class function InterruptRoutine() is called with
the _go32_dpmi_regs as its parameter.
This all works great and I can set up any number of interrupt routines.
to do different things I just sub class VectorIntercept with a new virtual
InterruptRoutine() and everything works great.
Now my question.
Can I make the assumption that this will work with future revs of djgpp?
I cannot see why it shouldn't, but then I don't know if you guys are
going to radically change the way the interrupts are accessed.
Thanks,
Steve.
- Raw text -