Interrupt Service Routines: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
[unchecked revision][unchecked revision]
m (changed category to 'interrupts')
mNo edit summary
Line 1:
The [[:Category:x86|x86]] architecture is an interrupt driven system. External events trigger an interrupt - the normal control flow is interrupted and a '''interruptInterrupt serviceService routineRoutine''' (ISR) is called.
 
Such events can be triggered by hardware or software. An example of a hardware interrupt is the keyboard: Every time you press a key, the keyboard triggers IRQ1 (Interrupt Request 1), and the corresponding interrupt handler is called. Timers, and disk request completion are other possible sources of hardware interrupts.
Line 5:
Software driven interrupts are triggered by the int opcode; e.g. the services provided by MS-DOS are called by the software triggering INT 21h and passing the applicable parameters in CPU registers.
 
For the system to know which interrupt service routine to call when a certain interrupt occurs, offsets to the ISR's are stored in the interrupt[[IDT|Interrupt descriptorDescriptor table (IDT)Table]] when you're in [[Protected mode]], or in the interrupt[[Interrupt vectorVector table (IVT)Table]] when you're in [[Real Mode]].
 
An ISR is called directly by the CPU, and the protocol for calling an ISR differs from calling e.g. a C function. Most importantly, an ISR has to end with the iret opcode, whereas usual C functions end with ret or retf. The obvious but nevertheless wrong solution leads to one of the most "popular" tripple-fault errors among OS programmers.
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu