Presentation is loading. Please wait.

Presentation is loading. Please wait.

Set 20 Interrupts. INTERRUPTS The Pentium has a mechanism whereby external devices can interrupt it. Devices such as the keyboard, the monitor, hard disks.

Similar presentations


Presentation on theme: "Set 20 Interrupts. INTERRUPTS The Pentium has a mechanism whereby external devices can interrupt it. Devices such as the keyboard, the monitor, hard disks."— Presentation transcript:

1 Set 20 Interrupts

2 INTERRUPTS The Pentium has a mechanism whereby external devices can interrupt it. Devices such as the keyboard, the monitor, hard disks etc. can cause such interrupts, when they require service of some kind, such as to get or receive a byte. For example, when you press a key on the keyboard this causes an interrupt. 2

3 WHAT HAPPENS WHEN AN INTERRUPT OCCURS When the pentium is interrupted, it completes the current instruction, then pushes onto the stack the flags register plus the address of the next instruction (the return address). It then carries out the procedure that services the interrupt involved. Then it uses a special return instruction iret which pops the flags register from the stack, and pops and uses the return address to resume doing whatever it was doing before the interrupt occurred. 3

4 EXAMPLES OF INTERRUPT ROUTINES When you press a key on the keyboard, the interrupt routine that the Pentium carries out is to input the key and store it in a buffer in memory. Another example is provided by a separate timer chip which interrupts the Pentium typically every 10 milliseconds. This interrupt is called a timer tick. Here the Pentium’s interrupt routine updates it’s time of day (it actually stores the number of timer ticks since midnight). 4

5 HOW DOES THE PENTIUM KNOW WHAT CAUSED THE INTERRUPT? 5 PENTIUM INTERRUPT CONTROLLER from the timer chip from the keyboard from the monitor data bus interrupt requested interrupt acknowledged identification of the interrupt 1 2 3 4

6 1.The device signals its request, for an interrupt service, to the interrupt controller. 2.The interrupt controller sends a signal to the Pentium requesting an interrupt. 3.The Pentium is hard-wired to respond by finishing its current instruction, pushing the flags register, and the address of the next instruction (the return address) onto the stack, and then sending an acknowledgment signal back to the interrupt controller. 4.The interrupt controller then puts onto the data bus a code that identifies which which of its input lines (and hence which device) is requesting this interrupt. 6

7 HOW THE PENTIUM FINDS THE CORRECT INTERRUPT ROUTINE All Pentiums maintain an area of memory at the same fixed location called a jump table. This consists of a sequence of 4 byte entries, where each entry consists of an (offset value, segment register value). These entries (called interrupt vectors) specify the locations of the various interrupt routines. The code that the interrupt routine sends the Pentium, to identify the kind of interrupt, is used to index this jump table and so locate the appropriate interrupt routine. 7

8 NOTES From the instant the device signals its request for an interrupt routine, up to when the Pentium starts executing the routine required, everything described on the proceeding slides takes place automatically entirely by wired-in hardware. The jump table makes it simple for new versions of the interrupt routines to be written and placed at different locations in memory when new versions of the operating system are produced. All that needs to be changed is the corresponding entries in the jump table. 8

9 INTERRUPT VECTOR NUMBERS The 4 byte entries (interrupt vectors) in the jump table are numbered. For example interrupt vector 9 is for the keyboard, and interrupt vector 3Ch is for the timer tick. 9

10 RETRIEVING & CHANGING INTERRUPT VECTORS The code to retrieve an interrupt vector (so you can store & later restore it) is of the form: MOV AL,… ; the interrupt vector no., e.g. 9 for the keyboard MOV AH, 35h INT 21h This puts the offset value part of the interrupt vector into BX, and the segment register part into ES The code to change an interrupt vector is of the form: MOV AL,… ; the interrupt vector no. LEA DX,… ; the offset of the new interrupt routine ; DS should contain the segment value concerned MOV AH, 25H INT 21H 10


Download ppt "Set 20 Interrupts. INTERRUPTS The Pentium has a mechanism whereby external devices can interrupt it. Devices such as the keyboard, the monitor, hard disks."

Similar presentations


Ads by Google