Debugging interrupt handlers in SoftICE



How do I debug interrupt handlers with SoftICE/W?


One of the most common questions we get about SIW is about debugging interrupt handlers. Here are some notes about the common questions and answers that we get.

First of all let's start in DOS before Windows is loaded. When you boot your machine, the BIOS programs your two interrupt controllers

The primary controller is located from 08H to 0FH. This controller handles IRQs 0-7. The secondary interrupt controller is programmed at 70H to 77H. This controller handles IRQs 08H-0FH.

When Windows starts, it reprograms the two interrupt controllers. The primary controller is re-programmed to 50H-57H and the secondary

controller is re-programmed to 58H-5FH. Thus, if someone wanted to access IRQ 5 in Windows, you would look at 55H. This fact is reflected in Soft-ICE for Windows when you use the IDT command. The IDT command only goes from 0 to 5FH, exactly where Windows has reprogrammed the interrupt controllers to.

When you enter a DOS box, your DOS programs are still going on the assumption that the controllers are still programmed at 08H-0FH and 70H-77H. When you access an interrupt handler from a DOS program Windows intercepts the call and hands it to the correct handler. As far as your program is concerned, the correct DOS address. In Soft-ICE/W, to look at your DOS interrupt handler, use the following equation:

@&0:vector * 4

where vector is the interrupt vector you are debugging.

For example: bpx @&0:11 * 4 would set a breakpoint on the first instruction of the interrupt vector for IRQ 11 in a DOS box. ( Please make sure that the @ is present or we will overwrite the byte in the vector with an INT 3 (0xCC), which will cause the interrupt to jump to the middle of your video ROM)

If you want to look at where the controller is really reprogrammed to, use add 50H to the IRQ.

Old KB# 11071
Comment List
Related Discussions