Mail Archives: djgpp/1995/03/07/09:14:48
About handling real-time interrupts:
According to the example somewhere in the into files, the
code to redirect the clock tick interrupt is:
_go32_dpmi_registers regs;
_go32_dpmi_seginfo old_handler,new_handler;
void Interruptor(_go32_dpmi_registers *r)
{
/* The routine that treats the interrupt */
...
}
...
/* To install the handler */
_go32_dpmi_get_real_mode_interrupt_vector(0x1C,&old_handler);
new_handler.pm_offset=Interruptor;
_go32_dpmi_allocate_real_mode_callback_iret(&new_handler,®s);
_go32_dpmi_set_real_mode_interrupt_vector(0x1C,&new_handler);
...
/* To uninstall */
_go32_dpmi_set_real_mode_interrupt_vector(0x1C,&old_handler);
_go32_dpmi_free_real_mode_callback(&new_handler);
This appears to work correctly, but I have some questions:
1- How to call the old interrupt handler at the end of the
new handler?
2- Is it necessary to guarantee that the new handler is
uninstalled before the program exits, normally or not?
3- Is this really safe?
Antonio Carlos M. de Queiroz
- Raw text -