Mail Archives: djgpp/1994/08/17/20:59:48
Dear all,
I'm trying to incorporate a perfomance analyzer (profiler) under
edebug32 of go32. I tried to use the timer interrupt (0x08) at 1000
times a second to get the eip of the current running program.
After installing the interrupt, the timer chip is reprogrammed
so that int 0x08 is called every 1 milisecond. This routine
runs fine until the other program try to access the disk, which
causes the computer to reboot.
Questions:
1. How can I write the ISR in a way that allows every other
actions to be processed right?
2. Is there a way that I can write the ISR directly (without
the overhead added by _go32_dpmi_...) ?
3. Is there a better way to call the original int 0x08?
4. How do I access the stack (to find the eip before the
interrupt is called.)?
The interrupt routine is as follow:
#define calls_per_tick 55 /* calls per .055 sec. */
static _go32_dpmi_seginfo rm_old_irq;
static _go32_dpmi_registers rm_regs;
static _go32_dpmi_seginfo rm_si;
static _go32_dpmi_seginfo pm_old_irq;
static _go32_dpmi_seginfo pm_si;
static _go32_dpmi_registers alias_irq_regs;
volatile unsigned int tick_count = calls_per_tick;
/* ------------------------------------------------ */
void
rm_irq_08 ()
{
asm("cli");
get_and_analyze_eip (); /* Currently does nothing */
tick_count--;
if (tick_count)
{
asm("mov $0x20,%al");
asm("out %ax,$0x20");
}
else
{
alias_irq_regs.x.cs = rm_old_irq.rm_segment;
alias_irq_regs.x.ip = rm_old_irq.rm_offset;
alias_irq_regs.x.ss = alias_irq_regs.x.sp = 0;
_go32_dpmi_simulate_fcall_iret(&alias_irq_regs);
tick_count = calls_per_tick;
}
asm("sti");
}
/* ------------------------------------------------ */
void
pm_irq_08 ()
{
}
/* ------------------------------------------------ */
static int
install_irq ()
{
int ret;
rm_si.pm_offset = (int) rm_irq_08;
pm_si.pm_offset = (int) pm_irq_08;
pm_si.pm_selector = _go32_my_cs();
ret = _go32_dpmi_allocate_real_mode_callback_iret(&rm_si, &rm_regs);
if (ret)
return 0;
disable();
_go32_dpmi_get_real_mode_interrupt_vector(8, &rm_old_irq);
_go32_dpmi_get_protected_mode_interrupt_vector(8, &pm_old_irq);
_go32_dpmi_set_real_mode_interrupt_vector(8, &rm_si);
_go32_dpmi_chain_protected_mode_interrupt_vector(8, &pm_si);
enable();
return 1;
}
Hung Bui
Netrix Corporation
- Raw text -