Interrupts: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Frank (talk | contribs)
m Link fixes
Frank (talk | contribs)
Line 46: Line 46:


==From the OS's perspective:==
==From the OS's perspective:==
When an interrupt comes in, the IDT (which is setup by the OS in advance) is used to jump to code portion of the OS, which handles the interrupt (and therefore called the "interrupt handler" or "[Interrupt Service Routines|Interrupt Service Routine]"). Usually the code interacts with the device, then returns to whatever it was doing previously with an <tt>iret</tt> instruction (which tells the CPU to load the state information it saved, from the stack). Before the <tt>ret</tt>, this code is executed, to tell the PIC that it's OK to send any new or pending interrupts, because the current one is done. The PIC doesn't send any more interrupts until the cpu acknowledges the interrupt:
When an interrupt comes in, the IDT (which is setup by the OS in advance) is used to jump to code portion of the OS, which handles the interrupt (and therefore called the "interrupt handler" or "[[Interrupt Service Routines]]"). Usually the code interacts with the device, then returns to whatever it was doing previously with an <tt>iret</tt> instruction (which tells the CPU to load the state information it saved, from the stack). Before the <tt>ret</tt>, this code is executed, to tell the PIC that it's OK to send any new or pending interrupts, because the current one is done. The PIC doesn't send any more interrupts until the cpu acknowledges the interrupt:


<pre>
<pre>
Line 53: Line 53:
</pre>
</pre>


In the case of the [keyboard|Getting Keyboard Input], the interrupt handler asks the keyboard what key was pressed, does something with the information, then acknowledges and return:
In the case of the [[Keyboard Input|keyboard input]], the interrupt handler asks the keyboard what key was pressed, does something with the information, then acknowledges and return:


<pre>
<pre>