Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
References
Text: Tanenbaum ch.1.4.3, ch.5.1.5
Slides on interrupts:
http://www.cs.umb.edu/ulab/Interrupts1.htm
Com Port
Bus
x86 Interrupts
Interrupt signals go from device to the PIC
and to CPU
All 3 signals are on the bus
Program the PIC and device using IN or
OUT instructions on certain I/O port
address, e.g.
PIC : 0x20 and 0x21
COM2: 0x2f8, 0x2f9
Steps 1-5:
Step 6:
Steps 10-13:
Steps 7-9:
routine
initialization steps
wait forever loop
shut down interrupts
interrupt handler, need the envelope
From $pclibsrc/irq3.s: The bold lines are the essential ones you should understand. The others date
from Linux and are only needed to guard against bad user-level code.
# like linux SAVE_MOST and RESTORE_MOST macros in irq.h
.text
.globl _irq3inthand
KERNEL_DS = 0x18
_irq3inthand: cld
# D bit gets restored by iret (this can be dropped)
push %es # in case user code changes data segs (this can be dropped)
push %ds # (this can be dropped)
pushl %eax
# save C scratch regs
<---(1) register saves
pushl %edx
pushl %ecx
movl $KERNEL_DS, %edx
# (this can be dropped)
mov %dx, %ds
# (this can be dropped)
mov %dx, %es
# (this can be dropped)
call _irq3inthandc # call C interrupt handler
<---(2) call into C
popl %ecx
<---(3) register
restores
popl %edx
popl %eax
pop %ds #(this can be dropped)
pop %es #(this can be dropped)
iret
<---(4) iret instruction